-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CDE-736] - NewMapComponent - As a user, I want the popups to close when I click outside of them #670
base: master
Are you sure you want to change the base?
[CDE-736] - NewMapComponent - As a user, I want the popups to close when I click outside of them #670
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,14 +103,25 @@ define([ | |
div.style.height = this.height_ + "px"; | ||
}; | ||
|
||
|
||
OurMapOverlay.prototype.onRemove = function() { | ||
|
||
if (this.popupContentDiv_) { | ||
$(this.div_).detach(); | ||
this.div_.style.display = "none"; | ||
this.div_ = null; | ||
} | ||
|
||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove dead code |
||
if (this.popupContentDiv_) { | ||
$("#" + this.popupContentDiv_).append($(this.div_)); | ||
$(this.div_).detach(); | ||
} | ||
this.div_.style.display = "none"; | ||
this.div_.parentNode.removeChild(this.div_); | ||
this.div_ = null; | ||
*/ | ||
|
||
}; | ||
|
||
}); | ||
|
@@ -217,6 +228,21 @@ define([ | |
this.map.data.overrideStyle(feature, style); | ||
}, | ||
|
||
closePopups: function(){ | ||
this._popups = this._popups || []; | ||
_.each(this._popups, function(p) { | ||
p.close(); | ||
}); | ||
}, | ||
|
||
closePopups0: function() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this method is not used, send it to code heaven |
||
this._popups = this._popups || []; | ||
_.each(this._popups, function(p) { | ||
p.setMap(null); | ||
p = null; | ||
}); | ||
}, | ||
|
||
renderMap: function(target) { | ||
var mapOptions = { | ||
mapTypeId: google.maps.MapTypeId.ROADMAP, | ||
|
@@ -387,6 +413,7 @@ define([ | |
}; | ||
}, | ||
|
||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove dead code |
||
_addControlClick: function() { | ||
var me = this; | ||
this.map.data.addListener("click", function(e) { | ||
|
@@ -395,6 +422,7 @@ define([ | |
me.trigger("engine:selection:complete"); | ||
}); | ||
}, | ||
*/ | ||
|
||
_addLimitZoomLimits: function() { | ||
var minZoom = _.isFinite(this.options.viewport.zoomLevel.min) ? this.options.viewport.zoomLevel.min : 0; | ||
|
@@ -422,6 +450,9 @@ define([ | |
}, | ||
|
||
setPanningMode: function() { | ||
|
||
var me = this; | ||
|
||
this._removeListeners(); | ||
this._updateMode("pan"); | ||
this._updateDrag(false); | ||
|
@@ -431,6 +462,24 @@ define([ | |
draggable: true | ||
}); | ||
|
||
var listeners = this.controls.listenersHandle; | ||
listeners.clickOnData = this.map.data.addListener("click", | ||
this._createClickHandler(function(me, event) { | ||
//console.log('Click on feature!'); | ||
var modelItem = event.feature.getProperty("model"); | ||
var featureType = modelItem.getFeatureType(); | ||
me.trigger(featureType + ":click", me.wrapEvent(event)); | ||
}) | ||
); | ||
|
||
listeners.clickOnMap = google.maps.event.addListener(this.map, "click", | ||
this._createClickHandler(function(me, event) { | ||
me.closePopups(); | ||
}) | ||
); | ||
|
||
|
||
/* | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove dead code |
||
return; | ||
var listeners = this.controls.listenersHandle; | ||
listeners.clickOnData = this.map.data.addListener("click", | ||
|
@@ -450,6 +499,7 @@ define([ | |
me.trigger("engine:selection:complete"); | ||
}) | ||
); | ||
*/ | ||
|
||
}, | ||
|
||
|
@@ -738,10 +788,16 @@ define([ | |
} | ||
|
||
var popup = new OurMapOverlay(feature.getGeometry().get(), popupWidth, popupHeight, contents, popupContentDiv, this.map, borderColor); | ||
|
||
/* | ||
this._popups = this._popups || []; | ||
_.each(this._popups, function(p) { | ||
p.setMap(null); | ||
}); | ||
*/ | ||
|
||
this.closePopups(); | ||
|
||
this._popups.push(popup); | ||
}, | ||
|
||
|
@@ -751,10 +807,16 @@ define([ | |
position: feature.getGeometry().get(), | ||
maxWidth: popupWidth | ||
}); | ||
|
||
/* | ||
this._popups = this._popups || []; | ||
_.each(this._popups, function(p) { | ||
p.close(); | ||
}); | ||
*/ | ||
|
||
this.closePopups(); | ||
|
||
popup.open(this.map); | ||
this._popups.push(popup); | ||
}, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace with _.some