Permalink
Browse files

When synchronizing with another popup will force also pos of marter.

Otherwise, having opened two popups was confusing: so to move the
map and zoom the two popups could exchange their relative positions.
  • Loading branch information...
1 parent ec45f59 commit 1885257d4a3820c3c91474de3bd4ea6a0f1809eb @jorix committed Dec 16, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/FeaturePopups.js
View
@@ -1503,19 +1503,25 @@ OpenLayers.Control.FeaturePopups.Popup = OpenLayers.Class({
popup.closeDiv.style.zIndex = 1;
}
if (_relatedPopup) {
- var _prevRelativePosition = popup.relativePosition;
+ var _prevCalcRelativePosition = popup.calculateRelativePosition,
+ _relpopRelPosition = (_relatedPopup.relativePosition || 'tr');
var syncRelativePosition = function(px) {
if (!_relatedPopup.id) {
// if related is dretroyed
- _prevRelativePosition.call(popup, px);
+ _prevCalcRelativePosition.call(popup, px);
}
- var relPos = _relatedPopup.relativePosition || 'tr';
+ var relPos = _relpopRelPosition || 'tr';
if (_relatedAxis === 'h') {
return relPos[0] + ((relPos[1] === 'l') ? 'r' : 'l');
} else {
return ((relPos[0] === 'b') ? 't' : 'b') + relPos[1];
}
};
+ if (_relatedPopup.calculateRelativePosition) {
+ _relatedPopup.calculateRelativePosition = function () {
+ return _relpopRelPosition;
+ };
+ }
if (popup.calculateRelativePosition) {
popup.calculateRelativePosition = syncRelativePosition;
} else {

0 comments on commit 1885257

Please sign in to comment.