Hello,
Is there anyway to disable click-and-drag and use the TrackZoom action instead? That is to say, instead of holding the shift key, whenever the user click-and-drags, it creats a box, and zooms in when released. Thanks in advance!
-Dustin
Hello,
Is there anyway to disable click-and-drag and use the TrackZoom action instead? That is to say, instead of holding the shift key, whenever the user click-and-drags, it creats a box, and zooms in when released. Thanks in advance!
-Dustin
Dustin,
Sorry that we misunderstood your meanings yesterday, and you can define the custom behavior for TrackZoom using the javascript as following in the page:
var OnMapCreated = function(map) {
var control = map.getControlsByClass("OpenLayers.Control.Navigation")[0];
// Below line is for defining the key code, which has to be pressed when track zoom in on the screen.
// There are four values that can be set:
// OpenLayers.Handler.MOD_NONE If set as the keyMask, use any key is down.
// OpenLayers.Handler.MOD_SHIFT If set as the keyMask, use Shift is down.
// OpenLayers.Handler.MOD_CTRL If set as the keyMask, use Ctrl is down.
// OpenLayers.Handler.MOD_ALT If set as the keyMask, use Alt is down.
control.zoomBoxKeyMask = OpenLayers.Handler.NONE;
control.handleRightClicks = false;
control.draw();
}
Please refer the comments for details, and one thing should be noted is that you should set the handleRightClicks to true if you use “MOD_CTRL”
Thanks,
Johnny,
Hi Johnny,
It seems I cannot get the code you provided to do anything at all. I've tried both setting control.zoomBoxKeyMask to 'OpenLayers.Handler.NONE' and OpenLayers.Handler.MOD_NONE'. I have also tried to use the alternate version of referencing the map <%=Map1.ClientID%>.GetMapParser().map, since I've had issues with that before. The map is on a content page of a master page, if that helps at all. Any suggestions?
-Dustin
Dustin,
The master page doesn't affect the client script, please check out the attached demo for details.
Thanks,
Johnny
1706-Disable_TackZoom.zip (3.41 KB)
Hi Johnny,
That’s really odd, setting up a new project, I can use your code just fine, but cannot in my existing project. Has this feature been recently added, or has it been 6+ months? Also after searching a bit, I can’t seem to find the bit of code to check my own version, might you be able to provide me with that? I’ve had issues referencing the .dlls of new versions of MapSuite in the past (Because of Visual Studio, not your software), so I’m wondering if maybe there is an odd link or something that I can fiddle around with… Thanks for your help so far!
-DL
Dustin,
We don’t add this feature in our products; the code supplied for you is just a workaround for you temporary. If you want to know the version of the WebEdition product, the static property Version of Map is just what you want.
If you still have problems about that please let me know.
Thanks,
Khalil
Hi,
I updated to the newest version, and still had the same issue, but for some arbitrary reason it’s working fine now. Thank you for the help!
-Dustin
Dustin,
You are always so welcome, if you still have any questions on that please let me know.
Thanks,
Khalil
Alright, the trackzoom portion has been working fine from the OnLoad, but I’m wondering if there’s a way to dynamically switch from the normal drag cursor to track zoom? I’m having a very hard time grasping the client side actions of OpenLayers and the way it works with MapSuite.
-Dustin
Dustin,
If you want to switch between normal drag and track zoom. You need to deactivate or activate the track zoom control. The attachment is the sample code for you.
Thanks,
Khalil
1818-TrackZoomApplication.zip (9.25 KB)
Khalil, I could hug you. Thanks so much!
Hi, Dustin
Glad to see that you have solved your problem, please feel free to ask more questions.
Thanks,
Khalil