[OpenLayers-Dev] NavToolbar control

jonz jonathan.zaid at mediolanum.it
Fri Sep 14 09:45:22 EDT 2007


Yes, I had seen the navtoolbar example and the behaviour is as I would like. 
Unfortunately, and I couldn't figure out why, that's not exactly what
happens with my map.

click on dragZoom
click again on dragZoom
Zooms in one level

I  debugged it, and caught the "mouseup" event coming from drag.js was
causing the zoom. This same type of thing does NOT occur with navtoolbar
example.


To answer your question briefly, yes, I am doing something different (in the
implementation) than you are, and surely that is the source of the problems.

I created the toolbar by hand myself. I've been commissioned to "use" a
toolbar which is made with a series of div's and images, and so instead of
using the toolbar from OpenLayers, I just threw the toolbar into the map div
and added links to the controls. so.. I have something like this as far as
html goes.
  
<div id="map" style="width:400; height:400">
  <div style="position: absolute; top: 5px; left: 5px; z-index: 10001;">
    <div style="position: absolute; top: 0px; left: 0px;">
       <div style="position: absolute; top: 0px; left: 65px;">
              <nobr> dragON.jpg </nobr>


dragZoomChange is:

function dragZoomChange(img)
  {
  var name = img.src.replace(/.*\//,'').replace(/.jpg/,'');
  var newsrc = img.src.replace(/(.*\/)(.*$)/,'$1');
  if (name == 'dragON')
    {
    control_ZoomBox.activate();
    map.events.registerPriority("mouseup", this, this.mouseup);
    newsrc = newsrc + "drag.jpg";
   }
  else
   {
    control_ZoomBox.deactivate();
    map.events.unregister("mouseup", this, this.mouseup);
    newsrc = newsrc + "dragON.jpg";
   }
 img.src = newsrc;
}


P.S: Thanks so much for being so active in the forum.

Jon



Christopher Schmidt-4 wrote:
> 
> On Fri, Sep 14, 2007 at 05:05:25AM -0700, jonz wrote:
>> 
>> Hi Christopher,
>> 
>> I was running into the same sort of thing, and basically it's sort of
>> impossibile to deactivate the zoombox without causing a zoom seeing as
>> the
>> mouseup goes thru to the map.. 
> 
> So, I look at: 
> 
> http://openlayers.org/dev/examples/navtoolbar.html
> 
> I click the second tool, to activate it. No Zoom.
> 
> I click the tool again. No zoom. 
> 
> I drag a box around spain. Zoom.
> 
> I drag a box such that my mouse is over the navcontrol, and let go.
> Zoom.
> 
> This is the behavior I expect.
> 
> It sounds like you're doing something differently than I am: I'm not
> sure what it is. If the behavior described above is not what you get,
> then we have a different problem we should discuss -- but if the above
> is the behavior you get, then the only thing to discuss is why it isn't
> what you want :)
> 
> Regards,
> -- 
> Christopher Schmidt
> MetaCarta
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
> 
> 

-- 
View this message in context: http://www.nabble.com/NavToolbar-control-tf3796903.html#a12675692
Sent from the OpenLayers Dev mailing list archive at Nabble.com.




More information about the Dev mailing list