Zoom center not correct with CSS transform scale

Hi there,
I am facing the same problem with another problem. When zooming, the zoom center is not at my pointer.
I try to go through the source code but it seems hard for me to fix the problem by rewriting the getPosition function as it is not mounted so I cant get it.
So is it the only way that I intercept the event on the parent dom and change the event before dispatchEvent? I do think this is not a good solution.
Any help would be appreciated!

This is obviously not the best solution since it accesses private variables but it worked for me and seems to have no side effects since _currentMousePosition is only used for the mouse wheel. This does not fix right click or pinch zooming.

var zoomFactor = 1.5 //example
var cameraController = this._viewer.scene.screenSpaceCameraController;
this._viewer.screenSpaceEventHandler.setInputAction (
function(movement) {
if(zoomFactor != 1)
cameraController._aggregator._currentMousePosition = new Cesium.Cartesian2(movement.endPosition.x / zoomFactor, movement.endPosition.y / zoomFactor);
},
Cesium.ScreenSpaceEventType.MOUSE_MOVE
);

@tanpopo and @joben welcome to the community! @joben thank you for the suggestion - seems to work on my end.

It works! Thank you very much!

1 Like