Merge pull request #10413 from MoonE/zoomsliderextent
Limit the ZoomSlider's range to the view's constrained resolution.
This commit is contained in:
+5
-5
@@ -957,7 +957,7 @@ class View extends BaseObject {
|
|||||||
*/
|
*/
|
||||||
getResolutionForValueFunction(opt_power) {
|
getResolutionForValueFunction(opt_power) {
|
||||||
const power = opt_power || 2;
|
const power = opt_power || 2;
|
||||||
const maxResolution = this.maxResolution_;
|
const maxResolution = this.getConstrainedResolution(this.maxResolution_);
|
||||||
const minResolution = this.minResolution_;
|
const minResolution = this.minResolution_;
|
||||||
const max = Math.log(maxResolution / minResolution) / Math.log(power);
|
const max = Math.log(maxResolution / minResolution) / Math.log(power);
|
||||||
return (
|
return (
|
||||||
@@ -988,17 +988,17 @@ class View extends BaseObject {
|
|||||||
* @return {function(number): number} Value for resolution function.
|
* @return {function(number): number} Value for resolution function.
|
||||||
*/
|
*/
|
||||||
getValueForResolutionFunction(opt_power) {
|
getValueForResolutionFunction(opt_power) {
|
||||||
const power = opt_power || 2;
|
const logPower = Math.log(opt_power || 2);
|
||||||
const maxResolution = this.maxResolution_;
|
const maxResolution = this.getConstrainedResolution(this.maxResolution_);
|
||||||
const minResolution = this.minResolution_;
|
const minResolution = this.minResolution_;
|
||||||
const max = Math.log(maxResolution / minResolution) / Math.log(power);
|
const max = Math.log(maxResolution / minResolution) / logPower;
|
||||||
return (
|
return (
|
||||||
/**
|
/**
|
||||||
* @param {number} resolution Resolution.
|
* @param {number} resolution Resolution.
|
||||||
* @return {number} Value.
|
* @return {number} Value.
|
||||||
*/
|
*/
|
||||||
function(resolution) {
|
function(resolution) {
|
||||||
const value = (Math.log(maxResolution / resolution) / Math.log(power)) / max;
|
const value = (Math.log(maxResolution / resolution) / logPower) / max;
|
||||||
return value;
|
return value;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user