You are not logged in.

kima

Beginner

  • "kima" started this thread

Posts: 24

Location: Lucca - Italy

Occupation: Photographer / Virtual Tour

  • Send private message

1

Thursday, May 4th 2023, 2:01pm

Mouse Wheel zoom in position

Hello, i have this code for scale layer with the mouse wheel.


I would like the zoom to be performed at the point where the mouse is.

It should be considered that the zoomed layer is a child of another containing layer.

Can anyone advise me?

thank you

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<action name="ZoomImage_image_onmousewheel">

if(ZoomImage_iszoom,
	if(ZoomImage_wheeldelta GT 0.0,

		if(ZoomImage_startzoom,
			set(ZoomImage_startzoom,false);
			copy(ZoomImage_start_wheeldelta, ZoomImage_wheeldelta);
			copy(ZoomImage_start_imagescale, get(layer[ZoomImage_].scale));
		);

	div(ZoomImage_tmp, ZoomImage_wheeldelta, ZoomImage_start_wheeldelta);
	mul(layer[ZoomImage_].scale, ZoomImage_start_imagescale, ZoomImage_tmp);
	,
	mul(ZoomImage_sit,get(wheeldelta),0.09);
	mul(ZoomImage_sit,layer[ZoomImage_].scale);
	add(layer[ZoomImage_].scale,ZoomImage_sit);

	);
);

</action>