@antv/g 5.0.23-alpha.2 → 5.0.23-alpha.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,8 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CSSUnitValue = exports.CSSNumericValue = exports.CSSMathVariadic = exports.CSSMathValue = exports.CSSMathSum = exports.CSSMathProduct = exports.CSSMathNegate = exports.CSSMathMin = exports.CSSMathMax = exports.CSSMathInvert = void 0;
6
+ exports.Opx = exports.Odeg = exports.CSSUnitValue = exports.CSSNumericValueType = exports.CSSNumericValue = exports.CSSMathVariadic = exports.CSSMathValue = exports.CSSMathSum = exports.CSSMathProduct = exports.CSSMathNegate = exports.CSSMathMin = exports.CSSMathMax = exports.CSSMathInvert = exports.BaseType = void 0;
7
+ exports.baseTypeToString = baseTypeToString;
7
8
  exports.typeCheck = typeCheck;
9
+ exports.unitTypeToBaseType = unitTypeToBaseType;
8
10
 
9
11
  var _tslib = require("tslib");
10
12
 
@@ -12,12 +14,270 @@ var _utils = require("../../utils");
12
14
 
13
15
  var _CSSMathOperator = require("./CSSMathOperator");
14
16
 
15
- var _CSSNumericValueType = require("./CSSNumericValueType");
16
-
17
17
  var _CSSStyleValue = require("./CSSStyleValue");
18
18
 
19
19
  var _types = require("./types");
20
20
 
21
+ // https://drafts.css-houdini.org/css-typed-om/#enumdef-cssnumericbasetype
22
+ var BaseType;
23
+ exports.BaseType = BaseType;
24
+
25
+ (function (BaseType) {
26
+ BaseType[BaseType["kLength"] = 0] = "kLength";
27
+ BaseType[BaseType["kAngle"] = 1] = "kAngle";
28
+ BaseType[BaseType["kTime"] = 2] = "kTime";
29
+ BaseType[BaseType["kFrequency"] = 3] = "kFrequency";
30
+ BaseType[BaseType["kResolution"] = 4] = "kResolution";
31
+ BaseType[BaseType["kFlex"] = 5] = "kFlex";
32
+ BaseType[BaseType["kPercent"] = 6] = "kPercent";
33
+ BaseType[BaseType["kNumBaseTypes"] = 7] = "kNumBaseTypes";
34
+ })(BaseType || (exports.BaseType = BaseType = {}));
35
+
36
+ function unitTypeToBaseType(unit) {
37
+ (0, _utils.DCHECK_NE)(unit, _types.UnitType.kNumber);
38
+
39
+ switch (unit) {
40
+ case _types.UnitType.kEms:
41
+ case _types.UnitType.kExs:
42
+ case _types.UnitType.kPixels:
43
+ case _types.UnitType.kCentimeters:
44
+ case _types.UnitType.kMillimeters:
45
+ case _types.UnitType.kQuarterMillimeters:
46
+ case _types.UnitType.kInches:
47
+ case _types.UnitType.kPoints:
48
+ case _types.UnitType.kPicas:
49
+ case _types.UnitType.kUserUnits:
50
+ case _types.UnitType.kViewportWidth:
51
+ case _types.UnitType.kViewportHeight:
52
+ case _types.UnitType.kViewportInlineSize:
53
+ case _types.UnitType.kViewportBlockSize:
54
+ case _types.UnitType.kViewportMin:
55
+ case _types.UnitType.kViewportMax:
56
+ case _types.UnitType.kSmallViewportWidth:
57
+ case _types.UnitType.kSmallViewportHeight:
58
+ case _types.UnitType.kSmallViewportInlineSize:
59
+ case _types.UnitType.kSmallViewportBlockSize:
60
+ case _types.UnitType.kSmallViewportMin:
61
+ case _types.UnitType.kSmallViewportMax:
62
+ case _types.UnitType.kLargeViewportWidth:
63
+ case _types.UnitType.kLargeViewportHeight:
64
+ case _types.UnitType.kLargeViewportInlineSize:
65
+ case _types.UnitType.kLargeViewportBlockSize:
66
+ case _types.UnitType.kLargeViewportMin:
67
+ case _types.UnitType.kLargeViewportMax:
68
+ case _types.UnitType.kDynamicViewportWidth:
69
+ case _types.UnitType.kDynamicViewportHeight:
70
+ case _types.UnitType.kDynamicViewportInlineSize:
71
+ case _types.UnitType.kDynamicViewportBlockSize:
72
+ case _types.UnitType.kDynamicViewportMin:
73
+ case _types.UnitType.kDynamicViewportMax:
74
+ case _types.UnitType.kContainerWidth:
75
+ case _types.UnitType.kContainerHeight:
76
+ case _types.UnitType.kContainerInlineSize:
77
+ case _types.UnitType.kContainerBlockSize:
78
+ case _types.UnitType.kContainerMin:
79
+ case _types.UnitType.kContainerMax:
80
+ case _types.UnitType.kRems:
81
+ case _types.UnitType.kChs:
82
+ return BaseType.kLength;
83
+
84
+ case _types.UnitType.kMilliseconds:
85
+ case _types.UnitType.kSeconds:
86
+ return BaseType.kTime;
87
+
88
+ case _types.UnitType.kDegrees:
89
+ case _types.UnitType.kRadians:
90
+ case _types.UnitType.kGradians:
91
+ case _types.UnitType.kTurns:
92
+ return BaseType.kAngle;
93
+
94
+ case _types.UnitType.kHertz:
95
+ case _types.UnitType.kKilohertz:
96
+ return BaseType.kFrequency;
97
+
98
+ case _types.UnitType.kDotsPerPixel:
99
+ case _types.UnitType.kDotsPerInch:
100
+ case _types.UnitType.kDotsPerCentimeter:
101
+ return BaseType.kResolution;
102
+
103
+ case _types.UnitType.kFraction:
104
+ return BaseType.kFlex;
105
+
106
+ case _types.UnitType.kPercentage:
107
+ return BaseType.kPercent;
108
+
109
+ default:
110
+ return BaseType.kLength;
111
+ }
112
+ }
113
+
114
+ function baseTypeToString(baseType) {
115
+ switch (baseType) {
116
+ case BaseType.kLength:
117
+ return 'length';
118
+
119
+ case BaseType.kAngle:
120
+ return 'angle';
121
+
122
+ case BaseType.kTime:
123
+ return 'time';
124
+
125
+ case BaseType.kFrequency:
126
+ return 'frequency';
127
+
128
+ case BaseType.kResolution:
129
+ return 'resolution';
130
+
131
+ case BaseType.kFlex:
132
+ return 'flex';
133
+
134
+ case BaseType.kPercent:
135
+ return 'percent';
136
+
137
+ default:
138
+ break;
139
+ }
140
+
141
+ return '';
142
+ }
143
+
144
+ var CSSNumericValueType =
145
+ /** @class */
146
+ function () {
147
+ function CSSNumericValueType(unit, exponent) {
148
+ if (unit === void 0) {
149
+ unit = _types.UnitType.kNumber;
150
+ }
151
+
152
+ if (exponent === void 0) {
153
+ exponent = 1;
154
+ }
155
+
156
+ this.exponents = [];
157
+ this.numNonZeroEntries = 0;
158
+ this.percentHint = BaseType.kPercent;
159
+ this.hasPercentHint = false;
160
+ this.exponents = new Array(BaseType.kNumBaseTypes).fill(0);
161
+
162
+ if (unit !== _types.UnitType.kNumber) {
163
+ this.setExponent(unitTypeToBaseType(unit), exponent);
164
+ }
165
+ }
166
+
167
+ CSSNumericValueType.prototype.applyPercentHint = function (hint) {
168
+ (0, _utils.DCHECK_NE)(hint, BaseType.kPercent);
169
+ this.setExponent(hint, this.exponent(hint) + this.exponent(BaseType.kPercent));
170
+ this.setExponent(BaseType.kPercent, 0);
171
+ this.percentHint = hint;
172
+ this.hasPercentHint = true;
173
+ };
174
+
175
+ CSSNumericValueType.prototype.hasNonZeroEntries = function () {
176
+ return this.numNonZeroEntries > 0;
177
+ };
178
+
179
+ CSSNumericValueType.prototype.isOnlyNonZeroEntry = function (baseType, value) {
180
+ (0, _utils.DCHECK_NE)(value, 0);
181
+ return this.numNonZeroEntries === 1 && this.exponent(baseType) === value;
182
+ };
183
+
184
+ CSSNumericValueType.prototype.exponent = function (type) {
185
+ return this.exponents[type];
186
+ };
187
+
188
+ CSSNumericValueType.prototype.setExponent = function (type, newValue) {
189
+ var oldValue = this.exponents[type];
190
+
191
+ if (oldValue == 0 && newValue !== 0) {
192
+ this.numNonZeroEntries++;
193
+ } else if (oldValue !== 0 && newValue == 0) {
194
+ this.numNonZeroEntries--;
195
+ }
196
+
197
+ this.exponents[type] = newValue;
198
+ };
199
+
200
+ CSSNumericValueType.negateExponents = function (type) {
201
+ type.exponents.forEach(function (v) {
202
+ return v *= -1;
203
+ });
204
+ return type;
205
+ };
206
+
207
+ CSSNumericValueType.prototype.matchesBaseType = function (baseType) {
208
+ (0, _utils.DCHECK_NE)(baseType, BaseType.kPercent);
209
+ return this.isOnlyNonZeroEntry(baseType, 1) && !this.hasPercentHint;
210
+ };
211
+
212
+ CSSNumericValueType.prototype.matchesPercentage = function () {
213
+ return this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
214
+ };
215
+
216
+ CSSNumericValueType.prototype.matchesBaseTypePercentage = function (baseType) {
217
+ (0, _utils.DCHECK_NE)(baseType, BaseType.kPercent);
218
+ return this.isOnlyNonZeroEntry(baseType, 1) || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
219
+ };
220
+
221
+ CSSNumericValueType.prototype.matchesNumber = function () {
222
+ return !this.hasNonZeroEntries() && !this.hasPercentHint;
223
+ };
224
+
225
+ CSSNumericValueType.prototype.matchesNumberPercentage = function () {
226
+ return !this.hasNonZeroEntries() || this.isOnlyNonZeroEntry(BaseType.kPercent, 1);
227
+ };
228
+
229
+ CSSNumericValueType.add = function (type1, type2, error) {
230
+ if (type1.hasPercentHint && type2.hasPercentHint && type1.percentHint != type2.percentHint) {
231
+ error = true;
232
+ return type1;
233
+ }
234
+
235
+ if (type1.hasPercentHint) type2.applyPercentHint(type1.percentHint);else if (type2.hasPercentHint) type1.applyPercentHint(type2.percentHint);
236
+ (0, _utils.DCHECK_EQ)(type1.percentHint, type2.percentHint); // Match up base types. Try to use the percent hint to match up any
237
+ // differences.
238
+
239
+ for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
240
+ var base_type = i;
241
+
242
+ if (type1.exponents[i] !== type2.exponents[i]) {
243
+ if (base_type !== BaseType.kPercent) {
244
+ type1.applyPercentHint(base_type);
245
+ type2.applyPercentHint(base_type);
246
+ }
247
+
248
+ if (type1.exponents[i] !== type2.exponents[i]) {
249
+ error = true;
250
+ return type1;
251
+ }
252
+ }
253
+ }
254
+
255
+ error = false;
256
+ return type1;
257
+ };
258
+
259
+ CSSNumericValueType.multiply = function (type1, type2, error) {
260
+ if (type1.hasPercentHint && type2.hasPercentHint && type1.percentHint != type2.percentHint) {
261
+ error = true;
262
+ return type1;
263
+ }
264
+
265
+ if (type1.hasPercentHint) type2.applyPercentHint(type1.percentHint);else if (type2.hasPercentHint) type1.applyPercentHint(type2.percentHint);
266
+
267
+ for (var i = 0; i < BaseType.kNumBaseTypes; ++i) {
268
+ var base_type = i;
269
+ type1.setExponent(base_type, type1.exponent(base_type) + type2.exponent(base_type));
270
+ }
271
+
272
+ error = false;
273
+ return type1;
274
+ };
275
+
276
+ return CSSNumericValueType;
277
+ }();
278
+
279
+ exports.CSSNumericValueType = CSSNumericValueType;
280
+
21
281
  /**
22
282
  * CSSNumericValue is the base class for numeric and length typed CSS Values.
23
283
  * @see https://drafts.css-houdini.org/css-typed-om/#numeric-objects
@@ -377,50 +637,50 @@ function (_super) {
377
637
  percent: 0,
378
638
  percentHint: 'length'
379
639
  };
380
- var exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kLength);
640
+ var exponent = this.type_.exponent(BaseType.kLength);
381
641
 
382
642
  if (exponent) {
383
643
  type.length = exponent;
384
644
  }
385
645
 
386
- exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kAngle);
646
+ exponent = this.type_.exponent(BaseType.kAngle);
387
647
 
388
648
  if (exponent) {
389
649
  type.angle = exponent;
390
650
  }
391
651
 
392
- exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kTime);
652
+ exponent = this.type_.exponent(BaseType.kTime);
393
653
 
394
654
  if (exponent) {
395
655
  type.time = exponent;
396
656
  }
397
657
 
398
- exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kFrequency);
658
+ exponent = this.type_.exponent(BaseType.kFrequency);
399
659
 
400
660
  if (exponent) {
401
661
  type.frequency = exponent;
402
662
  }
403
663
 
404
- exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kResolution);
664
+ exponent = this.type_.exponent(BaseType.kResolution);
405
665
 
406
666
  if (exponent) {
407
667
  type.resolution = exponent;
408
668
  }
409
669
 
410
- exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kFlex);
670
+ exponent = this.type_.exponent(BaseType.kFlex);
411
671
 
412
672
  if (exponent) {
413
673
  type.flex = exponent;
414
674
  }
415
675
 
416
- exponent = this.type_.exponent(_CSSNumericValueType.BaseType.kPercent);
676
+ exponent = this.type_.exponent(BaseType.kPercent);
417
677
 
418
678
  if (exponent) {
419
679
  type.percent = exponent;
420
680
  }
421
681
 
422
682
  if (this.type_.hasPercentHint) {
423
- type.percentHint = (0, _CSSNumericValueType.baseTypeToString)(this.type_.percentHint);
683
+ type.percentHint = baseTypeToString(this.type_.percentHint);
424
684
  }
425
685
 
426
686
  return type;
@@ -541,7 +801,7 @@ function (_super) {
541
801
  }
542
802
 
543
803
  (0, _utils.DCHECK)(CSSUnitValue.isValidUnit(unit));
544
- _this = _super.call(this, new _CSSNumericValueType.CSSNumericValueType(unit)) || this;
804
+ _this = _super.call(this, new CSSNumericValueType(unit)) || this;
545
805
  _this.unit = unit;
546
806
  _this.value = value;
547
807
  return _this;
@@ -794,8 +1054,7 @@ function (_super) {
794
1054
  }
795
1055
 
796
1056
  CSSMathInvert.create = function (value) {
797
- var type = _CSSNumericValueType.CSSNumericValueType.negateExponents(value.type_);
798
-
1057
+ var type = CSSNumericValueType.negateExponents(value.type_);
799
1058
  return new CSSMathInvert(value, type);
800
1059
  };
801
1060
 
@@ -999,7 +1258,7 @@ function (_super) {
999
1258
 
1000
1259
  CSSMathMin.create = function (values) {
1001
1260
  var error = false;
1002
- var final_type = typeCheck(values, _CSSNumericValueType.CSSNumericValueType.add, error);
1261
+ var final_type = typeCheck(values, CSSNumericValueType.add, error);
1003
1262
  return error ? null : new CSSMathMin(values, final_type);
1004
1263
  };
1005
1264
 
@@ -1109,7 +1368,7 @@ function (_super) {
1109
1368
 
1110
1369
  CSSMathMax.create = function (values) {
1111
1370
  var error = false;
1112
- var final_type = typeCheck(values, _CSSNumericValueType.CSSNumericValueType.add, error);
1371
+ var final_type = typeCheck(values, CSSNumericValueType.add, error);
1113
1372
  return error ? null : new CSSMathMax(values, final_type);
1114
1373
  };
1115
1374
 
@@ -1221,16 +1480,16 @@ function (_super) {
1221
1480
 
1222
1481
  CSSMathSum.create = function (values) {
1223
1482
  var error = false;
1224
- var finalType = typeCheck(values, _CSSNumericValueType.CSSNumericValueType.add, error);
1483
+ var finalType = typeCheck(values, CSSNumericValueType.add, error);
1225
1484
  return error ? null : new CSSMathSum(values, finalType);
1226
1485
  };
1227
1486
 
1228
1487
  CSSMathSum.numericTypeFromUnitMap = function (units) {
1229
- var type = new _CSSNumericValueType.CSSNumericValueType();
1488
+ var type = new CSSNumericValueType();
1230
1489
  Object.keys(units).forEach(function (key) {
1231
1490
  var exp = units[key];
1232
1491
  var error = false;
1233
- type = _CSSNumericValueType.CSSNumericValueType.multiply(type, new _CSSNumericValueType.CSSNumericValueType(Number(key), exp), error);
1492
+ type = CSSNumericValueType.multiply(type, new CSSNumericValueType(Number(key), exp), error);
1234
1493
  (0, _utils.DCHECK)(!error);
1235
1494
  });
1236
1495
  return type;
@@ -1243,9 +1502,7 @@ function (_super) {
1243
1502
  var first_type = this.numericTypeFromUnitMap(sum[0].units);
1244
1503
  return sum.every(function (term) {
1245
1504
  var error = false;
1246
-
1247
- _CSSNumericValueType.CSSNumericValueType.add(first_type, _this.numericTypeFromUnitMap(term.units), error);
1248
-
1505
+ CSSNumericValueType.add(first_type, _this.numericTypeFromUnitMap(term.units), error);
1249
1506
  return !error;
1250
1507
  });
1251
1508
  };
@@ -1336,7 +1593,7 @@ function (_super) {
1336
1593
 
1337
1594
  CSSMathProduct.create = function (values) {
1338
1595
  var error = false;
1339
- var finalType = typeCheck(values, _CSSNumericValueType.CSSNumericValueType.multiply, error);
1596
+ var finalType = typeCheck(values, CSSNumericValueType.multiply, error);
1340
1597
  return error ? null : new CSSMathProduct(values, finalType);
1341
1598
  };
1342
1599
 
@@ -1421,4 +1678,8 @@ function (_super) {
1421
1678
  return CSSMathProduct;
1422
1679
  }(CSSMathVariadic);
1423
1680
 
1424
- exports.CSSMathProduct = CSSMathProduct;
1681
+ exports.CSSMathProduct = CSSMathProduct;
1682
+ var Opx = new CSSUnitValue(0, 'px');
1683
+ exports.Opx = Opx;
1684
+ var Odeg = new CSSUnitValue(0, 'deg');
1685
+ exports.Odeg = Odeg;
@@ -12,7 +12,6 @@ export * from './CSSKeywordValue';
12
12
  export * from './CSSMathOperator';
13
13
  export * from './CSSNumericSumValue';
14
14
  export * from './CSSNumericValue';
15
- export * from './CSSNumericValueType';
16
15
  export * from './CSSRGB';
17
16
  export * from './CSSGradientValue';
18
17
  export * from './CSSStyleValue';
@@ -82,19 +82,6 @@ Object.keys(_CSSNumericValue).forEach(function (key) {
82
82
  });
83
83
  });
84
84
 
85
- var _CSSNumericValueType = require("./CSSNumericValueType");
86
-
87
- Object.keys(_CSSNumericValueType).forEach(function (key) {
88
- if (key === "default" || key === "__esModule") return;
89
- if (key in exports && exports[key] === _CSSNumericValueType[key]) return;
90
- Object.defineProperty(exports, key, {
91
- enumerable: true,
92
- get: function get() {
93
- return _CSSNumericValueType[key];
94
- }
95
- });
96
- });
97
-
98
85
  var _CSSRGB = require("./CSSRGB");
99
86
 
100
87
  Object.keys(_CSSRGB).forEach(function (key) {
@@ -4,8 +4,6 @@ export interface ParsedTransform {
4
4
  t: string;
5
5
  d: CSSUnitValue[];
6
6
  }
7
- export declare const Opx: CSSUnitValue;
8
- export declare const Odeg: CSSUnitValue;
9
7
  /**
10
8
  * none
11
9
  * scale(1) scale(1, 2)
@@ -3,19 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.Opx = exports.Odeg = void 0;
7
6
  exports.mergeTransforms = mergeTransforms;
8
7
  exports.parseTransform = parseTransform;
9
8
 
10
- var _2 = require("./");
11
-
12
9
  var _cssom = require("../cssom");
13
10
 
11
+ var _dimension = require("./dimension");
12
+
13
+ var _numeric = require("./numeric");
14
+
14
15
  var _ = null;
15
- var Opx = new _cssom.CSSUnitValue(0, 'px');
16
- exports.Opx = Opx;
17
- var Odeg = new _cssom.CSSUnitValue(0, 'deg');
18
- exports.Odeg = Odeg;
19
16
 
20
17
  function cast(pattern) {
21
18
  return function (contents) {
@@ -49,10 +46,10 @@ var transformFunctions = {
49
46
  // skew: ['Aa', null, id],
50
47
  // skewx: ['A', null, cast([_, Odeg])],
51
48
  // skewy: ['A', null, cast([Odeg, _])],
52
- translate: ['Tt', cast([_, _, Opx]), id],
53
- translatex: ['T', cast([_, Opx, Opx]), cast([_, Opx])],
54
- translatey: ['T', cast([Opx, _, Opx]), cast([Opx, _])],
55
- translatez: ['L', cast([Opx, Opx, _])],
49
+ translate: ['Tt', cast([_, _, _cssom.Opx]), id],
50
+ translatex: ['T', cast([_, _cssom.Opx, _cssom.Opx]), cast([_, _cssom.Opx])],
51
+ translatey: ['T', cast([_cssom.Opx, _, _cssom.Opx]), cast([_cssom.Opx, _])],
52
+ translatez: ['L', cast([_cssom.Opx, _cssom.Opx, _])],
56
53
  translate3d: ['TTL', id]
57
54
  };
58
55
  /**
@@ -107,19 +104,19 @@ function parseTransform(string) {
107
104
  if (!arg) {
108
105
  // @ts-ignore
109
106
  parsedArg = {
110
- a: Odeg,
107
+ a: _cssom.Odeg,
111
108
  n: parsedArgs[0],
112
- t: Opx
109
+ t: _cssom.Opx
113
110
  }[type];
114
111
  } else {
115
112
  // @ts-ignore
116
113
  parsedArg = {
117
114
  A: function A(s) {
118
- return s.trim() === '0' ? Odeg : (0, _2.parseAngle)(s);
115
+ return s.trim() === '0' ? _cssom.Odeg : (0, _dimension.parseAngle)(s);
119
116
  },
120
- N: _2.parseNumber,
121
- T: _2.parseLengthOrPercentage,
122
- L: _2.parseLength
117
+ N: _numeric.parseNumber,
118
+ T: _dimension.parseLengthOrPercentage,
119
+ L: _dimension.parseLength
123
120
  }[type.toUpperCase()](arg);
124
121
  }
125
122
 
@@ -270,7 +267,7 @@ function mergeTransforms(left, right, target) {
270
267
  var stringConversions = [];
271
268
 
272
269
  for (var j = 0; j < leftArgs.length; j++) {
273
- var merge = leftArgs[j].unit === _cssom.UnitType.kNumber ? _2.mergeNumbers : _2.mergeDimensions; // @ts-ignore
270
+ var merge = leftArgs[j].unit === _cssom.UnitType.kNumber ? _numeric.mergeNumbers : _dimension.mergeDimensions; // @ts-ignore
274
271
 
275
272
  var merged = merge(leftArgs[j], rightArgs[j], target, false, j);
276
273
  leftArgsCopy[j] = merged[0];
@@ -111,40 +111,40 @@ function () {
111
111
  }) || [1, 1, 1];
112
112
  object.scaleLocal(newScale[0] / oldScale[0], newScale[1] / oldScale[1], newScale[2] / oldScale[2]);
113
113
  } else if (t === 'translate') {
114
- var newTranslation = value && value.d || [_parser.Opx, _parser.Opx];
115
- var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx];
114
+ var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx];
115
+ var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx];
116
116
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, 0);
117
117
  } else if (t === 'translatex') {
118
- var newTranslation = value && value.d || [_parser.Opx];
119
- var oldTranslation = old && old.d || [_parser.Opx];
118
+ var newTranslation = value && value.d || [_cssom.Opx];
119
+ var oldTranslation = old && old.d || [_cssom.Opx];
120
120
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, 0, 0);
121
121
  } else if (t === 'translatey') {
122
- var newTranslation = value && value.d || [_parser.Opx];
123
- var oldTranslation = old && old.d || [_parser.Opx];
122
+ var newTranslation = value && value.d || [_cssom.Opx];
123
+ var oldTranslation = old && old.d || [_cssom.Opx];
124
124
  object.translateLocal(0, newTranslation[0].value - oldTranslation[0].value, 0);
125
125
  } else if (t === 'translatez') {
126
- var newTranslation = value && value.d || [_parser.Opx];
127
- var oldTranslation = old && old.d || [_parser.Opx];
126
+ var newTranslation = value && value.d || [_cssom.Opx];
127
+ var oldTranslation = old && old.d || [_cssom.Opx];
128
128
  object.translateLocal(0, 0, newTranslation[0].value - oldTranslation[0].value);
129
129
  } else if (t === 'translate3d') {
130
- var newTranslation = value && value.d || [_parser.Opx, _parser.Opx, _parser.Opx];
131
- var oldTranslation = old && old.d || [_parser.Opx, _parser.Opx, _parser.Opx];
130
+ var newTranslation = value && value.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
131
+ var oldTranslation = old && old.d || [_cssom.Opx, _cssom.Opx, _cssom.Opx];
132
132
  object.translateLocal(newTranslation[0].value - oldTranslation[0].value, newTranslation[1].value - oldTranslation[1].value, newTranslation[2].value - oldTranslation[2].value);
133
133
  } else if (t === 'rotate') {
134
- var newAngles = value && value.d || [_parser.Odeg];
135
- var oldAngles = old && old.d || [_parser.Odeg];
134
+ var newAngles = value && value.d || [_cssom.Odeg];
135
+ var oldAngles = old && old.d || [_cssom.Odeg];
136
136
  object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
137
137
  } else if (t === 'rotatex') {
138
- var newAngles = value && value.d || [_parser.Odeg];
139
- var oldAngles = old && old.d || [_parser.Odeg];
138
+ var newAngles = value && value.d || [_cssom.Odeg];
139
+ var oldAngles = old && old.d || [_cssom.Odeg];
140
140
  object.rotateLocal(newAngles[0].value - oldAngles[0].value, 0, 0);
141
141
  } else if (t === 'rotatey') {
142
- var newAngles = value && value.d || [_parser.Odeg];
143
- var oldAngles = old && old.d || [_parser.Odeg];
142
+ var newAngles = value && value.d || [_cssom.Odeg];
143
+ var oldAngles = old && old.d || [_cssom.Odeg];
144
144
  object.rotateLocal(0, newAngles[0].value - oldAngles[0].value, 0);
145
145
  } else if (t === 'rotatez') {
146
- var newAngles = value && value.d || [_parser.Odeg];
147
- var oldAngles = old && old.d || [_parser.Odeg];
146
+ var newAngles = value && value.d || [_cssom.Odeg];
147
+ var oldAngles = old && old.d || [_cssom.Odeg];
148
148
  object.rotateLocal(0, 0, newAngles[0].value - oldAngles[0].value);
149
149
  } else if (t === 'rotate3d') {// 暂不支持绕指定轴旋转
150
150
  // const newAngles = value && value.d || [Odeg, Odeg, Odeg];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@antv/g",
3
- "version": "5.0.23-alpha.2",
3
+ "version": "5.0.23-alpha.7",
4
4
  "description": "A core module including ECS and DI container.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "homepage": "https://github.com/antvis/g#readme",
40
40
  "dependencies": {
41
- "@antv/g-math": "^1.0.20-alpha.2",
41
+ "@antv/g-math": "^1.0.20-alpha.7",
42
42
  "@antv/util": "^3.0.0",
43
43
  "@types/offscreencanvas": "^2019.6.4",
44
44
  "d3-color": "^1.4.0",
@@ -52,5 +52,5 @@
52
52
  "scripts": {
53
53
  "umd": "webpack"
54
54
  },
55
- "gitHead": "af1c0b90600f8b68d1008877bc98aefa308fefa8"
55
+ "gitHead": "8c28e04155e41a948c323161a35aeda63c2294a4"
56
56
  }
@@ -1,33 +0,0 @@
1
- import { UnitType } from './types';
2
- export declare enum BaseType {
3
- kLength = 0,
4
- kAngle = 1,
5
- kTime = 2,
6
- kFrequency = 3,
7
- kResolution = 4,
8
- kFlex = 5,
9
- kPercent = 6,
10
- kNumBaseTypes = 7
11
- }
12
- export declare function unitTypeToBaseType(unit: UnitType): BaseType.kLength | BaseType.kAngle | BaseType.kTime | BaseType.kFrequency | BaseType.kResolution | BaseType.kFlex | BaseType.kPercent;
13
- export declare function baseTypeToString(baseType: BaseType): "" | "percent" | "length" | "angle" | "time" | "frequency" | "resolution" | "flex";
14
- export declare class CSSNumericValueType {
15
- private exponents;
16
- private numNonZeroEntries;
17
- percentHint: BaseType;
18
- hasPercentHint: boolean;
19
- constructor(unit?: UnitType, exponent?: number);
20
- applyPercentHint(hint: BaseType): void;
21
- hasNonZeroEntries(): boolean;
22
- isOnlyNonZeroEntry(baseType: BaseType, value: number): boolean;
23
- exponent(type: BaseType): number;
24
- setExponent(type: BaseType, newValue: number): void;
25
- static negateExponents(type: CSSNumericValueType): CSSNumericValueType;
26
- matchesBaseType(baseType: BaseType): boolean;
27
- matchesPercentage(): boolean;
28
- matchesBaseTypePercentage(baseType: BaseType): boolean;
29
- matchesNumber(): boolean;
30
- matchesNumberPercentage(): boolean;
31
- static add(type1: CSSNumericValueType, type2: CSSNumericValueType, error: boolean): CSSNumericValueType;
32
- static multiply(type1: CSSNumericValueType, type2: CSSNumericValueType, error: boolean): CSSNumericValueType;
33
- }