1 | import { __extends } from "tslib";
|
2 | import { isNumber } from '@antv/util';
|
3 | import Base from '../base';
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | var Identity = (function (_super) {
|
10 | __extends(Identity, _super);
|
11 | function Identity() {
|
12 | var _this = _super !== null && _super.apply(this, arguments) || this;
|
13 | _this.type = 'identity';
|
14 | _this.isIdentity = true;
|
15 | return _this;
|
16 | }
|
17 | Identity.prototype.calculateTicks = function () {
|
18 | return this.values;
|
19 | };
|
20 | Identity.prototype.scale = function (value) {
|
21 |
|
22 | if (this.values[0] !== value && isNumber(value)) {
|
23 | return value;
|
24 | }
|
25 | return this.range[0];
|
26 | };
|
27 | Identity.prototype.invert = function (value) {
|
28 | var range = this.range;
|
29 | if (value < range[0] || value > range[1]) {
|
30 | return NaN;
|
31 | }
|
32 | return this.values[0];
|
33 | };
|
34 | return Identity;
|
35 | }(Base));
|
36 | export default Identity;
|
37 |
|
\ | No newline at end of file |