Skip to content

Commit

Permalink
Rollback tileGrid initialization
Browse files Browse the repository at this point in the history
fix #239
  • Loading branch information
ghettovoice committed Oct 8, 2019
1 parent a9f206a commit 45f84d6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
15 changes: 3 additions & 12 deletions src/component/wmts-source/source.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,29 +84,20 @@
tileLoadFunction: this.tileLoadFunction,
})
},
/**
* @return {Promise}
* @protected
*/
init () {
createTileGrid () {
let extent = createExtentFromProjection(this.projection)
let resolutions = this.resolutions ? this.resolutions : resolutionsFromExtent(extent, this.maxZoom, this.tileSize)
let origin = this.origin ? this.origin : getExtentCorner(extent, EXTENT_CORNER.TOP_LEFT)
let matrixIds = Array.from(range(this.minZoom, resolutions.length))
/**
* @type {module:ol/Tile~UrlFunction}
* @protected
*/
this._tileGrid = new WMTSTileGrid({
return new WMTSTileGrid({
extent,
origin,
resolutions,
tileSize: this.tileSize,
minZoom: this.minZoom,
matrixIds,
})
return this::tileSource.methods.init()
},
},
watch: {
Expand Down
17 changes: 11 additions & 6 deletions src/mixin/tile-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,14 @@ export default {
},
},
methods: {
createTileGrid () {
return createXyzGrid({
extent: createExtentFromProjection(this.projection),
maxZoom: this.maxZoom,
minZoom: this.minZoom,
tileSize: this.tileSize,
})
},
/**
* @return {Promise}
* @protected
Expand All @@ -110,12 +118,7 @@ export default {
* @type {module:ol/Tile~UrlFunction}
* @protected
*/
this._tileGrid = createXyzGrid({
extent: createExtentFromProjection(this.projection),
maxZoom: this.maxZoom,
minZoom: this.minZoom,
tileSize: this.tileSize,
})
this._tileGrid = this.createTileGrid()

return this::source.methods.init()
},
Expand All @@ -124,6 +127,8 @@ export default {
* @protected
*/
deinit () {
this._tileGrid = undefined

return this::source.methods.deinit()
},
/**
Expand Down

0 comments on commit 45f84d6

Please sign in to comment.