Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: lincolnloop/django-geotagging-new
base: 46493da464
...
head fork: lincolnloop/django-geotagging-new
compare: 06c560792d
Checking mergeability… Don't worry, you can still create the pull request.
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Showing with 33 additions and 4 deletions.
  1. +33 −4 geotagging/static/js/app/Spot.js
View
37 geotagging/static/js/app/Spot.js
@@ -34,7 +34,7 @@ $$.SpotView = Backbone.View.extend({
events: {},
initialize: function (options) {
- _.bindAll(this, 'render');
+ _.bindAll(this, 'render', 'markerClick');
this.model.view = this;
if (this.model.attributes.style.externalGraphic) {
var w = this.model.attributes.style.graphicWidth ? this.model.attributes.style.graphicWidth : 21;
@@ -51,12 +51,41 @@ $$.SpotView = Backbone.View.extend({
},
render: function () {
- this.marker = new OpenLayers.Marker(
- this.model.getLatLng(),
- this.getIcon().clone());
+ //
+ // feature is used to create a marker or a popup
+ //
+ this.feature = new OpenLayers.Feature(this.model.layer.toOpenLayers(), this.model.getLatLng());
+
+ // popup attributes
+ this.feature.closeBox = true;
+ this.feature.popupClass = OpenLayers.Class(OpenLayers.Popup.Anchored, {
+ 'autoSize': true
+ });
+ this.feature.data.popupContentHTML = '<h2>test</h2><p>Hello World!</p>';
+ this.feature.data.overflow = "auto";
+ // create the marker
+ this.marker = this.feature.createMarker();
this.model.layer.toOpenLayers().addMarker(this.marker);
+
+ this.marker.events.register("mousedown", this.feature, this.markerClick);
+
return this;
+ },
+
+ markerClick: function (event) {
+ log('Spot:markerClick');
+
+ log(this.model.layer.get('map'));
+
+ if (this.popup == null) {
+ this.popup = this.feature.createPopup();
+ this.model.layer.get('map').addPopup(this.popup);
+ this.popup.show();
+ } else {
+ this.popup.toggle();
+ }
+ OpenLayers.Event.stop(event);
}
});

No commit comments for this range

Something went wrong with that request. Please try again.