Skip to content

Commit d82992e

Browse files
Merge pull request #386 from SylvainCorlay/after-attach
Trigger after-attach phosphor event in WidgetControl
2 parents cec43c8 + 1bd8878 commit d82992e

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

js/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/src/controls/WidgetControl.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ var L = require('../leaflet.js');
44
var control = require('./Control.js');
55
var LeafletControlView = control.LeafletControlView;
66
var LeafletControlModel = control.LeafletControlModel;
7+
var PMessaging = require('@phosphor/messaging');
8+
var PWidgets = require('@phosphor/widgets');
79

810
L.Control.WidgetControl = L.Control.extend({
911
updateLayout: function(options) {
@@ -14,12 +16,15 @@ L.Control.WidgetControl = L.Control.extend({
1416
});
1517
},
1618

17-
getContent: function(){
19+
getContent: function() {
1820
return this._content;
1921
},
2022

21-
setContent: function(content){
22-
if (!this._map) { return; }
23+
setContent: function(content) {
24+
if (!this._map)
25+
{
26+
return;
27+
}
2328

2429
this._content = content;
2530
this._container.appendChild(this._content);
@@ -80,6 +85,7 @@ var LeafletWidgetControlView = LeafletControlView.extend({
8085
this.widget_view.displayed.then(() => {
8186
this.updateLayout();
8287
this.obj.setContent(view.el);
88+
PMessaging.MessageLoop.sendMessage(view.pWidget, PWidgets.Widget.Msg.AfterAttach);
8389
});
8490
});
8591
})

js/src/layers/LayerGroup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var LeafletLayerGroupModel = LeafletLayerModel.extend({
1414
}, {
1515
serializers: _.extend({
1616
layers: { deserialize: widgets.unpack_models }
17-
}, widgets.DOMWidgetModel.serializers)
17+
}, widgets.WidgetModel.serializers)
1818
});
1919

2020
var LeafletLayerGroupView = LeafletLayerView.extend({

js/src/layers/MarkerCluster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var LeafletMarkerClusterModel = LeafletLayerModel.extend({
1414
}, {
1515
serializers: _.extend({
1616
markers: { deserialize: widgets.unpack_models }
17-
}, widgets.DOMWidgetModel.serializers)
17+
}, widgets.WidgetModel.serializers)
1818
});
1919

2020
var LeafletMarkerClusterView = layer.LeafletLayerView.extend({

0 commit comments

Comments
 (0)