Renamed 'MapView' to 'MapViewport'. Added documentation to the maps module.
This commit is contained in:
+32
-25
@@ -93,10 +93,18 @@ export class GeoMap {
|
||||
}
|
||||
|
||||
flushHandlers() {
|
||||
// this.onLoaded
|
||||
this.onLoad.empty()
|
||||
this.onTransform.empty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Locks all transformations on the map.
|
||||
* Single parameters can be set if necessary. False means the value is locked, true means they can be modified.
|
||||
*
|
||||
* @public
|
||||
* @param {object} [{ rotatable = false, translatable = false, movableX = false, movableY = false, scalable = false }={}]
|
||||
* @memberof GeoMap
|
||||
*/
|
||||
lock({ rotatable = false, translatable = false, movableX = false, movableY = false, scalable = false } = {}) {
|
||||
if (this.image && this.image.scatter) {
|
||||
this.image.scatter.translatable = rotatable
|
||||
@@ -105,30 +113,26 @@ export class GeoMap {
|
||||
this.image.scatter.rotatable = movableY
|
||||
this.image.scatter.scalable = scalable
|
||||
}
|
||||
|
||||
// Issue #001: This causes the map to not be displayed at the correct position on
|
||||
// map change.
|
||||
// // Rotation does not yet work with the cover mechanism.
|
||||
// //this.rotatable = false
|
||||
// this.translatable = false
|
||||
// this.scalable = false
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlocks all transformations on the map.
|
||||
* Single parameters can be set if necessary. False means the value is locked, true means they can be modified.
|
||||
*
|
||||
* @public
|
||||
* @param {object} [{ rotatable = false, translatable = false, movableX = false, movableY = false, scalable = false }={}]
|
||||
* @memberof GeoMap
|
||||
*/
|
||||
unlock({ rotatable = true, translatable = true, movableX = true, movableY = true, scalable = true } = {}) {
|
||||
if (this.image && this.image.scatter) {
|
||||
this.image.scatter.translatable = translatable
|
||||
this.image.scatter.movableX = movableX
|
||||
this.image.scatter.movableY = movableY
|
||||
this.image.scatter.rotatable = rotatable
|
||||
this.image.scatter.scalable = scalable
|
||||
}
|
||||
// Issue #001
|
||||
// // Rotation does not yet work with the cover mechanism.
|
||||
// //this.rotatable = true
|
||||
// this.translatable = true
|
||||
// this.scalable = true
|
||||
this.lock({ rotatable, translatable, movableX, movableY, scalable })
|
||||
}
|
||||
|
||||
/**
|
||||
* Unloads the image of the map.
|
||||
*
|
||||
* @public
|
||||
* @memberof GeoMap
|
||||
*/
|
||||
unload() {
|
||||
if (this.image) {
|
||||
if (this.image.parent) {
|
||||
@@ -142,6 +146,12 @@ export class GeoMap {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the map, freeing all memory ba flushing handlers and removing the image.
|
||||
*
|
||||
* @public
|
||||
* @memberof GeoMap
|
||||
*/
|
||||
remove() {
|
||||
if (this.image) this.image.mask = null
|
||||
|
||||
@@ -175,8 +185,6 @@ export class GeoMap {
|
||||
this.image = image
|
||||
if (frame) this.setFrame(frame)
|
||||
|
||||
let boundaries = this.mapdata.getBoundaries()
|
||||
|
||||
let scatterOpts = Object.assign({
|
||||
cover: this.cover,
|
||||
scaleable: this.scaleable,
|
||||
@@ -186,7 +194,6 @@ export class GeoMap {
|
||||
startScale: this.startScale,
|
||||
minScale: this.minScale,
|
||||
maxScale: this.maxScale,
|
||||
boundaries,
|
||||
onTransform: this.transformed.bind(this)
|
||||
})
|
||||
|
||||
@@ -242,7 +249,7 @@ export class GeoMap {
|
||||
* to a coordinate with latitude and longitude.
|
||||
*
|
||||
*
|
||||
* @param {object} point - Point in form of {x: x_val, y: y_val}.
|
||||
* @param {object} point - Point in form of {x, y}.
|
||||
* @returns {object} - Coordinates on the map in form of {x: latitude, y: longitude}.
|
||||
*/
|
||||
coordinatesFromPoint(point) {
|
||||
@@ -254,7 +261,7 @@ export class GeoMap {
|
||||
* Transform coordinates in the map into pixel positions on the deep zoom image.
|
||||
*
|
||||
* @param {object} coords - Coordinates of a map position in form {x: latitude, y: longitude}.
|
||||
* @return - Returns a image position in form of {x: x_val, y: y_val}.
|
||||
* @return {Point} - Returns a image position in form of {x: x, y: y}.
|
||||
*/
|
||||
coordinatesToPoint(coordinates) {
|
||||
return this.toAbsolutePixelCoordinates(this.mapdata.toPixel(coordinates))
|
||||
|
||||
Reference in New Issue
Block a user