[Users] Popup Window Anchor
Dan Ramage
dan at inlet.geol.sc.edu
Thu Nov 12 18:36:30 CET 2009
Greetings GeoExters, I am working on a restricted extents map and because of
this, I've had to modify the behavior of the GeoExt.Popup(). The current
popup always tries to position itself above the clicked on feature, and this
will work if it is allowed to scroll the map. However with my map, it can't
do this, so it is possible that part of the popup will basically go through
the top of the screen or off the right side, or even through the bottom.
I've coded up a new position function that correctly positions the popup so
this doesn't happen. I am currently working on moving the anchor image as
well, and have it correctly moving to the right side of the popup if the
popup must be shifted left. What I am scratching my head on is if I need to
position the popup under the feature, I need the anchor on top of the popup.
Now, I've got a rotated anchor image(topanchor.png) and I've add a new style
into the popup.css. I've also overloaded the base onRender and initComponent
functions from the GeoExt.Popup() to add the new anchor. When the popup gets
loaded now, I've got the normal downward pointing anchor as well as the
upward pointed anchor. The upward pointing anchor is positioned under the
downward pointing anchor. This is causing the code to calculate the height
of the popup to be off as well:
var anc = this.anc;
var dx = anc.getLeft(true) + anc.getWidth() / 2;
var dy = this.el.getHeight();
dy is taking into account the height of the new topanchor.png.
I am not sure how to initially position the upward pointing anchor to be on
top of the popup. My thought is the entry in the popup.css file is what I
need to change, but I am not 100% sure. The current entry I have is:
.gx-popup-anctop{
background:transparent url(../images/default/topanchor.png) no-repeat 0 0;
position:relative;
top:-1px;
left:5px;
z-index:2;
height:16px;
width:31px;}
In the code, I will determine which anchor needs to be displayed and remove
the other one.
I appreciate any pointers!
Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.geoext.org/pipermail/users/attachments/20091112/36d027b6/attachment.htm
More information about the Users
mailing list