<br><blockquote style="margin: 1.5em 0pt;"></blockquote><br><br><div class="gmail_quote">On Thu, Feb 19, 2009 at 06:35, Perry Cox <span dir="ltr">&lt;<a href="mailto:cleolas@googlemail.com">cleolas@googlemail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br><div class="gmail_quote"><div class="Ih2E3d">Hello,<br><br>My Problem: I&#39;m adding several popups (FramedCloud) to my map, i.e. that multiple popups shall be open at same time. But the popups overlapp very often, though there would be enough free space if the popup would have been drawn in another direction (e.g. &quot;top-right&quot; instead of &quot;bottom-left&quot;).<br>


<br>Now the questions:<br><br>- Is there a method for optimizing the &quot;drawing-direction&quot; of several popups in relation to each other? <br></div></div></blockquote><div><br>Hi Perry, <br><br>this function does not exist right now, but it sounds like it might be a handy bit of code to have around in the library (i.e. a nice contribution!)<br>
<br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote"><div class="Ih2E3d"><br></div>- Is there a method for influencing the &quot;drawing-direction&quot; of a FramedCloud-Popup. My assumption is, that a FramedCloud is drawn relative to the AnchorPosition on the map: If it&#39;s anchor is in the top-left quadrant of the actual view, then the FramedCloud will open to bottom-right. Is that correct? May I influence this behaviour?<br>


</div></blockquote><div><br>There is indeed. The entry point you are looking for is a function called<br><br>calculateRelativePosition()<br><br>It is first defined in Popup.Anchored:<br><br>&nbsp;&nbsp;&nbsp; /** <br>&nbsp;&nbsp;&nbsp;&nbsp; * Method: calculateRelativePosition<br>
&nbsp;&nbsp;&nbsp;&nbsp; * <br>&nbsp;&nbsp;&nbsp;&nbsp; * Parameters:<br>&nbsp;&nbsp;&nbsp;&nbsp; * px - {&lt;OpenLayers.Pixel&gt;}<br>&nbsp;&nbsp;&nbsp;&nbsp; * <br>&nbsp;&nbsp;&nbsp;&nbsp; * Returns:<br>&nbsp;&nbsp;&nbsp;&nbsp; * {String} The relative position (&quot;br&quot; &quot;tr&quot; &quot;tl&quot; &quot;bl&quot;) at which the popup<br>
&nbsp;&nbsp;&nbsp;&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp; should be placed.<br>&nbsp;&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; calculateRelativePosition:function(px) {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var lonlat = this.map.getLonLatFromLayerPx(px);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var extent = this.map.getExtent();<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var quadrant = extent.determineQuadrant(lonlat);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return OpenLayers.Bounds.oppositeQuadrant(quadrant);<br>&nbsp;&nbsp;&nbsp; }, <br><br><br><br>As you can see, it finds the popup&#39;s lonlat, determines in which of the four quadrants of the map it lies,<br>and then returns the &quot;opposite quadrant&quot;. The return is a string (&quot;br&quot; &quot;tr&quot; &quot;tl&quot; &quot;bl&quot;) indicating the direction<br>
relative to the anchor in which to draw the popup. <br><br>What you would want to do in your patch is to modify that function so that the calculation of the <br>returned relative position is based on the positions of the other popus, not merely the opposite quadrant.<br>
<br>Sounds like a fun programming challenge.... good luck!<br>Erik<br><br>&nbsp;</div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div class="gmail_quote">
<br><br>Thanks, perry</div>
<br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@openlayers.org">Users@openlayers.org</a><br>
<a href="http://openlayers.org/mailman/listinfo/users" target="_blank">http://openlayers.org/mailman/listinfo/users</a><br>
<br></blockquote></div><br>