Hi all. Was wondering if anyone had done this change successfully? I'd really love to enable panning with mouse wheel.
many thanks
Hello,
Firstly, Thanks Jackie for telling everyone where to look, this was pretty easy, and I'm not great at Javascript
I tackled this, and here is what I've got working...
Looks like the placement is everything to make sure you check for middle before left/ right
In ajamappane.templ....
in OnMouseDown(e) before the check for Left Button Click, check for Middle Mouse
function OnMouseDown(e) { if(!PopupMouseDown(e)) { hidePopup(tbMenu); hidePopup(ctxMenu); hidePopup(infoMenu); parent.ForwardMouseDown(document, e); } else return false; if(!mapInit) return false; // NEW CODE BLOCK START HERE if(e.which && e.which == 2) //2 is middle button in W3C/Netscape Which StartPanning(e); else if(e.button && e.button == 4) //for ie, middle button is 4 StartPanning(e); // END CODE BLOCK HERE FOR MIDDLE Mouse PANNING if(e.which && e.which != 1) return true; else if(e.button && e.button != 1)//for ie return true;
Then in OnMouseUp(e)
function OnMouseUp(e) { var x = e.clientX - mapPosX; var y = e.clientY; try { e.stopPropagation(); } catch(ex) { e.cancelBubble = true; }
// NEW CODE ADDED HERE, BEFORE DIGITIZATION CHECK
if(e.which && e.which == 2) //2 is middle button EndPanning(e); else if(e.button && e.button == 4)//for ie EndPanning(e); // END NEW CODE
if(digitizing) { digitizer.MouseUp(e, x, y); return false; } if(isAlertShow) return;
I didn't test it out with other redlining or digitizing continuous commands.. ie pan will digitizing, but for my needs, just panning with the middle button adds a tonne of user experience if other things break.