Improving behaviour of popups

before-bootstrap
Candid Dauth 2014-12-31 03:24:47 +01:00
rodzic 639b637835
commit 91f26bb774
5 zmienionych plików z 32 dodań i 15 usunięć

Wyświetl plik

@ -240,7 +240,7 @@ textarea {
}
.fp-popup-bottom {
margin-top: 50px;
margin-top: 51px;
}
.fp-popup-bottom:before {

Wyświetl plik

@ -75,7 +75,7 @@
}
},
"click" : function(obj) {
obj.fpOnClick(map.xyToPos(map.featureHandler.up));
obj.fpOnClick(map.xyToPos(map.featureHandler.up), map.featureHandler.evt);
}
}, { map: map.map });
map.featureHandler.activate();
@ -167,8 +167,8 @@
};
var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(marker.lon, marker.lat).transform(fpUtils.proj(), map.map.getProjectionObject()), null, style);
feature.fpMarker = marker;
feature.fpOnClick = function() {
map.mapEvents.$emit("clickMarker", marker);
feature.fpOnClick = function(pos, evt) {
map.mapEvents.$emit("clickMarker", marker, evt);
};
map.layerLines.addFeatures([ feature ]);
map.markersById[marker.id] = feature;
@ -206,8 +206,8 @@
var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(points).transform(fpUtils.proj(), map.map.getProjectionObject()), null, style);
feature.fpLine = line;
feature.fpOnClick = function(clickPos) {
map.mapEvents.$emit("clickLine", line, clickPos);
feature.fpOnClick = function(clickPos, evt) {
map.mapEvents.$emit("clickLine", line, clickPos, evt);
};
map.layerLines.addFeatures([ feature ]);
map.linesById[line.id] = feature;
@ -367,11 +367,6 @@
fpMapLegend(map);
fpMapSearch(map);
map.mapEvents.$on("clickLine", function(e, line, clickPos) {
map.popups.closeAll();
map.linesUi.viewLine(line, clickPos);
});
map.socket.$on("loadStart", function() {
map.loadStart();
});

Wyświetl plik

@ -150,6 +150,25 @@
});
}
};
map.mapEvents.$on("clickLine", function(e, line, clickPos, evt) {
var one = false;
map.popups.getOpenPopups().forEach(function(popup) {
if(popup.template == "view-line.html" && popup.scope.line.id == line.id) {
popup.close();
if(popup.pos.lon == clickPos.lon && popup.pos.lat == clickPos.lat)
one = true;
}
});
if(one)
return;
if(!evt.ctrlKey && !evt.shiftKey)
map.popups.closeAll();
map.linesUi.viewLine(line, clickPos);
});
return ret;
};
} ]);

Wyświetl plik

@ -106,10 +106,10 @@
}
};
map.mapEvents.$on("clickMarker", function(e, marker) {
map.mapEvents.$on("clickMarker", function(e, marker, evt) {
var one = false;
map.popups.getOpenPopups().forEach(function(popup) {
if(popup.scope.marker.id == marker.id) {
if(popup.template == "view-marker.html" && popup.scope.marker.id == marker.id) {
popup.close();
one = true;
}
@ -117,7 +117,9 @@
if(one)
return;
map.popups.closeAll();
if(!evt.ctrlKey && !evt.shiftKey)
map.popups.closeAll();
ret.viewMarker(marker);
});

Wyświetl plik

@ -33,7 +33,8 @@
this.pos = pos;
_updatePosition();
},
scope: scope
scope: scope,
template: template
};
$('<a href="javascript:" class="close-button">×</a>').click(ret.close.bind(ret)).appendTo(el);