Infrastructure Map Server General Discussion

Infrastructure Map Server General Discussion

Reply
Contributor
mistermike
Posts: 14
Registered: ‎10-18-2007
Message 1 of 10 (1,628 Views)

Using Wheel Button to Pan

1628 Views, 9 Replies
11-13-2007 11:06 AM
How would I go about making it so that clicking the middle/wheel button on the mouse will enable the pan tool while the button is held down. (Like in AutoCAD, Map3D etc.)

Thanks,

-Mike
Distinguished Contributor
jumpinjackie
Posts: 105
Registered: ‎05-21-2006
Message 2 of 10 (1,628 Views)

Re: Using Wheel Button to Pan

11-14-2007 03:16 PM in reply to: mistermike
Look for the OnMouseDown(e) and OnMouseUp(e) functions in ajaxmappane.templ

That's where all the action starts and ends.

- Jackie
http://themapguyde.blogspot.com
http://au.linkedin.com/in/jackieng
Contributor
mistermike
Posts: 14
Registered: ‎10-18-2007
Message 3 of 10 (1,627 Views)

Re: Using Wheel Button to Pan

11-15-2007 08:16 AM in reply to: mistermike
Thanks for the reply.
I found the OnMouseDown(e) and OnMouseUp(e) functions in ajaxmappane.templ, I'm just not sure what to do with them. :smileyhappy: I'm still kind of new at this.

My Autodesk reseller is telling me it can't be done in the AJAX viewer (which is what I'm using, forgot to mention that). Does she know what she's talking about?

Thanks again,

-Mike
Distinguished Contributor
jumpinjackie
Posts: 105
Registered: ‎05-21-2006
Message 4 of 10 (1,627 Views)

Re: Using Wheel Button to Pan

11-18-2007 05:08 PM in reply to: mistermike
I can't see why it could not be done.

You are basically reusing the pan behaviour which is already implemented in the AJAX viewer, you just now have to hook that behaviour to a middle mouse click and release.

Unfortuantely, I cannot show you how to implement it, because I haven't done it myself, but I do have a high-level knowledge of the internals of the AJAX viewer to tell you that such a thing is possible.

Also, resellers usually aren't programmers and/or technically minded ;-)
http://themapguyde.blogspot.com
http://au.linkedin.com/in/jackieng
*James Murphy
Message 5 of 10 (1,627 Views)

Re: Using Wheel Button to Pan

11-19-2007 01:04 PM in reply to: mistermike
wrote in ...



Jackie, you are starting to sound like Andrew D.
: )

We are trying.

--

Murph
The world is not FLAT so why is your GIS data?
http://map3d.wordpress.com
Active Member
nclayton
Posts: 6
Registered: ‎06-19-2003
Message 6 of 10 (1,627 Views)

Re: Using Wheel Button to Pan

04-17-2008 07:51 AM in reply to: mistermike
in the mousedown event, you have to check to see if it's the middle mouse button (these are different values for IE and FF...just google and you'll find this easy enough) then call the start pan function and on the mouseup, call the end pan function.
Member
david.roy
Posts: 5
Registered: ‎08-04-2008
Message 7 of 10 (1,485 Views)

Re: Using Wheel Button to Pan

10-01-2012 09:23 PM in reply to: mistermike

Hi all.  Was wondering if anyone had done this change successfully?  I'd really love to enable panning with mouse wheel.

 

many thanks

Valued Contributor
mitchellhastings1484
Posts: 68
Registered: ‎12-18-2003
Message 8 of 10 (1,202 Views)

Re: Using Wheel Button to Pan

12-03-2012 11:20 AM in reply to: david.roy

Would also like to know the solution

 

thanks,

New Member
RyanNorthcott1122
Posts: 2
Registered: ‎03-20-2013
Message 9 of 10 (774 Views)

Re: Using Wheel Button to Pan

03-20-2013 09:00 AM in reply to: mitchellhastings1484

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.

 

 

Member
david.roy
Posts: 5
Registered: ‎08-04-2008
Message 10 of 10 (763 Views)

Re: Using Wheel Button to Pan

03-20-2013 08:44 PM in reply to: mistermike

Perfect!  does the trick, thankyou for posting.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.