[OpenLayers-Users] Popup in Openlayers (How to fix the popup?)

Kwong Hu Kiu kwonghu at hotmail.com
Fri Jul 17 03:31:35 EDT 2009



Anyone has any ideas about the source code i attached ?

I want to fix it as i have spent quite some time on it.

Thanks.

From: kwonghu at hotmail.com
To: adube at mapgears.com; users at openlayers.org
Date: Fri, 17 Jul 2009 01:49:45 +0800
Subject: Re: [OpenLayers-Users] Popup in Openlayers (How to fix the popup?)









Hi,
 I don't have a live example. I tried to make an example(Attached). 
I removed most of the code so probably some stuff might not work.

The popup code is exactly the same. 

Thanks


> Date: Thu, 16 Jul 2009 10:53:35 -0400
> From: adube at mapgears.com
> To: kwonghu at hotmail.com
> CC: users at openlayers.org
> Subject: Re: [OpenLayers-Users] Popup in Openlayers (How to fix the popup?)
> 
> Do you have a live example of this behavior ?  If not, try making a 
> small example demonstrating your issue and share it.  It would be easier 
> to help.
> 
> Regards,
> 
> Alexandre
> 
> Kwong Hu Kiu wrote:
> >
> > Yes, the moveend is triggered on every pan but it's not moving the popup.
> >
> > The popup.moveto is always being called.
> >
> > Any idea ?
> >
> > > Date: Thu, 16 Jul 2009 09:45:34 -0400
> > > From: adube at mapgears.com
> > > To: kwonghu at hotmail.com
> > > CC: users at openlayers.org
> > > Subject: Re: [OpenLayers-Users] Popup in Openlayers (How to fix the 
> > popup?)
> > >
> > > Hi,
> > >
> > > Could you share more of your code, please ? How do you register you
> > > event for instance ? The 'moveend' event should be triggered on 
> > every pan.
> > >
> > > Regards,
> > >
> > > Alexandre
> > >
> > > Kwong Hu Kiu wrote:
> > > >
> > > >
> > > > I have tried that.
> > > >
> > > > Something like
> > > >
> > > > if (popup != null)
> > > > {
> > > >
> > > > var widthPixel = map.getSize().w - 280;
> > > > var heightPixel = map.getSize().h - 300;
> > > > popup.moveTo(new OpenLayers.Pixel(widthPixel,
> > > > heightPixel));
> > > > }
> > > >
> > > > But the popup does not want to move when i pan.
> > > > It only move if i zoom in/out.
> > > > I have debug'ed this and "pop.moveTo" is being called whenever i pan.
> > > >
> > > > Not really sure if this is a bug.
> > > >
> > > > I just want a simple popup that always appear on the lower right 
> > corner
> > > > so user can interact with the map.
> > > >
> > > > Regards.
> > > >
> > > >
> > > > > Date: Thu, 16 Jul 2009 08:18:27 -0400
> > > > > From: adube at mapgears.com
> > > > > To: kwonghu at hotmail.com
> > > > > CC: users at openlayers.org
> > > > > Subject: Re: [OpenLayers-Users] Popup in Openlayers (How to fix the
> > > > popup?)
> > > > >
> > > > > Hi,
> > > > >
> > > > > You could register a map 'moveend' event to move the popup again to
> > > > > the original location. You would need to recalculate the position on
> > > > > each move.
> > > > >
> > > > > Regards,
> > > > >
> > > > > Alexandre
> > > > >
> > > > > Kwong Hu Kiu wrote:
> > > > > > Hi,
> > > > > >
> > > > > > I am trying to use the openlayers popup in the map as below.
> > > > > >
> > > > > > if (this.popup == null)
> > > > > > {
> > > > > > this.popup = new OpenLayers.Popup();
> > > > > > this.popup.setBorder("2px solid");
> > > > > > this.popup.setSize(new OpenLayers.Size(270, 270));
> > > > > > this.popup.setContentHTML(popupContentHTML);
> > > > > > this.popup.setOpacity(0.65);
> > > > > > this.popup.addCloseBox();
> > > > > > map.addPopup(this.popup);
> > > > > > this.popup.show();
> > > > > > }
> > > > > > else
> > > > > > {
> > > > > > this.popup.setContentHTML(popupContentHTML);
> > > > > > this.popup.toggle();
> > > > > > }
> > > > > >
> > > > > >
> > > > > > How do i get it to display in one position (like the lower left
> > > > > > portion of the screen) ? and always appear there whenever you 
> > pan/zoom
> > > > > >
> > > > > > I figured that i can use popup.moveTo as below.
> > > > > >
> > > > > > var widthPixel = map.getSize().w - 280;
> > > > > > var heightPixel = map.getSize().h - 300;
> > > > > > this.popup.moveTo(new OpenLayers.Pixel(widthPixel, heightPixel));
> > > > > >
> > > > > > But the popup will move out of that location whenever you pan. 
> > It's
> > > > > > alright when you zoom in/out(always at the lower left) but not 
> > pan.
> > > > > >
> > > > > > Please help. Simple problem taking me a while to resolve.
> > > > > >
> > > > > > Cheers.
> > > > > >
> > > > > >
> > > > > >
> > > > 
> > ------------------------------------------------------------------------
> > > > > >
> > > > > > _______________________________________________
> > > > > > Users mailing list
> > > > > > Users at openlayers.org
> > > > > > http://openlayers.org/mailman/listinfo/users
> > > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Alexandre Dubé
> > > > > Mapgears
> > > > > www.mapgears.com
> > > > >
> > >
> > >
> > > --
> > > Alexandre Dubé
> > > Mapgears
> > > www.mapgears.com
> > >
> 
> 
> -- 
> Alexandre Dubé
> Mapgears
> www.mapgears.com
> 



--Forwarded Message Attachment--





    ENC Charts
    
    

    
    



    
    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090717/1450e5d9/attachment.html


More information about the Users mailing list