Pan to centre on click
See original GitHub issueI need to pan the clicked object to the center every time. It works when I set the _viewer.viewport.goHome(true);
before re pan / Zoom but when I remove it does not bring the object to the center of the screen. Please let me know where I’m wrong. Thanx
export function setTransformationLevel(scaleLevel, x, y) {
_viewer.viewport.goHome(true);
let point = snapDragon.getMousePosition({ pageX: x, pageY: y });
let vp = _viewer.viewport.pointFromPixel(point, true);
let vpX = vp.x;
let vpY = vp.y;
if (x <= 146 || x >= 1275 || y < 47 || y>624.9793700777778) {
_viewer.viewport.zoomTo(scaleLevel, new snapDragon.Point(vpX, vpY), false);
return true;
}else{
_viewer.viewport.panTo({ x:vpX, y:vpY});
_viewer.viewport.zoomTo(scaleLevel,null, false);
}
return true;
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (6 by maintainers)
Top Results From Across the Web
Google Map Pan to center when clicking a link - Stack Overflow
Objective: When a user click on a link, Google Map will pan to the center of the location. Current: User click on Marker,...
Read more >Middle mouse button or wheel does not perform PAN ...
In the Windows control panel, double-click the Mouse icon to open the Mouse Properties dialog window. Click the Buttons tab. In the Wheel...
Read more >Configuring mouse centre scroll click to pan drawing
Ive got a Logitech LS1 laser mouse which is a standard mouse with a scroll wheel which is clickable. On some machines ive...
Read more >Zoom and pan in a diagram - Microsoft Support
Right-click and drag to pan the diagram. Pan and zoom by using the scroll wheel. Do either of the following: To scroll up...
Read more >Set track pan positions in GarageBand on Mac - Apple Support
In GarageBand on Mac, set the pan or balance position of each track in a project to place ... Option-click the Pan knob...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sure, here’s an example using fitBounds:
https://codepen.io/iangilman/pen/poeqovO
@iangilman Sir, Thank you so much. Things are working as expected now. It would never have happened without your guidance.