Keep two digits for the opacity value in layer state

This commit is contained in:
Frederic Junod
2019-01-22 12:47:34 +01:00
parent ab04df8f9d
commit af8a22d34d
3 changed files with 4 additions and 4 deletions

View File

@@ -91,7 +91,7 @@ class BaseLayer extends BaseObject {
layer: this,
managed: true
});
state.opacity = clamp(this.getOpacity(), 0, 1);
state.opacity = clamp(Math.round(this.getOpacity() * 100) / 100, 0, 1);
state.sourceState = this.getSourceState();
state.visible = this.getVisible();
state.extent = this.getExtent();

View File

@@ -35,7 +35,7 @@ import SourceState from '../source/State.js';
/**
* @typedef {Object} State
* @property {import("./Base.js").default} layer
* @property {number} opacity
* @property {number} opacity Opacity, the value is rounded to two digits to appear after the decimal point.
* @property {SourceState} sourceState
* @property {boolean} visible
* @property {boolean} managed