Scenario: User is drawing a polygon using hybrid mode, has kept left click down to draw freehand then releases the left click, ready for next vertex click but wants to pan the map before doing so.
At this point mid draw, the user needs to be able to right click, keep right button down, and move mouse around (drag) to pan the map then continue to freehand draw or point click, is this possible?
Example hybrid mode drawing here > https://codepen.io/Paul-Stanway/pen/xbKpExL
Can someone provide updates to the above codepen to achieve this pan mid draw using right click hold.
I found an example using non hybrid vertex drawing below link, using left click hold to pan but left click cannot be achieved with hybrid as left click hold draws multiple vertex as mouse is moved so need to use right click hold somehow. > https://codepen.io/U_B_U/pen/oNVGzqX?editors=1000
Hi @PaulStanway1 , is there a reason the arrow keys on the keyboard cannot be used for panning the map mid-drawing? Does it need to be a right click?
Hi, thanks for the reply, yes the mouse and right click need to be used not the keyboard arrow keys
Sorry @PaulStanway1 I'm not really sure how to do this either at least without tying to figure it out myself. Hopefully someone else more familiar with the sketch view model can help.
This isn't perfect, but does mostly work.
https://codepen.io/odoe/pen/jENpyGy?editors=0010
let handle;
view.on("pointer-down", (e) => {
// right-click
if (e.native.which === 3) {
// drag
handle = view.on(
"pointer-move",
debounce((event) => {
const mp = view.toMap(event);
view.goTo(mp);
// mouse up from drag
let handle2 = view.on("pointer-up", () => {
handle.remove();
handle2.remove();
});
})
);
}
});