Zoom Problem (.cap added)

For questions about using Classic.

Post » Fri Feb 25, 2011 9:29 am

In my level editor, you can zoom in or out. There's a cursor that follows the mouse in a snap-to fashion, and a panel on the side of the editor to select a tile from a tileset.

Problem is, when the zoom is greater than 100 the cursor is no longer positioned correctly; it's offset to the lower left, preventing me from selecting the correct tile when zoomed in.

How can I fix this?
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Feb 26, 2011 12:17 am

Anyone? I can post a .cap if needed..
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Feb 26, 2011 12:51 am

Sounds like your trying to go past what bounded scrolling will allow.
To test tick unbounded scrolling in preferences.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Feb 26, 2011 1:07 am

Unbounded scrolling is already checked.

I should have mentioned this in the first post: The layer the tileset is on has a zoomX/Y rate of 0% so you can zoom in on the map editor part (the grid) without affecting the tileset and menus. That's what's causing the problem. I think I just need to add something to the event that sets the cursor position to the mouse, so that it changes with the zoom %, but I'm not sure what.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Feb 26, 2011 1:51 am

Well without seeing how your doing the snap, I'd say the zoom should modify the snap by a percent.
So if your snap was 25 with a zoom of 100 % it would be more like 50.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Sat Feb 26, 2011 2:10 am

I also have a similar problem. When I use a zoom, all my HUD layers (the ones with Scroll X/Y Rates = 0%) will get positioned wrong
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Sat Feb 26, 2011 2:13 am

[quote="newt":3ddsdvz4]Well without seeing how your doing the snap, I'd say the zoom should modify the snap by a percent.
So if your snap was 25 with a zoom of 100 % it would be more like 50.[/quote:3ddsdvz4]


Exactly! I'm just not entirely sure how to put that into the expression. I've messed around with it but no luck. The cursor snaps to the mouse like so:

Cursor.x = int(MouseX/8)*8
Cursor.y = int(MouseY/8)*8

8x8 tiles, of course. Zoom goes by the hundreds, 100%, 200%, 300%, etc.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Feb 26, 2011 3:28 am

I haven't tested it, but from my head:
If zooming in to 200%, the area (virtually) represents double the size. Theoretically

Cursor.x = int(MouseX * (Zoom/100)/8) * 8

should work.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Feb 26, 2011 3:48 am

[quote="tulamide":215exyzh]I haven't tested it, but from my head:
If zooming in to 200%, the area (virtually) represents double the size. Theoretically

Cursor.x = int(MouseX * (Zoom/100)/8) * 8

should work.[/quote:215exyzh]

Damn. Sounds like it would work, but it doesn't. I'll upload a .cap soon, might make things a bit easier. I really need to figure this out :T
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Sat Feb 26, 2011 4:16 am

Here's a .cap I quickly put together to demonstrate the problem: Download Here

The white cursor is for placing tiles, and is on the layer that zooms. The red cursor is for selecting tiles, and is on the layer that doesn't zoom.

Use the mouse wheel to zoom in or out.

Notice how the red cursor becomes offset when zoomed in. (The mouse has to be over the panel on the right to see this)
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests