Skip to content

Commit

Permalink
fixes for map card, re: #4670
Browse files Browse the repository at this point in the history
  • Loading branch information
robgaston committed Jun 27, 2019
1 parent 48c1ae1 commit ffd5457
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions arches/app/media/js/views/components/cards/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ define([
}
};

this.updateLayers = function(layers) {
var map = self.map();
var style = map.getStyle();
style.layers = layers.concat(self.draw.options.styles);
map.setStyle(style);
};

this.draw = null;
this.map.subscribe(function(map) {
self.draw = new MapboxDraw({
Expand Down
13 changes: 8 additions & 5 deletions arches/app/media/js/views/components/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,13 @@ define([
}
};

this.updateLayers = function(layers) {
var map = self.map();
var style = map.getStyle();
style.layers = layers;
map.setStyle(style);
};

this.setupMap = function(map) {
map.addControl(new mapboxgl.NavigationControl(), 'top-left');
map.addControl(new MapboxGeocoder({
Expand All @@ -163,11 +170,7 @@ define([
bbox: bounds
}), 'top-right');

layers.subscribe(function(layers) {
var style = map.getStyle();
style.layers = layers;
map.setStyle(style);
});
layers.subscribe(self.updateLayers);

self.map(map);
};
Expand Down
2 changes: 1 addition & 1 deletion arches/app/templates/views/components/map-editor.htm
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ <h5 data-bind="text: card.model.instructions"></h5>
</div>
</div>
<!-- /ko -->
<!-- ko if: !self.form.nodeLookup[widget.node_id()].datatype() === 'geojson-feature-collection' -->
<!-- ko if: self.form.nodeLookup[widget.node_id()].datatype() !== 'geojson-feature-collection' -->
<div data-bind='component: {
name: self.form.widgetLookup[widget.widget_id()].name,
params: {
Expand Down

0 comments on commit ffd5457

Please sign in to comment.