Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new param "easyPan" #290

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* @param {String} params.backgroundColor Background color of the map in CSS format.
* @param {Boolean} params.zoomOnScroll When set to true map could be zoomed using mouse scroll. Default value is <code>true</code>.
* @param {Boolean} params.panOnDrag When set to true, the map pans when being dragged. Default value is <code>true</code>.
* @param {Boolean} params.easyPan When set to true, the map can pan freely out of container. Default value is <code>false</code>.
* @param {Number} params.zoomMax Indicates the maximum zoom ratio which could be reached zooming the map. Default value is <code>8</code>.
* @param {Number} params.zoomMin Indicates the minimum zoom ratio which could be reached zooming the map. Default value is <code>1</code>.
* @param {Number} params.zoomStep Indicates the multiplier used to zoom map with +/- buttons. Default value is <code>1.6</code>.
Expand Down Expand Up @@ -271,14 +272,14 @@ jvm.Map.prototype = {
}

if (this.transY > maxTransY) {
this.transY = maxTransY;
if (!this.params.easyPan) this.transY = maxTransY;
} else if (this.transY < minTransY) {
this.transY = minTransY;
if (!this.params.easyPan) this.transY = minTransY;
}
if (this.transX > maxTransX) {
this.transX = maxTransX;
if (!this.params.easyPan) this.transX = maxTransX;
} else if (this.transX < minTransX) {
this.transX = minTransX;
if (!this.params.easyPan) this.transX = minTransX;
}

this.canvas.applyTransformParams(this.scale, this.transX, this.transY);
Expand Down