Skip to content

Commit 6cf6453

Browse files
committed
Make Raster layer work
1 parent 34a108d commit 6cf6453

File tree

4 files changed

+16
-18
lines changed

4 files changed

+16
-18
lines changed

src/components/UI/Marker.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export default {
5656
if (this.initial) return;
5757
this.marker.setLngLat(lngLat);
5858
},
59-
draggable(next, prev) {
59+
draggable(next) {
6060
if (this.initial) return;
6161
this.marker.setDraggable(next);
6262
}

src/components/layer/RasterLayer.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default {
2323
},
2424
tileSize: {
2525
type: Number,
26-
defaul: 512
26+
default: 512
2727
},
2828
bounds: {
2929
type: Array,
@@ -45,12 +45,15 @@ export default {
4545
let source = {
4646
type: "raster",
4747
url: this.url,
48-
minzoom: this.tilesMinZoom,
49-
maxzoom: this.tilesMaxZoom,
50-
tileSize: this.tileSize,
51-
bounds: this.bounds
48+
tileSize: this.tileSize
5249
};
5350

51+
if (!this.url) {
52+
source.minzoom = this.tilesMinZoom;
53+
source.maxzoom = this.tilesMaxZoom;
54+
source.bounds = this.bounds;
55+
}
56+
5457
if (this.tiles) source.tiles = this.tiles;
5558
if (this.scheme) source.scheme = this.scheme;
5659
if (this.attribution) source.attribution = this.attribution;
@@ -88,19 +91,12 @@ export default {
8891
}
8992
let layer = {
9093
id: this.layerId,
94+
type: "raster",
9195
source: this.sourceId
9296
};
93-
if (this.refLayer) {
94-
layer.ref = this.refLayer;
95-
} else {
96-
layer.type = "raster";
97-
layer.source = this.sourceId;
98-
layer["source-layer"] = this["source-layer"];
99-
if (this.minzoom) layer.minzoom = this.minzoom;
100-
if (this.maxzoom) layer.maxzoom = this.maxzoom;
101-
if (this.layout) {
102-
layer.layout = this.layout;
103-
}
97+
layer.source = this.sourceId;
98+
if (this.layout) {
99+
layer.layout = this.layout;
104100
}
105101
layer.paint = this.paint ? this.paint : { "raster-opacity": 1 };
106102
layer.metadata = this.metadata;

src/components/map/mixins/withPrivateMethods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
export default {
22
methods: {
33
$_updateSyncedPropsFabric(prop, data) {
4-
return event => {
4+
return () => {
55
this.propsIsUpdating[prop] = true;
66
let info = typeof data === "function" ? data() : data;
77
return this.$emit(`update:${prop}`, info);

src/main.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import ImageLayer from "./components/layer/ImageLayer";
1313
import CanvasLayer from "./components/layer/CanvasLayer";
1414
import VideoLayer from "./components/layer/VideoLayer";
1515
import VectorLayer from "./components/layer/VectorLayer";
16+
import RasterLayer from "./components/layer/RasterLayer";
1617

1718
import controlMixin from "./components/UI/controls/controlMixin";
1819
import withRegistration from "./lib/withRegistration";
@@ -33,6 +34,7 @@ export const MglImageLayer = ImageLayer;
3334
export const MglCanvasLayer = CanvasLayer;
3435
export const MglVideoLayer = VideoLayer;
3536
export const MglVectorLayer = VectorLayer;
37+
export const MglRasterLayer = RasterLayer;
3638

3739
export const MglMarker = Marker;
3840
export const MglPopup = Popup;

0 commit comments

Comments
 (0)