Map / resolve view constraints when resized/view changed
This makes the `resolveConstraints` view method public but not part of the api.
This commit is contained in:
@@ -964,6 +964,10 @@ class PluggableMap extends BaseObject {
|
|||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
handleSizeChanged_() {
|
handleSizeChanged_() {
|
||||||
|
if (this.getView()) {
|
||||||
|
this.getView().resolveConstraints(0);
|
||||||
|
}
|
||||||
|
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1051,6 +1055,8 @@ class PluggableMap extends BaseObject {
|
|||||||
this.viewChangeListenerKey_ = listen(
|
this.viewChangeListenerKey_ = listen(
|
||||||
view, EventType.CHANGE,
|
view, EventType.CHANGE,
|
||||||
this.handleViewPropertyChanged_, this);
|
this.handleViewPropertyChanged_, this);
|
||||||
|
|
||||||
|
view.resolveConstraints(0);
|
||||||
}
|
}
|
||||||
this.render();
|
this.render();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ class View extends BaseObject {
|
|||||||
} else if (options.zoom !== undefined) {
|
} else if (options.zoom !== undefined) {
|
||||||
this.setZoom(options.zoom);
|
this.setZoom(options.zoom);
|
||||||
}
|
}
|
||||||
this.resolveConstraints_(0);
|
this.resolveConstraints(0);
|
||||||
|
|
||||||
this.setProperties(properties);
|
this.setProperties(properties);
|
||||||
|
|
||||||
@@ -644,7 +644,7 @@ class View extends BaseObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this.getAnimating()) {
|
if (!this.getAnimating()) {
|
||||||
setTimeout(this.resolveConstraints_.bind(this), 0);
|
setTimeout(this.resolveConstraints.bind(this), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1284,9 +1284,8 @@ class View extends BaseObject {
|
|||||||
* @param {number=} opt_duration The animation duration in ms.
|
* @param {number=} opt_duration The animation duration in ms.
|
||||||
* @param {number=} opt_resolutionDirection Which direction to zoom.
|
* @param {number=} opt_resolutionDirection Which direction to zoom.
|
||||||
* @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
|
* @param {import("./coordinate.js").Coordinate=} opt_anchor The origin of the transformation.
|
||||||
* @private
|
|
||||||
*/
|
*/
|
||||||
resolveConstraints_(opt_duration, opt_resolutionDirection, opt_anchor) {
|
resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor) {
|
||||||
const duration = opt_duration !== undefined ? opt_duration : 200;
|
const duration = opt_duration !== undefined ? opt_duration : 200;
|
||||||
const direction = opt_resolutionDirection || 0;
|
const direction = opt_resolutionDirection || 0;
|
||||||
|
|
||||||
@@ -1342,7 +1341,7 @@ class View extends BaseObject {
|
|||||||
endInteraction(opt_duration, opt_resolutionDirection, opt_anchor) {
|
endInteraction(opt_duration, opt_resolutionDirection, opt_anchor) {
|
||||||
this.setHint(ViewHint.INTERACTING, -1);
|
this.setHint(ViewHint.INTERACTING, -1);
|
||||||
|
|
||||||
this.resolveConstraints_(opt_duration, opt_resolutionDirection, opt_anchor);
|
this.resolveConstraints(opt_duration, opt_resolutionDirection, opt_anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user