[OpenLayers-Trac] Re: [OpenLayers] #3168: FramedCloudPopup has offset

OpenLayers trac-20090302 at openlayers.org
Sat Mar 26 11:30:26 EDT 2011


#3168: FramedCloudPopup has offset
-----------------------+----------------------------------------------------
 Reporter:  pebXX2346  |       Owner:  euzuro      
     Type:  bug        |      Status:  new         
 Priority:  minor      |   Milestone:  2.11 Release
Component:  Popup      |     Version:  2.10        
 Keywords:  position   |       State:              
-----------------------+----------------------------------------------------

Comment(by pebXX2346):

 Replying to [comment:4 pebXX2346]:

 >  1 as noted the popup flickers/flashes if it is on top (only in 'hover
 mode')

 >  2 it is nearly perfectly aligned at lonlat, but looks a bit strange
 > if the popup is on top since the cloud embraces the marker (see attached
 image)

 A solution (just brainstorming and throw-away code):[[BR]]

 '''Alignment (Nr. 2 above)'''

 Add a style to the Popup: {{{ALIGN_AT_LONLAT=true}}} then the popup
 will not stay away from the area that maybe used by the marker.

 In {{{Popup.Anchored.calculateNewPx()}}}:
 {{{
 if (this.ALIGN_AT_LONLAT){
    newPx.y += top? -this.anchor.offset.y:0;
    newPx.x += (left? -1:1)*this.anchor.offset.x;
    }
 }}}

 so the user may choose what is best for his usecase.

 Nope: better rewrite that function to not look at the marker/anchor
 at all if this style is set (no add later subtract something), just
 use the lanLot orientated pixel position.

 '''The flicker (Nr. 1 above)'''[[BR]]
 If the style in Nr.2 is set then:
 In user code (he knows if he want's to use hover effects or not)
 e.g. in mouseout handling check for something like:
 {{{
 var pop = getThePopUpFromSomewhere();
 if( isEventInPopup(pop, event)) return;
 pop.hide();
 }}}

-- 
Ticket URL: <http://trac.openlayers.org/ticket/3168#comment:6>
OpenLayers <http://openlayers.org/>
A free AJAX map viewer


More information about the Trac mailing list