@antv/g-lite 1.0.45 → 1.0.47
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.
- package/dist/css/CSSStyleValuePool.d.ts +1 -0
- package/dist/css/CSSStyleValuePool.d.ts.map +1 -1
- package/dist/css/StyleValueRegistry.d.ts.map +1 -1
- package/dist/display-objects/Text.d.ts +1 -0
- package/dist/display-objects/Text.d.ts.map +1 -1
- package/dist/index.esm.js +956 -953
- package/dist/index.js +955 -952
- package/dist/index.umd.js +955 -952
- package/dist/index.umd.min.js +1 -1
- package/dist/plugins/EventPlugin.d.ts.map +1 -1
- package/dist/services/SceneGraphService.d.ts.map +1 -1
- package/dist/shapes/AABB.d.ts +0 -1
- package/dist/shapes/AABB.d.ts.map +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1627,6 +1627,7 @@ var getOrCreateUnitValue = function getOrCreateUnitValue(value, unitOrName) {
|
|
|
1627
1627
|
}
|
|
1628
1628
|
return new CSSUnitValue(value, unitOrName);
|
|
1629
1629
|
};
|
|
1630
|
+
var PECENTAGE_50 = new CSSUnitValue(50, '%');
|
|
1630
1631
|
|
|
1631
1632
|
var canvasMap = {};
|
|
1632
1633
|
var defaultCanvasIdCounter = 0;
|
|
@@ -1660,8 +1661,8 @@ function sortByZIndex(o1, o2) {
|
|
|
1660
1661
|
function findClosestClipPathTarget(object) {
|
|
1661
1662
|
var el = object;
|
|
1662
1663
|
do {
|
|
1663
|
-
var _el$
|
|
1664
|
-
var clipPath = (_el$
|
|
1664
|
+
var _el$parsedStyle;
|
|
1665
|
+
var clipPath = (_el$parsedStyle = el.parsedStyle) === null || _el$parsedStyle === void 0 ? void 0 : _el$parsedStyle.clipPath;
|
|
1665
1666
|
if (clipPath) return el;
|
|
1666
1667
|
el = el.parentElement;
|
|
1667
1668
|
} while (el !== null);
|
|
@@ -4167,8 +4168,7 @@ function toFontString(attributes) {
|
|
|
4167
4168
|
var fontSizeString = util.isNumber(fontSize) && fontSize + "px" || '16px';
|
|
4168
4169
|
// Clean-up fontFamily property by quoting each font name
|
|
4169
4170
|
// this will support font names with spaces
|
|
4170
|
-
|
|
4171
|
-
var fontFamilies = util.isString(fontFamily) ? fontFamily.split(',') : [fontFamily];
|
|
4171
|
+
var fontFamilies = fontFamily.split(',');
|
|
4172
4172
|
for (var i = fontFamilies.length - 1; i >= 0; i--) {
|
|
4173
4173
|
// Trim any extra white-space
|
|
4174
4174
|
var _fontFamily = fontFamilies[i].trim();
|
|
@@ -4577,566 +4577,149 @@ function mergeColors(left, right) {
|
|
|
4577
4577
|
}];
|
|
4578
4578
|
}
|
|
4579
4579
|
|
|
4580
|
+
function parseDimension(unitRegExp, string) {
|
|
4581
|
+
if (util.isNil(string)) {
|
|
4582
|
+
return getOrCreateUnitValue(0, 'px');
|
|
4583
|
+
}
|
|
4584
|
+
string = ("" + string).trim().toLowerCase();
|
|
4585
|
+
if (isFinite(Number(string))) {
|
|
4586
|
+
if ('px'.search(unitRegExp) >= 0) {
|
|
4587
|
+
return getOrCreateUnitValue(Number(string), 'px');
|
|
4588
|
+
} else if ('deg'.search(unitRegExp) >= 0) {
|
|
4589
|
+
return getOrCreateUnitValue(Number(string), 'deg');
|
|
4590
|
+
}
|
|
4591
|
+
}
|
|
4592
|
+
var matchedUnits = [];
|
|
4593
|
+
string = string.replace(unitRegExp, function (match) {
|
|
4594
|
+
matchedUnits.push(match);
|
|
4595
|
+
return 'U' + match;
|
|
4596
|
+
});
|
|
4597
|
+
var taggedUnitRegExp = 'U(' + unitRegExp.source + ')';
|
|
4598
|
+
return matchedUnits.map(function (unit) {
|
|
4599
|
+
return getOrCreateUnitValue(Number(string.replace(new RegExp('U' + unit, 'g'), '').replace(new RegExp(taggedUnitRegExp, 'g'), '*0')), unit);
|
|
4600
|
+
})[0];
|
|
4601
|
+
}
|
|
4580
4602
|
/**
|
|
4581
|
-
*
|
|
4582
|
-
*
|
|
4583
|
-
*
|
|
4603
|
+
* <length>
|
|
4604
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
4605
|
+
* length with only absolute unit, eg. 1px
|
|
4584
4606
|
*/
|
|
4585
|
-
var
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4607
|
+
var parseLength = memoize(function (css) {
|
|
4608
|
+
return parseDimension(new RegExp('px', 'g'), css);
|
|
4609
|
+
});
|
|
4610
|
+
/**
|
|
4611
|
+
* <percentage>
|
|
4612
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
|
|
4613
|
+
*/
|
|
4614
|
+
var parserPercentage = memoize(function (css) {
|
|
4615
|
+
return parseDimension(new RegExp('%', 'g'), css);
|
|
4616
|
+
});
|
|
4617
|
+
/**
|
|
4618
|
+
* length with absolute or relative unit,
|
|
4619
|
+
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
4620
|
+
*
|
|
4621
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
4622
|
+
*/
|
|
4623
|
+
// export const parseLengthOrPercentage = memoize((css: string): CSSUnitValue => {
|
|
4624
|
+
// if (isNumber(css) || isFinite(Number(css))) {
|
|
4625
|
+
// return getOrCreateUnitValue(Number(css), 'px');
|
|
4626
|
+
// }
|
|
4627
|
+
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
4628
|
+
// });
|
|
4629
|
+
var parseLengthOrPercentage = function parseLengthOrPercentage(css) {
|
|
4630
|
+
if (util.isNumber(css) || isFinite(Number(css))) {
|
|
4631
|
+
return getOrCreateUnitValue(Number(css), 'px');
|
|
4632
|
+
// return Number(css);
|
|
4605
4633
|
}
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
}
|
|
4641
|
-
if (AABB.isEmpty(this)) {
|
|
4642
|
-
this.setMinMax(aabb.getMin(), aabb.getMax());
|
|
4643
|
-
return;
|
|
4644
|
-
}
|
|
4645
|
-
var tc = this.center;
|
|
4646
|
-
var tcx = tc[0];
|
|
4647
|
-
var tcy = tc[1];
|
|
4648
|
-
var tcz = tc[2];
|
|
4649
|
-
var th = this.halfExtents;
|
|
4650
|
-
var thx = th[0];
|
|
4651
|
-
var thy = th[1];
|
|
4652
|
-
var thz = th[2];
|
|
4653
|
-
var tminx = tcx - thx;
|
|
4654
|
-
var tmaxx = tcx + thx;
|
|
4655
|
-
var tminy = tcy - thy;
|
|
4656
|
-
var tmaxy = tcy + thy;
|
|
4657
|
-
var tminz = tcz - thz;
|
|
4658
|
-
var tmaxz = tcz + thz;
|
|
4659
|
-
var oc = aabb.center;
|
|
4660
|
-
var ocx = oc[0];
|
|
4661
|
-
var ocy = oc[1];
|
|
4662
|
-
var ocz = oc[2];
|
|
4663
|
-
var oh = aabb.halfExtents;
|
|
4664
|
-
var ohx = oh[0];
|
|
4665
|
-
var ohy = oh[1];
|
|
4666
|
-
var ohz = oh[2];
|
|
4667
|
-
var ominx = ocx - ohx;
|
|
4668
|
-
var omaxx = ocx + ohx;
|
|
4669
|
-
var ominy = ocy - ohy;
|
|
4670
|
-
var omaxy = ocy + ohy;
|
|
4671
|
-
var ominz = ocz - ohz;
|
|
4672
|
-
var omaxz = ocz + ohz;
|
|
4673
|
-
if (ominx < tminx) {
|
|
4674
|
-
tminx = ominx;
|
|
4675
|
-
}
|
|
4676
|
-
if (omaxx > tmaxx) {
|
|
4677
|
-
tmaxx = omaxx;
|
|
4678
|
-
}
|
|
4679
|
-
if (ominy < tminy) {
|
|
4680
|
-
tminy = ominy;
|
|
4634
|
+
|
|
4635
|
+
return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
|
|
4636
|
+
};
|
|
4637
|
+
var parseAngle = memoize(function (css) {
|
|
4638
|
+
return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
|
|
4639
|
+
});
|
|
4640
|
+
/**
|
|
4641
|
+
* merge CSSUnitValue
|
|
4642
|
+
*
|
|
4643
|
+
* @example
|
|
4644
|
+
* 10px + 20px = 30px
|
|
4645
|
+
* 10deg + 10rad
|
|
4646
|
+
* 10% + 20% = 30%
|
|
4647
|
+
*/
|
|
4648
|
+
function mergeDimensions(left, right, target, nonNegative, index) {
|
|
4649
|
+
if (index === void 0) {
|
|
4650
|
+
index = 0;
|
|
4651
|
+
}
|
|
4652
|
+
var unit = '';
|
|
4653
|
+
var leftValue = left.value || 0;
|
|
4654
|
+
var rightValue = right.value || 0;
|
|
4655
|
+
var canonicalUnit = toCanonicalUnit(left.unit);
|
|
4656
|
+
var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
|
|
4657
|
+
var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
|
|
4658
|
+
if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
|
|
4659
|
+
leftValue = leftCanonicalUnitValue.value;
|
|
4660
|
+
rightValue = rightCanonicalUnitValue.value;
|
|
4661
|
+
unit = unitTypeToString(left.unit);
|
|
4662
|
+
} else {
|
|
4663
|
+
// format '%' to 'px'
|
|
4664
|
+
if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
|
|
4665
|
+
leftValue = convertPercentUnit(left, index, target);
|
|
4666
|
+
rightValue = convertPercentUnit(right, index, target);
|
|
4667
|
+
unit = 'px';
|
|
4681
4668
|
}
|
|
4682
|
-
|
|
4683
|
-
|
|
4669
|
+
}
|
|
4670
|
+
// // format 'rad' 'turn' to 'deg'
|
|
4671
|
+
// if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
|
|
4672
|
+
// leftValue = convertAngleUnit(left);
|
|
4673
|
+
// rightValue = convertAngleUnit(right);
|
|
4674
|
+
// unit = 'deg';
|
|
4675
|
+
// }
|
|
4676
|
+
return [leftValue, rightValue, function (value) {
|
|
4677
|
+
if (nonNegative) {
|
|
4678
|
+
value = Math.max(value, 0);
|
|
4684
4679
|
}
|
|
4685
|
-
|
|
4686
|
-
|
|
4680
|
+
return value + unit;
|
|
4681
|
+
}];
|
|
4682
|
+
}
|
|
4683
|
+
function convertAngleUnit(value) {
|
|
4684
|
+
var deg = 0;
|
|
4685
|
+
if (value.unit === exports.UnitType.kDegrees) {
|
|
4686
|
+
deg = value.value;
|
|
4687
|
+
} else if (value.unit === exports.UnitType.kRadians) {
|
|
4688
|
+
deg = rad2deg(Number(value.value));
|
|
4689
|
+
} else if (value.unit === exports.UnitType.kTurns) {
|
|
4690
|
+
deg = turn2deg(Number(value.value));
|
|
4691
|
+
}
|
|
4692
|
+
return deg;
|
|
4693
|
+
}
|
|
4694
|
+
function parseDimensionArrayFormat(string, size) {
|
|
4695
|
+
var parsed;
|
|
4696
|
+
if (Array.isArray(string)) {
|
|
4697
|
+
// [1, '2px', 3]
|
|
4698
|
+
parsed = string.map(function (segment) {
|
|
4699
|
+
return Number(segment);
|
|
4700
|
+
});
|
|
4701
|
+
} else if (util.isString(string)) {
|
|
4702
|
+
parsed = string.split(' ').map(function (segment) {
|
|
4703
|
+
return Number(segment);
|
|
4704
|
+
});
|
|
4705
|
+
} else if (util.isNumber(string)) {
|
|
4706
|
+
parsed = [string];
|
|
4707
|
+
}
|
|
4708
|
+
if (size === 2) {
|
|
4709
|
+
if (parsed.length === 1) {
|
|
4710
|
+
return [parsed[0], parsed[0]];
|
|
4711
|
+
} else {
|
|
4712
|
+
return [parsed[0], parsed[1]];
|
|
4687
4713
|
}
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
this.min[0] = tminx;
|
|
4698
|
-
this.min[1] = tminy;
|
|
4699
|
-
this.min[2] = tminz;
|
|
4700
|
-
this.max[0] = tmaxx;
|
|
4701
|
-
this.max[1] = tmaxy;
|
|
4702
|
-
this.max[2] = tmaxz;
|
|
4703
|
-
};
|
|
4704
|
-
_proto.setFromTransformedAABB = function setFromTransformedAABB(aabb, m) {
|
|
4705
|
-
var bc = this.center;
|
|
4706
|
-
var br = this.halfExtents;
|
|
4707
|
-
var ac = aabb.center;
|
|
4708
|
-
var ar = aabb.halfExtents;
|
|
4709
|
-
var mx0 = m[0];
|
|
4710
|
-
var mx1 = m[4];
|
|
4711
|
-
var mx2 = m[8];
|
|
4712
|
-
var my0 = m[1];
|
|
4713
|
-
var my1 = m[5];
|
|
4714
|
-
var my2 = m[9];
|
|
4715
|
-
var mz0 = m[2];
|
|
4716
|
-
var mz1 = m[6];
|
|
4717
|
-
var mz2 = m[10];
|
|
4718
|
-
var mx0a = Math.abs(mx0);
|
|
4719
|
-
var mx1a = Math.abs(mx1);
|
|
4720
|
-
var mx2a = Math.abs(mx2);
|
|
4721
|
-
var my0a = Math.abs(my0);
|
|
4722
|
-
var my1a = Math.abs(my1);
|
|
4723
|
-
var my2a = Math.abs(my2);
|
|
4724
|
-
var mz0a = Math.abs(mz0);
|
|
4725
|
-
var mz1a = Math.abs(mz1);
|
|
4726
|
-
var mz2a = Math.abs(mz2);
|
|
4727
|
-
bc[0] = m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2];
|
|
4728
|
-
bc[1] = m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2];
|
|
4729
|
-
bc[2] = m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2];
|
|
4730
|
-
// vec3.set(
|
|
4731
|
-
// bc,
|
|
4732
|
-
// m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2],
|
|
4733
|
-
// m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2],
|
|
4734
|
-
// m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2],
|
|
4735
|
-
// );
|
|
4736
|
-
br[0] = mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2];
|
|
4737
|
-
br[1] = my0a * ar[0] + my1a * ar[1] + my2a * ar[2];
|
|
4738
|
-
br[2] = mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2];
|
|
4739
|
-
// vec3.set(
|
|
4740
|
-
// br,
|
|
4741
|
-
// mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2],
|
|
4742
|
-
// my0a * ar[0] + my1a * ar[1] + my2a * ar[2],
|
|
4743
|
-
// mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2],
|
|
4744
|
-
// );
|
|
4745
|
-
// this.min = vec3.sub(this.min, bc, br);
|
|
4746
|
-
// this.max = vec3.add(this.max, bc, br);
|
|
4747
|
-
subVec3(this.min, bc, br);
|
|
4748
|
-
addVec3(this.max, bc, br);
|
|
4749
|
-
};
|
|
4750
|
-
_proto.intersects = function intersects(aabb) {
|
|
4751
|
-
var aMax = this.getMax();
|
|
4752
|
-
var aMin = this.getMin();
|
|
4753
|
-
var bMax = aabb.getMax();
|
|
4754
|
-
var bMin = aabb.getMin();
|
|
4755
|
-
return aMin[0] <= bMax[0] && aMax[0] >= bMin[0] && aMin[1] <= bMax[1] && aMax[1] >= bMin[1] && aMin[2] <= bMax[2] && aMax[2] >= bMin[2];
|
|
4756
|
-
};
|
|
4757
|
-
_proto.intersection = function intersection(aabb) {
|
|
4758
|
-
if (!this.intersects(aabb)) {
|
|
4759
|
-
return null;
|
|
4760
|
-
}
|
|
4761
|
-
var intersection = new AABB();
|
|
4762
|
-
// const min = vec3.max(vec3.create(), this.getMin(), aabb.getMin());
|
|
4763
|
-
// const max = vec3.min(vec3.create(), this.getMax(), aabb.getMax());
|
|
4764
|
-
var min = maxVec3([0, 0, 0], this.getMin(), aabb.getMin());
|
|
4765
|
-
var max = minVec3([0, 0, 0], this.getMax(), aabb.getMax());
|
|
4766
|
-
intersection.setMinMax(min, max);
|
|
4767
|
-
return intersection;
|
|
4768
|
-
}
|
|
4769
|
-
// containsPoint(point: vec3) {
|
|
4770
|
-
// const min = this.getMin();
|
|
4771
|
-
// const max = this.getMax();
|
|
4772
|
-
// return !(
|
|
4773
|
-
// point[0] < min[0] ||
|
|
4774
|
-
// point[0] > max[0] ||
|
|
4775
|
-
// point[1] < min[1] ||
|
|
4776
|
-
// point[1] > max[1] ||
|
|
4777
|
-
// point[2] < min[2] ||
|
|
4778
|
-
// point[2] > max[2]
|
|
4779
|
-
// );
|
|
4780
|
-
// }
|
|
4781
|
-
/**
|
|
4782
|
-
* get n-vertex
|
|
4783
|
-
* @param plane plane of CullingVolume
|
|
4784
|
-
*/;
|
|
4785
|
-
_proto.getNegativeFarPoint = function getNegativeFarPoint(plane) {
|
|
4786
|
-
if (plane.pnVertexFlag === 0x111) {
|
|
4787
|
-
return copyVec3([0, 0, 0], this.min);
|
|
4788
|
-
// return vec3.copy(vec3.create(), this.min);
|
|
4789
|
-
} else if (plane.pnVertexFlag === 0x110) {
|
|
4790
|
-
return [this.min[0], this.min[1], this.max[2]];
|
|
4791
|
-
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
4792
|
-
} else if (plane.pnVertexFlag === 0x101) {
|
|
4793
|
-
return [this.min[0], this.max[1], this.min[2]];
|
|
4794
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
4795
|
-
} else if (plane.pnVertexFlag === 0x100) {
|
|
4796
|
-
return [this.min[0], this.max[1], this.max[2]];
|
|
4797
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
4798
|
-
} else if (plane.pnVertexFlag === 0x011) {
|
|
4799
|
-
return [this.max[0], this.min[1], this.min[2]];
|
|
4800
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
4801
|
-
} else if (plane.pnVertexFlag === 0x010) {
|
|
4802
|
-
return [this.max[0], this.min[1], this.max[2]];
|
|
4803
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
4804
|
-
} else if (plane.pnVertexFlag === 0x001) {
|
|
4805
|
-
return [this.max[0], this.max[1], this.min[2]];
|
|
4806
|
-
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
4807
|
-
} else {
|
|
4808
|
-
return [this.max[0], this.max[1], this.max[2]];
|
|
4809
|
-
// return vec3.fromValues(this.max[0], this.max[1], this.max[2]);
|
|
4810
|
-
}
|
|
4811
|
-
}
|
|
4812
|
-
/**
|
|
4813
|
-
* get p-vertex
|
|
4814
|
-
* @param plane plane of CullingVolume
|
|
4815
|
-
*/;
|
|
4816
|
-
_proto.getPositiveFarPoint = function getPositiveFarPoint(plane) {
|
|
4817
|
-
if (plane.pnVertexFlag === 0x111) {
|
|
4818
|
-
return copyVec3([0, 0, 0], this.max);
|
|
4819
|
-
// return vec3.copy(vec3.create(), this.max);
|
|
4820
|
-
} else if (plane.pnVertexFlag === 0x110) {
|
|
4821
|
-
return [this.max[0], this.max[1], this.min[2]];
|
|
4822
|
-
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
4823
|
-
} else if (plane.pnVertexFlag === 0x101) {
|
|
4824
|
-
return [this.max[0], this.min[1], this.max[2]];
|
|
4825
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
4826
|
-
} else if (plane.pnVertexFlag === 0x100) {
|
|
4827
|
-
return [this.max[0], this.min[1], this.min[2]];
|
|
4828
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
4829
|
-
} else if (plane.pnVertexFlag === 0x011) {
|
|
4830
|
-
return [this.min[0], this.max[1], this.max[2]];
|
|
4831
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
4832
|
-
} else if (plane.pnVertexFlag === 0x010) {
|
|
4833
|
-
return [this.min[0], this.max[1], this.min[2]];
|
|
4834
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
4835
|
-
} else if (plane.pnVertexFlag === 0x001) {
|
|
4836
|
-
return [this.min[0], this.min[1], this.max[2]];
|
|
4837
|
-
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
4838
|
-
} else {
|
|
4839
|
-
return [this.min[0], this.min[1], this.min[2]];
|
|
4840
|
-
// return vec3.fromValues(this.min[0], this.min[1], this.min[2]);
|
|
4841
|
-
}
|
|
4842
|
-
};
|
|
4843
|
-
return AABB;
|
|
4844
|
-
}();
|
|
4845
|
-
|
|
4846
|
-
var Plane = /*#__PURE__*/function () {
|
|
4847
|
-
/**
|
|
4848
|
-
* lookup table for p-vertex & n-vertex when doing frustum culling
|
|
4849
|
-
*/
|
|
4850
|
-
|
|
4851
|
-
function Plane(distance, normal) {
|
|
4852
|
-
this.distance = void 0;
|
|
4853
|
-
this.normal = void 0;
|
|
4854
|
-
this.pnVertexFlag = void 0;
|
|
4855
|
-
this.distance = distance || 0;
|
|
4856
|
-
this.normal = normal || glMatrix.vec3.fromValues(0, 1, 0);
|
|
4857
|
-
this.updatePNVertexFlag();
|
|
4858
|
-
}
|
|
4859
|
-
var _proto = Plane.prototype;
|
|
4860
|
-
_proto.updatePNVertexFlag = function updatePNVertexFlag() {
|
|
4861
|
-
this.pnVertexFlag = (Number(this.normal[0] >= 0) << 8) + (Number(this.normal[1] >= 0) << 4) + Number(this.normal[2] >= 0);
|
|
4862
|
-
};
|
|
4863
|
-
_proto.distanceToPoint = function distanceToPoint(point) {
|
|
4864
|
-
return glMatrix.vec3.dot(point, this.normal) - this.distance;
|
|
4865
|
-
};
|
|
4866
|
-
_proto.normalize = function normalize() {
|
|
4867
|
-
var invLen = 1 / glMatrix.vec3.len(this.normal);
|
|
4868
|
-
glMatrix.vec3.scale(this.normal, this.normal, invLen);
|
|
4869
|
-
this.distance *= invLen;
|
|
4870
|
-
};
|
|
4871
|
-
_proto.intersectsLine = function intersectsLine(start, end, point) {
|
|
4872
|
-
var d0 = this.distanceToPoint(start);
|
|
4873
|
-
var d1 = this.distanceToPoint(end);
|
|
4874
|
-
var t = d0 / (d0 - d1);
|
|
4875
|
-
var intersects = t >= 0 && t <= 1;
|
|
4876
|
-
if (intersects && point) {
|
|
4877
|
-
glMatrix.vec3.lerp(point, start, end, t);
|
|
4878
|
-
}
|
|
4879
|
-
return intersects;
|
|
4880
|
-
};
|
|
4881
|
-
return Plane;
|
|
4882
|
-
}();
|
|
4883
|
-
|
|
4884
|
-
(function (Mask) {
|
|
4885
|
-
Mask[Mask["OUTSIDE"] = 4294967295] = "OUTSIDE";
|
|
4886
|
-
Mask[Mask["INSIDE"] = 0] = "INSIDE";
|
|
4887
|
-
Mask[Mask["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
|
|
4888
|
-
})(exports.Mask || (exports.Mask = {}));
|
|
4889
|
-
var Frustum = /*#__PURE__*/function () {
|
|
4890
|
-
function Frustum(planes) {
|
|
4891
|
-
this.planes = [];
|
|
4892
|
-
if (planes) {
|
|
4893
|
-
this.planes = planes;
|
|
4894
|
-
} else {
|
|
4895
|
-
for (var i = 0; i < 6; i++) {
|
|
4896
|
-
this.planes.push(new Plane());
|
|
4897
|
-
}
|
|
4898
|
-
}
|
|
4899
|
-
}
|
|
4900
|
-
/**
|
|
4901
|
-
* extract 6 planes from projectionMatrix
|
|
4902
|
-
* @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
|
|
4903
|
-
*/
|
|
4904
|
-
var _proto = Frustum.prototype;
|
|
4905
|
-
_proto.extractFromVPMatrix = function extractFromVPMatrix(projectionMatrix) {
|
|
4906
|
-
// @ts-ignore
|
|
4907
|
-
var m0 = projectionMatrix[0],
|
|
4908
|
-
m1 = projectionMatrix[1],
|
|
4909
|
-
m2 = projectionMatrix[2],
|
|
4910
|
-
m3 = projectionMatrix[3],
|
|
4911
|
-
m4 = projectionMatrix[4],
|
|
4912
|
-
m5 = projectionMatrix[5],
|
|
4913
|
-
m6 = projectionMatrix[6],
|
|
4914
|
-
m7 = projectionMatrix[7],
|
|
4915
|
-
m8 = projectionMatrix[8],
|
|
4916
|
-
m9 = projectionMatrix[9],
|
|
4917
|
-
m10 = projectionMatrix[10],
|
|
4918
|
-
m11 = projectionMatrix[11],
|
|
4919
|
-
m12 = projectionMatrix[12],
|
|
4920
|
-
m13 = projectionMatrix[13],
|
|
4921
|
-
m14 = projectionMatrix[14],
|
|
4922
|
-
m15 = projectionMatrix[15];
|
|
4923
|
-
// right
|
|
4924
|
-
glMatrix.vec3.set(this.planes[0].normal, m3 - m0, m7 - m4, m11 - m8);
|
|
4925
|
-
this.planes[0].distance = m15 - m12;
|
|
4926
|
-
// left
|
|
4927
|
-
glMatrix.vec3.set(this.planes[1].normal, m3 + m0, m7 + m4, m11 + m8);
|
|
4928
|
-
this.planes[1].distance = m15 + m12;
|
|
4929
|
-
// bottom
|
|
4930
|
-
glMatrix.vec3.set(this.planes[2].normal, m3 + m1, m7 + m5, m11 + m9);
|
|
4931
|
-
this.planes[2].distance = m15 + m13;
|
|
4932
|
-
// top
|
|
4933
|
-
glMatrix.vec3.set(this.planes[3].normal, m3 - m1, m7 - m5, m11 - m9);
|
|
4934
|
-
this.planes[3].distance = m15 - m13;
|
|
4935
|
-
// far
|
|
4936
|
-
glMatrix.vec3.set(this.planes[4].normal, m3 - m2, m7 - m6, m11 - m10);
|
|
4937
|
-
this.planes[4].distance = m15 - m14;
|
|
4938
|
-
// near
|
|
4939
|
-
glMatrix.vec3.set(this.planes[5].normal, m3 + m2, m7 + m6, m11 + m10);
|
|
4940
|
-
this.planes[5].distance = m15 + m14;
|
|
4941
|
-
this.planes.forEach(function (plane) {
|
|
4942
|
-
plane.normalize();
|
|
4943
|
-
plane.updatePNVertexFlag();
|
|
4944
|
-
});
|
|
4945
|
-
};
|
|
4946
|
-
return Frustum;
|
|
4947
|
-
}();
|
|
4948
|
-
|
|
4949
|
-
var Point = /*#__PURE__*/function () {
|
|
4950
|
-
function Point(x, y) {
|
|
4951
|
-
if (x === void 0) {
|
|
4952
|
-
x = 0;
|
|
4953
|
-
}
|
|
4954
|
-
if (y === void 0) {
|
|
4955
|
-
y = 0;
|
|
4956
|
-
}
|
|
4957
|
-
this.x = 0;
|
|
4958
|
-
this.y = 0;
|
|
4959
|
-
this.x = x;
|
|
4960
|
-
this.y = y;
|
|
4961
|
-
}
|
|
4962
|
-
var _proto = Point.prototype;
|
|
4963
|
-
_proto.clone = function clone() {
|
|
4964
|
-
return new Point(this.x, this.y);
|
|
4965
|
-
};
|
|
4966
|
-
_proto.copyFrom = function copyFrom(p) {
|
|
4967
|
-
this.x = p.x;
|
|
4968
|
-
this.y = p.y;
|
|
4969
|
-
};
|
|
4970
|
-
return Point;
|
|
4971
|
-
}();
|
|
4972
|
-
|
|
4973
|
-
var Rectangle = /*#__PURE__*/function () {
|
|
4974
|
-
function Rectangle(x, y, width, height) {
|
|
4975
|
-
this.x = void 0;
|
|
4976
|
-
this.y = void 0;
|
|
4977
|
-
this.width = void 0;
|
|
4978
|
-
this.height = void 0;
|
|
4979
|
-
this.left = void 0;
|
|
4980
|
-
this.right = void 0;
|
|
4981
|
-
this.top = void 0;
|
|
4982
|
-
this.bottom = void 0;
|
|
4983
|
-
this.x = x;
|
|
4984
|
-
this.y = y;
|
|
4985
|
-
this.width = width;
|
|
4986
|
-
this.height = height;
|
|
4987
|
-
this.left = x;
|
|
4988
|
-
this.right = x + width;
|
|
4989
|
-
this.top = y;
|
|
4990
|
-
this.bottom = y + height;
|
|
4991
|
-
}
|
|
4992
|
-
var _proto = Rectangle.prototype;
|
|
4993
|
-
_proto.toJSON = function toJSON() {};
|
|
4994
|
-
return Rectangle;
|
|
4995
|
-
}();
|
|
4996
|
-
|
|
4997
|
-
function parseDimension(unitRegExp, string) {
|
|
4998
|
-
if (util.isNil(string)) {
|
|
4999
|
-
return getOrCreateUnitValue(0, 'px');
|
|
5000
|
-
}
|
|
5001
|
-
string = ("" + string).trim().toLowerCase();
|
|
5002
|
-
if (isFinite(Number(string))) {
|
|
5003
|
-
if ('px'.search(unitRegExp) >= 0) {
|
|
5004
|
-
return getOrCreateUnitValue(Number(string), 'px');
|
|
5005
|
-
} else if ('deg'.search(unitRegExp) >= 0) {
|
|
5006
|
-
return getOrCreateUnitValue(Number(string), 'deg');
|
|
5007
|
-
}
|
|
5008
|
-
}
|
|
5009
|
-
var matchedUnits = [];
|
|
5010
|
-
string = string.replace(unitRegExp, function (match) {
|
|
5011
|
-
matchedUnits.push(match);
|
|
5012
|
-
return 'U' + match;
|
|
5013
|
-
});
|
|
5014
|
-
var taggedUnitRegExp = 'U(' + unitRegExp.source + ')';
|
|
5015
|
-
return matchedUnits.map(function (unit) {
|
|
5016
|
-
return getOrCreateUnitValue(Number(string.replace(new RegExp('U' + unit, 'g'), '').replace(new RegExp(taggedUnitRegExp, 'g'), '*0')), unit);
|
|
5017
|
-
})[0];
|
|
5018
|
-
}
|
|
5019
|
-
/**
|
|
5020
|
-
* <length>
|
|
5021
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
5022
|
-
* length with only absolute unit, eg. 1px
|
|
5023
|
-
*/
|
|
5024
|
-
var parseLength = memoize(function (css) {
|
|
5025
|
-
return parseDimension(new RegExp('px', 'g'), css);
|
|
5026
|
-
});
|
|
5027
|
-
/**
|
|
5028
|
-
* <percentage>
|
|
5029
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
|
|
5030
|
-
*/
|
|
5031
|
-
var parserPercentage = memoize(function (css) {
|
|
5032
|
-
return parseDimension(new RegExp('%', 'g'), css);
|
|
5033
|
-
});
|
|
5034
|
-
/**
|
|
5035
|
-
* length with absolute or relative unit,
|
|
5036
|
-
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
5037
|
-
*
|
|
5038
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
5039
|
-
*/
|
|
5040
|
-
// export const parseLengthOrPercentage = memoize((css: string): CSSUnitValue => {
|
|
5041
|
-
// if (isNumber(css) || isFinite(Number(css))) {
|
|
5042
|
-
// return getOrCreateUnitValue(Number(css), 'px');
|
|
5043
|
-
// }
|
|
5044
|
-
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
5045
|
-
// });
|
|
5046
|
-
var parseLengthOrPercentage = function parseLengthOrPercentage(css) {
|
|
5047
|
-
if (util.isNumber(css) || isFinite(Number(css))) {
|
|
5048
|
-
return getOrCreateUnitValue(Number(css), 'px');
|
|
5049
|
-
// return Number(css);
|
|
5050
|
-
}
|
|
5051
|
-
|
|
5052
|
-
return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
|
|
5053
|
-
};
|
|
5054
|
-
var parseAngle = memoize(function (css) {
|
|
5055
|
-
return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
|
|
5056
|
-
});
|
|
5057
|
-
/**
|
|
5058
|
-
* merge CSSUnitValue
|
|
5059
|
-
*
|
|
5060
|
-
* @example
|
|
5061
|
-
* 10px + 20px = 30px
|
|
5062
|
-
* 10deg + 10rad
|
|
5063
|
-
* 10% + 20% = 30%
|
|
5064
|
-
*/
|
|
5065
|
-
function mergeDimensions(left, right, target, nonNegative, index) {
|
|
5066
|
-
if (index === void 0) {
|
|
5067
|
-
index = 0;
|
|
5068
|
-
}
|
|
5069
|
-
var unit = '';
|
|
5070
|
-
var leftValue = left.value || 0;
|
|
5071
|
-
var rightValue = right.value || 0;
|
|
5072
|
-
var canonicalUnit = toCanonicalUnit(left.unit);
|
|
5073
|
-
var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
|
|
5074
|
-
var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
|
|
5075
|
-
if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
|
|
5076
|
-
leftValue = leftCanonicalUnitValue.value;
|
|
5077
|
-
rightValue = rightCanonicalUnitValue.value;
|
|
5078
|
-
unit = unitTypeToString(left.unit);
|
|
5079
|
-
} else {
|
|
5080
|
-
// format '%' to 'px'
|
|
5081
|
-
if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
|
|
5082
|
-
leftValue = convertPercentUnit(left, index, target);
|
|
5083
|
-
rightValue = convertPercentUnit(right, index, target);
|
|
5084
|
-
unit = 'px';
|
|
5085
|
-
}
|
|
5086
|
-
}
|
|
5087
|
-
// // format 'rad' 'turn' to 'deg'
|
|
5088
|
-
// if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
|
|
5089
|
-
// leftValue = convertAngleUnit(left);
|
|
5090
|
-
// rightValue = convertAngleUnit(right);
|
|
5091
|
-
// unit = 'deg';
|
|
5092
|
-
// }
|
|
5093
|
-
return [leftValue, rightValue, function (value) {
|
|
5094
|
-
if (nonNegative) {
|
|
5095
|
-
value = Math.max(value, 0);
|
|
5096
|
-
}
|
|
5097
|
-
return value + unit;
|
|
5098
|
-
}];
|
|
5099
|
-
}
|
|
5100
|
-
function convertAngleUnit(value) {
|
|
5101
|
-
var deg = 0;
|
|
5102
|
-
if (value.unit === exports.UnitType.kDegrees) {
|
|
5103
|
-
deg = value.value;
|
|
5104
|
-
} else if (value.unit === exports.UnitType.kRadians) {
|
|
5105
|
-
deg = rad2deg(Number(value.value));
|
|
5106
|
-
} else if (value.unit === exports.UnitType.kTurns) {
|
|
5107
|
-
deg = turn2deg(Number(value.value));
|
|
5108
|
-
}
|
|
5109
|
-
return deg;
|
|
5110
|
-
}
|
|
5111
|
-
function parseDimensionArrayFormat(string, size) {
|
|
5112
|
-
var parsed;
|
|
5113
|
-
if (Array.isArray(string)) {
|
|
5114
|
-
// [1, '2px', 3]
|
|
5115
|
-
parsed = string.map(function (segment) {
|
|
5116
|
-
return Number(segment);
|
|
5117
|
-
});
|
|
5118
|
-
} else if (util.isString(string)) {
|
|
5119
|
-
parsed = string.split(' ').map(function (segment) {
|
|
5120
|
-
return Number(segment);
|
|
5121
|
-
});
|
|
5122
|
-
} else if (util.isNumber(string)) {
|
|
5123
|
-
parsed = [string];
|
|
5124
|
-
}
|
|
5125
|
-
if (size === 2) {
|
|
5126
|
-
if (parsed.length === 1) {
|
|
5127
|
-
return [parsed[0], parsed[0]];
|
|
5128
|
-
} else {
|
|
5129
|
-
return [parsed[0], parsed[1]];
|
|
5130
|
-
}
|
|
5131
|
-
} else {
|
|
5132
|
-
if (parsed.length === 1) {
|
|
5133
|
-
return [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
5134
|
-
} else if (parsed.length === 2) {
|
|
5135
|
-
return [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
5136
|
-
} else if (parsed.length === 3) {
|
|
5137
|
-
return [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
5138
|
-
} else {
|
|
5139
|
-
return [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
4714
|
+
} else {
|
|
4715
|
+
if (parsed.length === 1) {
|
|
4716
|
+
return [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
4717
|
+
} else if (parsed.length === 2) {
|
|
4718
|
+
return [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
4719
|
+
} else if (parsed.length === 3) {
|
|
4720
|
+
return [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
4721
|
+
} else {
|
|
4722
|
+
return [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
5140
4723
|
}
|
|
5141
4724
|
}
|
|
5142
4725
|
}
|
|
@@ -5171,17 +4754,16 @@ function parseDimensionArray(string) {
|
|
|
5171
4754
|
// ];
|
|
5172
4755
|
// }
|
|
5173
4756
|
function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
4757
|
+
if (valueWithUnit.value === 0) {
|
|
4758
|
+
return 0;
|
|
4759
|
+
}
|
|
5174
4760
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
5175
4761
|
return Number(valueWithUnit.value);
|
|
5176
4762
|
} else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
|
|
5177
4763
|
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() :
|
|
5178
4764
|
// : target.getGeometryBounds();
|
|
5179
4765
|
target.geometry.contentBounds;
|
|
5180
|
-
|
|
5181
|
-
if (!AABB.isEmpty(bounds)) {
|
|
5182
|
-
size = bounds.halfExtents[vec3Index] * 2;
|
|
5183
|
-
}
|
|
5184
|
-
return Number(valueWithUnit.value) / 100 * size;
|
|
4766
|
+
return valueWithUnit.value / 100 * bounds.halfExtents[vec3Index] * 2;
|
|
5185
4767
|
}
|
|
5186
4768
|
return 0;
|
|
5187
4769
|
}
|
|
@@ -5871,420 +5453,830 @@ function mergeTransforms(left, right, target) {
|
|
|
5871
5453
|
leftResult = rightResult;
|
|
5872
5454
|
rightResult = tmp;
|
|
5873
5455
|
}
|
|
5874
|
-
return [leftResult, rightResult, function (list) {
|
|
5875
|
-
return list.map(function (args, i) {
|
|
5876
|
-
var stringifiedArgs = args.map(function (arg, j) {
|
|
5877
|
-
return types[i][1][j](arg);
|
|
5878
|
-
}).join(',');
|
|
5879
|
-
if (types[i][0] === 'matrix' && stringifiedArgs.split(',').length === 16) {
|
|
5880
|
-
types[i][0] = 'matrix3d';
|
|
5881
|
-
}
|
|
5882
|
-
if (types[i][0] === 'matrix3d' && stringifiedArgs.split(',').length === 6) {
|
|
5883
|
-
types[i][0] = 'matrix';
|
|
5884
|
-
}
|
|
5885
|
-
return types[i][0] + '(' + stringifiedArgs + ')';
|
|
5886
|
-
}).join(' ');
|
|
5887
|
-
}];
|
|
5888
|
-
}
|
|
5456
|
+
return [leftResult, rightResult, function (list) {
|
|
5457
|
+
return list.map(function (args, i) {
|
|
5458
|
+
var stringifiedArgs = args.map(function (arg, j) {
|
|
5459
|
+
return types[i][1][j](arg);
|
|
5460
|
+
}).join(',');
|
|
5461
|
+
if (types[i][0] === 'matrix' && stringifiedArgs.split(',').length === 16) {
|
|
5462
|
+
types[i][0] = 'matrix3d';
|
|
5463
|
+
}
|
|
5464
|
+
if (types[i][0] === 'matrix3d' && stringifiedArgs.split(',').length === 6) {
|
|
5465
|
+
types[i][0] = 'matrix';
|
|
5466
|
+
}
|
|
5467
|
+
return types[i][0] + '(' + stringifiedArgs + ')';
|
|
5468
|
+
}).join(' ');
|
|
5469
|
+
}];
|
|
5470
|
+
}
|
|
5471
|
+
|
|
5472
|
+
/**
|
|
5473
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
5474
|
+
* eg. 'center' 'top left' '50px 50px'
|
|
5475
|
+
*/
|
|
5476
|
+
var parseTransformOrigin = memoize(function (value) {
|
|
5477
|
+
if (util.isString(value)) {
|
|
5478
|
+
if (value === 'text-anchor') {
|
|
5479
|
+
return [getOrCreateUnitValue(0, 'px'), getOrCreateUnitValue(0, 'px')];
|
|
5480
|
+
}
|
|
5481
|
+
var values = value.split(' ');
|
|
5482
|
+
if (values.length === 1) {
|
|
5483
|
+
if (values[0] === 'top' || values[0] === 'bottom') {
|
|
5484
|
+
// 'top' -> 'center top'
|
|
5485
|
+
values[1] = values[0];
|
|
5486
|
+
values[0] = 'center';
|
|
5487
|
+
} else {
|
|
5488
|
+
// '50px' -> '50px center'
|
|
5489
|
+
values[1] = 'center';
|
|
5490
|
+
}
|
|
5491
|
+
}
|
|
5492
|
+
if (values.length !== 2) {
|
|
5493
|
+
return null;
|
|
5494
|
+
}
|
|
5495
|
+
// eg. center bottom
|
|
5496
|
+
return [parseLengthOrPercentage(convertKeyword2Percent(values[0])), parseLengthOrPercentage(convertKeyword2Percent(values[1]))];
|
|
5497
|
+
} else {
|
|
5498
|
+
return [getOrCreateUnitValue(value[0] || 0, 'px'), getOrCreateUnitValue(value[1] || 0, 'px')];
|
|
5499
|
+
}
|
|
5500
|
+
});
|
|
5501
|
+
function convertKeyword2Percent(keyword) {
|
|
5502
|
+
if (keyword === 'center') {
|
|
5503
|
+
return '50%';
|
|
5504
|
+
} else if (keyword === 'left' || keyword === 'top') {
|
|
5505
|
+
return '0';
|
|
5506
|
+
} else if (keyword === 'right' || keyword === 'bottom') {
|
|
5507
|
+
return '100%';
|
|
5508
|
+
}
|
|
5509
|
+
return keyword;
|
|
5510
|
+
}
|
|
5511
|
+
|
|
5512
|
+
var CSSPropertyAngle = /*#__PURE__*/function () {
|
|
5513
|
+
function CSSPropertyAngle() {
|
|
5514
|
+
this.parser = parseAngle;
|
|
5515
|
+
this.parserWithCSSDisabled = null;
|
|
5516
|
+
this.mixer = mergeNumbers;
|
|
5517
|
+
}
|
|
5518
|
+
var _proto = CSSPropertyAngle.prototype;
|
|
5519
|
+
_proto.calculator = function calculator(name, oldParsed, parsed, object) {
|
|
5520
|
+
return convertAngleUnit(parsed);
|
|
5521
|
+
};
|
|
5522
|
+
return CSSPropertyAngle;
|
|
5523
|
+
}();
|
|
5524
|
+
|
|
5525
|
+
/**
|
|
5526
|
+
* clipPath / textPath / offsetPath
|
|
5527
|
+
*/
|
|
5528
|
+
var CSSPropertyClipPath = /*#__PURE__*/function () {
|
|
5529
|
+
function CSSPropertyClipPath() {}
|
|
5530
|
+
var _proto = CSSPropertyClipPath.prototype;
|
|
5531
|
+
_proto.calculator = function calculator(name, oldPath, newPath, object) {
|
|
5532
|
+
// unset
|
|
5533
|
+
if (newPath instanceof CSSKeywordValue) {
|
|
5534
|
+
newPath = null;
|
|
5535
|
+
}
|
|
5536
|
+
runtime.sceneGraphService.updateDisplayObjectDependency(name, oldPath, newPath, object);
|
|
5537
|
+
if (name === 'clipPath') {
|
|
5538
|
+
// should affect children
|
|
5539
|
+
object.forEach(function (leaf) {
|
|
5540
|
+
if (leaf.childNodes.length === 0) {
|
|
5541
|
+
runtime.sceneGraphService.dirtifyToRoot(leaf);
|
|
5542
|
+
}
|
|
5543
|
+
});
|
|
5544
|
+
}
|
|
5545
|
+
return newPath;
|
|
5546
|
+
};
|
|
5547
|
+
return CSSPropertyClipPath;
|
|
5548
|
+
}();
|
|
5549
|
+
|
|
5550
|
+
var CSSPropertyColor = /*#__PURE__*/function () {
|
|
5551
|
+
function CSSPropertyColor() {
|
|
5552
|
+
this.parser = parseColor;
|
|
5553
|
+
this.parserWithCSSDisabled = parseColor;
|
|
5554
|
+
this.mixer = mergeColors;
|
|
5555
|
+
}
|
|
5556
|
+
var _proto = CSSPropertyColor.prototype;
|
|
5557
|
+
_proto.calculator = function calculator(name, oldParsed, parsed, object) {
|
|
5558
|
+
if (parsed instanceof CSSKeywordValue) {
|
|
5559
|
+
// 'unset' 'none'
|
|
5560
|
+
return parsed.value === 'none' ? noneColor : transparentColor;
|
|
5561
|
+
}
|
|
5562
|
+
return parsed;
|
|
5563
|
+
};
|
|
5564
|
+
return CSSPropertyColor;
|
|
5565
|
+
}();
|
|
5566
|
+
|
|
5567
|
+
var CSSPropertyFilter = /*#__PURE__*/function () {
|
|
5568
|
+
function CSSPropertyFilter() {
|
|
5569
|
+
this.parser = parseFilter;
|
|
5570
|
+
}
|
|
5571
|
+
var _proto = CSSPropertyFilter.prototype;
|
|
5572
|
+
_proto.calculator = function calculator(name, oldParsed, parsed) {
|
|
5573
|
+
// unset or none
|
|
5574
|
+
if (parsed instanceof CSSKeywordValue) {
|
|
5575
|
+
return [];
|
|
5576
|
+
}
|
|
5577
|
+
return parsed;
|
|
5578
|
+
};
|
|
5579
|
+
return CSSPropertyFilter;
|
|
5580
|
+
}();
|
|
5889
5581
|
|
|
5582
|
+
function getFontSize(object) {
|
|
5583
|
+
var fontSize = object.parsedStyle.fontSize;
|
|
5584
|
+
return util.isNil(fontSize) ? null : fontSize;
|
|
5585
|
+
}
|
|
5890
5586
|
/**
|
|
5891
|
-
*
|
|
5892
|
-
* eg. 'center' 'top left' '50px 50px'
|
|
5587
|
+
* <length> & <percentage>
|
|
5893
5588
|
*/
|
|
5894
|
-
var
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5589
|
+
var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
|
|
5590
|
+
function CSSPropertyLengthOrPercentage() {
|
|
5591
|
+
this.parser = parseLengthOrPercentage;
|
|
5592
|
+
this.parserWithCSSDisabled = null;
|
|
5593
|
+
this.mixer = mergeNumbers;
|
|
5594
|
+
}
|
|
5595
|
+
var _proto = CSSPropertyLengthOrPercentage.prototype;
|
|
5596
|
+
/**
|
|
5597
|
+
* according to parent's bounds
|
|
5598
|
+
*
|
|
5599
|
+
* @example
|
|
5600
|
+
* CSS.percent(50) -> CSS.px(0.5 * parent.width)
|
|
5601
|
+
*/
|
|
5602
|
+
_proto.calculator = function calculator(name, oldParsed, computed, object, registry) {
|
|
5603
|
+
if (util.isNumber(computed)) {
|
|
5604
|
+
return computed;
|
|
5898
5605
|
}
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5902
|
-
|
|
5903
|
-
|
|
5904
|
-
|
|
5905
|
-
|
|
5906
|
-
|
|
5907
|
-
|
|
5606
|
+
if (CSSUnitValue.isRelativeUnit(computed.unit)) {
|
|
5607
|
+
if (computed.unit === exports.UnitType.kPercentage) {
|
|
5608
|
+
// TODO: merge dimensions
|
|
5609
|
+
return 0;
|
|
5610
|
+
} else if (computed.unit === exports.UnitType.kEms) {
|
|
5611
|
+
if (object.parentNode) {
|
|
5612
|
+
var fontSize = getFontSize(object.parentNode);
|
|
5613
|
+
if (fontSize) {
|
|
5614
|
+
fontSize *= computed.value;
|
|
5615
|
+
return fontSize;
|
|
5616
|
+
} else {
|
|
5617
|
+
registry.addUnresolveProperty(object, name);
|
|
5618
|
+
}
|
|
5619
|
+
} else {
|
|
5620
|
+
registry.addUnresolveProperty(object, name);
|
|
5621
|
+
}
|
|
5622
|
+
return 0;
|
|
5623
|
+
} else if (computed.unit === exports.UnitType.kRems) {
|
|
5624
|
+
var _object$ownerDocument;
|
|
5625
|
+
if (object === null || object === void 0 ? void 0 : (_object$ownerDocument = object.ownerDocument) === null || _object$ownerDocument === void 0 ? void 0 : _object$ownerDocument.documentElement) {
|
|
5626
|
+
var _fontSize = getFontSize(object.ownerDocument.documentElement);
|
|
5627
|
+
if (_fontSize) {
|
|
5628
|
+
_fontSize *= computed.value;
|
|
5629
|
+
return _fontSize;
|
|
5630
|
+
} else {
|
|
5631
|
+
registry.addUnresolveProperty(object, name);
|
|
5632
|
+
}
|
|
5633
|
+
} else {
|
|
5634
|
+
registry.addUnresolveProperty(object, name);
|
|
5635
|
+
}
|
|
5636
|
+
return 0;
|
|
5908
5637
|
}
|
|
5638
|
+
} else {
|
|
5639
|
+
// remove listener if exists
|
|
5640
|
+
// registry.unregisterParentGeometryBoundsChangedHandler(object, name);
|
|
5641
|
+
// return absolute value
|
|
5642
|
+
return computed.value;
|
|
5909
5643
|
}
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
|
|
5913
|
-
|
|
5914
|
-
|
|
5915
|
-
|
|
5916
|
-
|
|
5644
|
+
};
|
|
5645
|
+
return CSSPropertyLengthOrPercentage;
|
|
5646
|
+
}();
|
|
5647
|
+
|
|
5648
|
+
/**
|
|
5649
|
+
* format to Tuple2<CSSUnitValue>
|
|
5650
|
+
*
|
|
5651
|
+
* @example
|
|
5652
|
+
* rect.style.lineDash = 10;
|
|
5653
|
+
* rect.style.lineDash = [10, 10];
|
|
5654
|
+
* rect.style.lineDash = '10 10';
|
|
5655
|
+
*/
|
|
5656
|
+
var CSSPropertyLengthOrPercentage12 = /*#__PURE__*/function () {
|
|
5657
|
+
function CSSPropertyLengthOrPercentage12() {
|
|
5658
|
+
this.mixer = mergeNumberLists;
|
|
5917
5659
|
}
|
|
5918
|
-
|
|
5919
|
-
function
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
|
|
5660
|
+
var _proto = CSSPropertyLengthOrPercentage12.prototype;
|
|
5661
|
+
_proto.parser = function parser(radius) {
|
|
5662
|
+
var parsed = parseDimensionArray(util.isNumber(radius) ? [radius] : radius);
|
|
5663
|
+
var formatted;
|
|
5664
|
+
if (parsed.length === 1) {
|
|
5665
|
+
formatted = [parsed[0], parsed[0]];
|
|
5666
|
+
} else {
|
|
5667
|
+
formatted = [parsed[0], parsed[1]];
|
|
5668
|
+
}
|
|
5669
|
+
return formatted;
|
|
5670
|
+
};
|
|
5671
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
5672
|
+
return computed.map(function (c) {
|
|
5673
|
+
return c.value;
|
|
5674
|
+
});
|
|
5675
|
+
};
|
|
5676
|
+
return CSSPropertyLengthOrPercentage12;
|
|
5677
|
+
}();
|
|
5678
|
+
|
|
5679
|
+
/**
|
|
5680
|
+
* used in rounded rect
|
|
5681
|
+
*
|
|
5682
|
+
* @example
|
|
5683
|
+
* rect.style.radius = 10;
|
|
5684
|
+
* rect.style.radius = '10 10';
|
|
5685
|
+
* rect.style.radius = '10 10 10 10';
|
|
5686
|
+
*/
|
|
5687
|
+
var CSSPropertyLengthOrPercentage14 = /*#__PURE__*/function () {
|
|
5688
|
+
function CSSPropertyLengthOrPercentage14() {
|
|
5689
|
+
this.mixer = mergeNumberLists;
|
|
5926
5690
|
}
|
|
5927
|
-
|
|
5928
|
-
|
|
5691
|
+
var _proto = CSSPropertyLengthOrPercentage14.prototype;
|
|
5692
|
+
_proto.parser = function parser(radius) {
|
|
5693
|
+
var parsed = parseDimensionArray(util.isNumber(radius) ? [radius] : radius);
|
|
5694
|
+
var formatted;
|
|
5695
|
+
// format to Tuple<CSSUnitValue>
|
|
5696
|
+
if (parsed.length === 1) {
|
|
5697
|
+
formatted = [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
5698
|
+
} else if (parsed.length === 2) {
|
|
5699
|
+
formatted = [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
5700
|
+
} else if (parsed.length === 3) {
|
|
5701
|
+
formatted = [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
5702
|
+
} else {
|
|
5703
|
+
formatted = [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
5704
|
+
}
|
|
5705
|
+
return formatted;
|
|
5706
|
+
};
|
|
5707
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
5708
|
+
return computed.map(function (c) {
|
|
5709
|
+
return c.value;
|
|
5710
|
+
});
|
|
5711
|
+
};
|
|
5712
|
+
return CSSPropertyLengthOrPercentage14;
|
|
5713
|
+
}();
|
|
5929
5714
|
|
|
5930
|
-
|
|
5931
|
-
|
|
5932
|
-
|
|
5933
|
-
|
|
5934
|
-
|
|
5715
|
+
/**
|
|
5716
|
+
* local position
|
|
5717
|
+
*/
|
|
5718
|
+
var CSSPropertyLocalPosition = /*#__PURE__*/function (_CSSPropertyLengthOrP) {
|
|
5719
|
+
_inheritsLoose(CSSPropertyLocalPosition, _CSSPropertyLengthOrP);
|
|
5720
|
+
function CSSPropertyLocalPosition() {
|
|
5721
|
+
return _CSSPropertyLengthOrP.apply(this, arguments) || this;
|
|
5935
5722
|
}
|
|
5936
|
-
var _proto =
|
|
5937
|
-
|
|
5938
|
-
|
|
5723
|
+
var _proto = CSSPropertyLocalPosition.prototype;
|
|
5724
|
+
/**
|
|
5725
|
+
* update local position
|
|
5726
|
+
*/
|
|
5727
|
+
_proto.postProcessor = function postProcessor(object, attributes) {
|
|
5728
|
+
var x;
|
|
5729
|
+
var y;
|
|
5730
|
+
var z;
|
|
5731
|
+
switch (object.nodeName) {
|
|
5732
|
+
case exports.Shape.CIRCLE:
|
|
5733
|
+
case exports.Shape.ELLIPSE:
|
|
5734
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
5735
|
+
cx = _object$parsedStyle.cx,
|
|
5736
|
+
cy = _object$parsedStyle.cy;
|
|
5737
|
+
if (!util.isNil(cx)) {
|
|
5738
|
+
x = cx;
|
|
5739
|
+
}
|
|
5740
|
+
if (!util.isNil(cy)) {
|
|
5741
|
+
y = cy;
|
|
5742
|
+
}
|
|
5743
|
+
break;
|
|
5744
|
+
case exports.Shape.LINE:
|
|
5745
|
+
var _object$parsedStyle2 = object.parsedStyle,
|
|
5746
|
+
x1 = _object$parsedStyle2.x1,
|
|
5747
|
+
x2 = _object$parsedStyle2.x2,
|
|
5748
|
+
y1 = _object$parsedStyle2.y1,
|
|
5749
|
+
y2 = _object$parsedStyle2.y2;
|
|
5750
|
+
var minX = Math.min(x1, x2);
|
|
5751
|
+
var minY = Math.min(y1, y2);
|
|
5752
|
+
x = minX;
|
|
5753
|
+
y = minY;
|
|
5754
|
+
z = 0;
|
|
5755
|
+
break;
|
|
5756
|
+
case exports.Shape.RECT:
|
|
5757
|
+
case exports.Shape.IMAGE:
|
|
5758
|
+
case exports.Shape.GROUP:
|
|
5759
|
+
case exports.Shape.HTML:
|
|
5760
|
+
case exports.Shape.TEXT:
|
|
5761
|
+
case exports.Shape.MESH:
|
|
5762
|
+
if (!util.isNil(object.parsedStyle.x)) {
|
|
5763
|
+
x = object.parsedStyle.x;
|
|
5764
|
+
}
|
|
5765
|
+
if (!util.isNil(object.parsedStyle.y)) {
|
|
5766
|
+
y = object.parsedStyle.y;
|
|
5767
|
+
}
|
|
5768
|
+
break;
|
|
5769
|
+
}
|
|
5770
|
+
if (object.nodeName !== exports.Shape.PATH && object.nodeName !== exports.Shape.POLYLINE && object.nodeName !== exports.Shape.POLYGON) {
|
|
5771
|
+
object.parsedStyle.defX = x || 0;
|
|
5772
|
+
object.parsedStyle.defY = y || 0;
|
|
5773
|
+
}
|
|
5774
|
+
var needResetLocalPosition = !util.isNil(x) || !util.isNil(y) || !util.isNil(z);
|
|
5775
|
+
// only if `transform` won't be processed later
|
|
5776
|
+
if (needResetLocalPosition && attributes.indexOf('transform') === -1) {
|
|
5777
|
+
// account for current transform if needed
|
|
5778
|
+
var transform = object.parsedStyle.transform;
|
|
5779
|
+
if (transform && transform.length) {
|
|
5780
|
+
parsedTransformToMat4(transform, object);
|
|
5781
|
+
} else {
|
|
5782
|
+
var _object$getLocalPosit = object.getLocalPosition(),
|
|
5783
|
+
ox = _object$getLocalPosit[0],
|
|
5784
|
+
oy = _object$getLocalPosit[1],
|
|
5785
|
+
oz = _object$getLocalPosit[2];
|
|
5786
|
+
object.setLocalPosition(util.isNil(x) ? ox : x, util.isNil(y) ? oy : y, util.isNil(z) ? oz : z);
|
|
5787
|
+
}
|
|
5788
|
+
}
|
|
5939
5789
|
};
|
|
5940
|
-
return
|
|
5941
|
-
}();
|
|
5790
|
+
return CSSPropertyLocalPosition;
|
|
5791
|
+
}(CSSPropertyLengthOrPercentage);
|
|
5942
5792
|
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
var _proto = CSSPropertyClipPath.prototype;
|
|
5949
|
-
_proto.calculator = function calculator(name, oldPath, newPath, object) {
|
|
5793
|
+
var CSSPropertyMarker = /*#__PURE__*/function () {
|
|
5794
|
+
function CSSPropertyMarker() {}
|
|
5795
|
+
var _proto = CSSPropertyMarker.prototype;
|
|
5796
|
+
_proto.calculator = function calculator(name, oldMarker, newMarker, object) {
|
|
5797
|
+
var _newMarker;
|
|
5950
5798
|
// unset
|
|
5951
|
-
if (
|
|
5952
|
-
|
|
5799
|
+
if (newMarker instanceof CSSKeywordValue) {
|
|
5800
|
+
newMarker = null;
|
|
5953
5801
|
}
|
|
5954
|
-
|
|
5955
|
-
if (
|
|
5956
|
-
// should
|
|
5957
|
-
|
|
5958
|
-
if (leaf.childNodes.length === 0) {
|
|
5959
|
-
runtime.sceneGraphService.dirtifyToRoot(leaf);
|
|
5960
|
-
}
|
|
5961
|
-
});
|
|
5802
|
+
var cloned = (_newMarker = newMarker) === null || _newMarker === void 0 ? void 0 : _newMarker.cloneNode(true);
|
|
5803
|
+
if (cloned) {
|
|
5804
|
+
// FIXME: SVG should not inherit parent's style, add a flag here
|
|
5805
|
+
cloned.style.isMarker = true;
|
|
5962
5806
|
}
|
|
5963
|
-
return
|
|
5807
|
+
return cloned;
|
|
5964
5808
|
};
|
|
5965
|
-
return
|
|
5809
|
+
return CSSPropertyMarker;
|
|
5966
5810
|
}();
|
|
5967
5811
|
|
|
5968
|
-
var
|
|
5969
|
-
function
|
|
5970
|
-
this.
|
|
5971
|
-
this.
|
|
5972
|
-
this.
|
|
5812
|
+
var CSSPropertyNumber = /*#__PURE__*/function () {
|
|
5813
|
+
function CSSPropertyNumber() {
|
|
5814
|
+
this.mixer = mergeNumbers;
|
|
5815
|
+
this.parser = parseNumber;
|
|
5816
|
+
this.parserWithCSSDisabled = null;
|
|
5973
5817
|
}
|
|
5974
|
-
var _proto =
|
|
5975
|
-
_proto.calculator = function calculator(name, oldParsed,
|
|
5976
|
-
|
|
5977
|
-
// 'unset' 'none'
|
|
5978
|
-
return parsed.value === 'none' ? noneColor : transparentColor;
|
|
5979
|
-
}
|
|
5980
|
-
return parsed;
|
|
5818
|
+
var _proto = CSSPropertyNumber.prototype;
|
|
5819
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
5820
|
+
return computed.value;
|
|
5981
5821
|
};
|
|
5982
|
-
return
|
|
5822
|
+
return CSSPropertyNumber;
|
|
5983
5823
|
}();
|
|
5984
5824
|
|
|
5985
|
-
var
|
|
5986
|
-
function
|
|
5987
|
-
this.parser =
|
|
5825
|
+
var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
5826
|
+
function CSSPropertyOffsetDistance() {
|
|
5827
|
+
this.parser = parseNumber;
|
|
5828
|
+
this.parserWithCSSDisabled = null;
|
|
5829
|
+
this.mixer = clampedMergeNumbers(0, 1);
|
|
5988
5830
|
}
|
|
5989
|
-
var _proto =
|
|
5990
|
-
_proto.calculator = function calculator(name, oldParsed,
|
|
5991
|
-
|
|
5992
|
-
|
|
5993
|
-
|
|
5831
|
+
var _proto = CSSPropertyOffsetDistance.prototype;
|
|
5832
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
5833
|
+
return computed.value;
|
|
5834
|
+
};
|
|
5835
|
+
_proto.postProcessor = function postProcessor(object) {
|
|
5836
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
5837
|
+
offsetPath = _object$parsedStyle.offsetPath,
|
|
5838
|
+
offsetDistance = _object$parsedStyle.offsetDistance;
|
|
5839
|
+
if (!offsetPath) {
|
|
5840
|
+
return;
|
|
5841
|
+
}
|
|
5842
|
+
var nodeName = offsetPath.nodeName;
|
|
5843
|
+
if (nodeName === exports.Shape.LINE || nodeName === exports.Shape.PATH || nodeName === exports.Shape.POLYLINE) {
|
|
5844
|
+
// set position in world space
|
|
5845
|
+
var point = offsetPath.getPoint(offsetDistance);
|
|
5846
|
+
if (point) {
|
|
5847
|
+
object.parsedStyle.defX = point.x;
|
|
5848
|
+
object.parsedStyle.defY = point.y;
|
|
5849
|
+
object.setLocalPosition(point.x, point.y);
|
|
5850
|
+
}
|
|
5994
5851
|
}
|
|
5995
|
-
return parsed;
|
|
5996
5852
|
};
|
|
5997
|
-
return
|
|
5853
|
+
return CSSPropertyOffsetDistance;
|
|
5998
5854
|
}();
|
|
5999
5855
|
|
|
6000
|
-
function getFontSize(object) {
|
|
6001
|
-
var fontSize = object.parsedStyle.fontSize;
|
|
6002
|
-
return util.isNil(fontSize) ? null : fontSize;
|
|
6003
|
-
}
|
|
6004
5856
|
/**
|
|
6005
|
-
*
|
|
5857
|
+
* opacity
|
|
6006
5858
|
*/
|
|
6007
|
-
var
|
|
6008
|
-
function
|
|
6009
|
-
this.parser =
|
|
5859
|
+
var CSSPropertyOpacity = /*#__PURE__*/function () {
|
|
5860
|
+
function CSSPropertyOpacity() {
|
|
5861
|
+
this.parser = parseNumber;
|
|
6010
5862
|
this.parserWithCSSDisabled = null;
|
|
6011
|
-
this.mixer =
|
|
5863
|
+
this.mixer = clampedMergeNumbers(0, 1);
|
|
6012
5864
|
}
|
|
6013
|
-
var _proto =
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
5865
|
+
var _proto = CSSPropertyOpacity.prototype;
|
|
5866
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
5867
|
+
return computed.value;
|
|
5868
|
+
};
|
|
5869
|
+
return CSSPropertyOpacity;
|
|
5870
|
+
}();
|
|
5871
|
+
|
|
5872
|
+
/**
|
|
5873
|
+
* Axis-Aligned Bounding Box
|
|
5874
|
+
* 为了便于后续 Frustum Culling,通过查找表定义 p-vertex 和 n-vertex
|
|
5875
|
+
* @see https://github.com/antvis/GWebGPUEngine/issues/3
|
|
5876
|
+
*/
|
|
5877
|
+
var AABB = /*#__PURE__*/function () {
|
|
5878
|
+
function AABB() {
|
|
5879
|
+
this.center = [0, 0, 0];
|
|
5880
|
+
this.halfExtents = [0, 0, 0];
|
|
5881
|
+
this.min = [0, 0, 0];
|
|
5882
|
+
this.max = [0, 0, 0];
|
|
5883
|
+
}
|
|
5884
|
+
AABB.isEmpty = function isEmpty(aabb) {
|
|
5885
|
+
return !aabb || aabb.halfExtents[0] === 0 && aabb.halfExtents[1] === 0 && aabb.halfExtents[2] === 0;
|
|
5886
|
+
};
|
|
5887
|
+
var _proto = AABB.prototype;
|
|
5888
|
+
// center: vec3 = vec3.create();
|
|
5889
|
+
// halfExtents: vec3 = vec3.create();
|
|
5890
|
+
// min: vec3 = vec3.create();
|
|
5891
|
+
// max: vec3 = vec3.create();
|
|
5892
|
+
_proto.update = function update(center, halfExtents) {
|
|
5893
|
+
copyVec3(this.center, center);
|
|
5894
|
+
copyVec3(this.halfExtents, halfExtents);
|
|
5895
|
+
subVec3(this.min, this.center, this.halfExtents);
|
|
5896
|
+
addVec3(this.max, this.center, this.halfExtents);
|
|
5897
|
+
// vec3.copy(this.center, center);
|
|
5898
|
+
// vec3.copy(this.halfExtents, halfExtents);
|
|
5899
|
+
// vec3.sub(this.min, this.center, this.halfExtents);
|
|
5900
|
+
// vec3.add(this.max, this.center, this.halfExtents);
|
|
5901
|
+
};
|
|
5902
|
+
_proto.setMinMax = function setMinMax(min, max) {
|
|
5903
|
+
// vec3.add(this.center, max, min);
|
|
5904
|
+
// vec3.scale(this.center, this.center, 0.5);
|
|
5905
|
+
// vec3.sub(this.halfExtents, max, min);
|
|
5906
|
+
// vec3.scale(this.halfExtents, this.halfExtents, 0.5);
|
|
5907
|
+
// vec3.copy(this.min, min);
|
|
5908
|
+
// vec3.copy(this.max, max);
|
|
5909
|
+
addVec3(this.center, max, min);
|
|
5910
|
+
scaleVec3(this.center, this.center, 0.5);
|
|
5911
|
+
subVec3(this.halfExtents, max, min);
|
|
5912
|
+
scaleVec3(this.halfExtents, this.halfExtents, 0.5);
|
|
5913
|
+
copyVec3(this.min, min);
|
|
5914
|
+
copyVec3(this.max, max);
|
|
5915
|
+
};
|
|
5916
|
+
_proto.getMin = function getMin() {
|
|
5917
|
+
return this.min;
|
|
5918
|
+
};
|
|
5919
|
+
_proto.getMax = function getMax() {
|
|
5920
|
+
return this.max;
|
|
5921
|
+
};
|
|
5922
|
+
_proto.add = function add(aabb) {
|
|
5923
|
+
if (AABB.isEmpty(aabb)) {
|
|
5924
|
+
return;
|
|
6023
5925
|
}
|
|
6024
|
-
if (
|
|
6025
|
-
|
|
6026
|
-
|
|
6027
|
-
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
// registry.unregisterParentGeometryBoundsChangedHandler(object, name);
|
|
6059
|
-
// return absolute value
|
|
6060
|
-
return computed.value;
|
|
5926
|
+
if (AABB.isEmpty(this)) {
|
|
5927
|
+
this.setMinMax(aabb.getMin(), aabb.getMax());
|
|
5928
|
+
return;
|
|
5929
|
+
}
|
|
5930
|
+
var tc = this.center;
|
|
5931
|
+
var tcx = tc[0];
|
|
5932
|
+
var tcy = tc[1];
|
|
5933
|
+
var tcz = tc[2];
|
|
5934
|
+
var th = this.halfExtents;
|
|
5935
|
+
var thx = th[0];
|
|
5936
|
+
var thy = th[1];
|
|
5937
|
+
var thz = th[2];
|
|
5938
|
+
var tminx = tcx - thx;
|
|
5939
|
+
var tmaxx = tcx + thx;
|
|
5940
|
+
var tminy = tcy - thy;
|
|
5941
|
+
var tmaxy = tcy + thy;
|
|
5942
|
+
var tminz = tcz - thz;
|
|
5943
|
+
var tmaxz = tcz + thz;
|
|
5944
|
+
var oc = aabb.center;
|
|
5945
|
+
var ocx = oc[0];
|
|
5946
|
+
var ocy = oc[1];
|
|
5947
|
+
var ocz = oc[2];
|
|
5948
|
+
var oh = aabb.halfExtents;
|
|
5949
|
+
var ohx = oh[0];
|
|
5950
|
+
var ohy = oh[1];
|
|
5951
|
+
var ohz = oh[2];
|
|
5952
|
+
var ominx = ocx - ohx;
|
|
5953
|
+
var omaxx = ocx + ohx;
|
|
5954
|
+
var ominy = ocy - ohy;
|
|
5955
|
+
var omaxy = ocy + ohy;
|
|
5956
|
+
var ominz = ocz - ohz;
|
|
5957
|
+
var omaxz = ocz + ohz;
|
|
5958
|
+
if (ominx < tminx) {
|
|
5959
|
+
tminx = ominx;
|
|
6061
5960
|
}
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
}();
|
|
6065
|
-
|
|
6066
|
-
/**
|
|
6067
|
-
* format to Tuple2<CSSUnitValue>
|
|
6068
|
-
*
|
|
6069
|
-
* @example
|
|
6070
|
-
* rect.style.lineDash = 10;
|
|
6071
|
-
* rect.style.lineDash = [10, 10];
|
|
6072
|
-
* rect.style.lineDash = '10 10';
|
|
6073
|
-
*/
|
|
6074
|
-
var CSSPropertyLengthOrPercentage12 = /*#__PURE__*/function () {
|
|
6075
|
-
function CSSPropertyLengthOrPercentage12() {
|
|
6076
|
-
this.mixer = mergeNumberLists;
|
|
6077
|
-
}
|
|
6078
|
-
var _proto = CSSPropertyLengthOrPercentage12.prototype;
|
|
6079
|
-
_proto.parser = function parser(radius) {
|
|
6080
|
-
var parsed = parseDimensionArray(util.isNumber(radius) ? [radius] : radius);
|
|
6081
|
-
var formatted;
|
|
6082
|
-
if (parsed.length === 1) {
|
|
6083
|
-
formatted = [parsed[0], parsed[0]];
|
|
6084
|
-
} else {
|
|
6085
|
-
formatted = [parsed[0], parsed[1]];
|
|
5961
|
+
if (omaxx > tmaxx) {
|
|
5962
|
+
tmaxx = omaxx;
|
|
6086
5963
|
}
|
|
6087
|
-
|
|
6088
|
-
|
|
6089
|
-
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
6090
|
-
return computed.map(function (c) {
|
|
6091
|
-
return c.value;
|
|
6092
|
-
});
|
|
6093
|
-
};
|
|
6094
|
-
return CSSPropertyLengthOrPercentage12;
|
|
6095
|
-
}();
|
|
6096
|
-
|
|
6097
|
-
/**
|
|
6098
|
-
* used in rounded rect
|
|
6099
|
-
*
|
|
6100
|
-
* @example
|
|
6101
|
-
* rect.style.radius = 10;
|
|
6102
|
-
* rect.style.radius = '10 10';
|
|
6103
|
-
* rect.style.radius = '10 10 10 10';
|
|
6104
|
-
*/
|
|
6105
|
-
var CSSPropertyLengthOrPercentage14 = /*#__PURE__*/function () {
|
|
6106
|
-
function CSSPropertyLengthOrPercentage14() {
|
|
6107
|
-
this.mixer = mergeNumberLists;
|
|
6108
|
-
}
|
|
6109
|
-
var _proto = CSSPropertyLengthOrPercentage14.prototype;
|
|
6110
|
-
_proto.parser = function parser(radius) {
|
|
6111
|
-
var parsed = parseDimensionArray(util.isNumber(radius) ? [radius] : radius);
|
|
6112
|
-
var formatted;
|
|
6113
|
-
// format to Tuple<CSSUnitValue>
|
|
6114
|
-
if (parsed.length === 1) {
|
|
6115
|
-
formatted = [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
6116
|
-
} else if (parsed.length === 2) {
|
|
6117
|
-
formatted = [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
6118
|
-
} else if (parsed.length === 3) {
|
|
6119
|
-
formatted = [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
6120
|
-
} else {
|
|
6121
|
-
formatted = [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
5964
|
+
if (ominy < tminy) {
|
|
5965
|
+
tminy = ominy;
|
|
6122
5966
|
}
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
6126
|
-
return computed.map(function (c) {
|
|
6127
|
-
return c.value;
|
|
6128
|
-
});
|
|
6129
|
-
};
|
|
6130
|
-
return CSSPropertyLengthOrPercentage14;
|
|
6131
|
-
}();
|
|
6132
|
-
|
|
6133
|
-
/**
|
|
6134
|
-
* local position
|
|
6135
|
-
*/
|
|
6136
|
-
var CSSPropertyLocalPosition = /*#__PURE__*/function (_CSSPropertyLengthOrP) {
|
|
6137
|
-
_inheritsLoose(CSSPropertyLocalPosition, _CSSPropertyLengthOrP);
|
|
6138
|
-
function CSSPropertyLocalPosition() {
|
|
6139
|
-
return _CSSPropertyLengthOrP.apply(this, arguments) || this;
|
|
6140
|
-
}
|
|
6141
|
-
var _proto = CSSPropertyLocalPosition.prototype;
|
|
6142
|
-
/**
|
|
6143
|
-
* update local position
|
|
6144
|
-
*/
|
|
6145
|
-
_proto.postProcessor = function postProcessor(object, attributes) {
|
|
6146
|
-
var x;
|
|
6147
|
-
var y;
|
|
6148
|
-
var z;
|
|
6149
|
-
switch (object.nodeName) {
|
|
6150
|
-
case exports.Shape.CIRCLE:
|
|
6151
|
-
case exports.Shape.ELLIPSE:
|
|
6152
|
-
var _object$parsedStyle = object.parsedStyle,
|
|
6153
|
-
cx = _object$parsedStyle.cx,
|
|
6154
|
-
cy = _object$parsedStyle.cy;
|
|
6155
|
-
if (!util.isNil(cx)) {
|
|
6156
|
-
x = cx;
|
|
6157
|
-
}
|
|
6158
|
-
if (!util.isNil(cy)) {
|
|
6159
|
-
y = cy;
|
|
6160
|
-
}
|
|
6161
|
-
break;
|
|
6162
|
-
case exports.Shape.LINE:
|
|
6163
|
-
var _object$parsedStyle2 = object.parsedStyle,
|
|
6164
|
-
x1 = _object$parsedStyle2.x1,
|
|
6165
|
-
x2 = _object$parsedStyle2.x2,
|
|
6166
|
-
y1 = _object$parsedStyle2.y1,
|
|
6167
|
-
y2 = _object$parsedStyle2.y2;
|
|
6168
|
-
var minX = Math.min(x1, x2);
|
|
6169
|
-
var minY = Math.min(y1, y2);
|
|
6170
|
-
x = minX;
|
|
6171
|
-
y = minY;
|
|
6172
|
-
z = 0;
|
|
6173
|
-
break;
|
|
6174
|
-
case exports.Shape.RECT:
|
|
6175
|
-
case exports.Shape.IMAGE:
|
|
6176
|
-
case exports.Shape.GROUP:
|
|
6177
|
-
case exports.Shape.HTML:
|
|
6178
|
-
case exports.Shape.TEXT:
|
|
6179
|
-
case exports.Shape.MESH:
|
|
6180
|
-
if (!util.isNil(object.parsedStyle.x)) {
|
|
6181
|
-
x = object.parsedStyle.x;
|
|
6182
|
-
}
|
|
6183
|
-
if (!util.isNil(object.parsedStyle.y)) {
|
|
6184
|
-
y = object.parsedStyle.y;
|
|
6185
|
-
}
|
|
6186
|
-
break;
|
|
5967
|
+
if (omaxy > tmaxy) {
|
|
5968
|
+
tmaxy = omaxy;
|
|
6187
5969
|
}
|
|
6188
|
-
if (
|
|
6189
|
-
|
|
6190
|
-
object.parsedStyle.defY = y || 0;
|
|
5970
|
+
if (ominz < tminz) {
|
|
5971
|
+
tminz = ominz;
|
|
6191
5972
|
}
|
|
6192
|
-
|
|
6193
|
-
|
|
6194
|
-
if (needResetLocalPosition && attributes.indexOf('transform') === -1) {
|
|
6195
|
-
// account for current transform if needed
|
|
6196
|
-
var transform = object.parsedStyle.transform;
|
|
6197
|
-
if (transform && transform.length) {
|
|
6198
|
-
parsedTransformToMat4(transform, object);
|
|
6199
|
-
} else {
|
|
6200
|
-
var _object$getLocalPosit = object.getLocalPosition(),
|
|
6201
|
-
ox = _object$getLocalPosit[0],
|
|
6202
|
-
oy = _object$getLocalPosit[1],
|
|
6203
|
-
oz = _object$getLocalPosit[2];
|
|
6204
|
-
object.setLocalPosition(util.isNil(x) ? ox : x, util.isNil(y) ? oy : y, util.isNil(z) ? oz : z);
|
|
6205
|
-
}
|
|
5973
|
+
if (omaxz > tmaxz) {
|
|
5974
|
+
tmaxz = omaxz;
|
|
6206
5975
|
}
|
|
5976
|
+
tc[0] = (tminx + tmaxx) * 0.5;
|
|
5977
|
+
tc[1] = (tminy + tmaxy) * 0.5;
|
|
5978
|
+
tc[2] = (tminz + tmaxz) * 0.5;
|
|
5979
|
+
th[0] = (tmaxx - tminx) * 0.5;
|
|
5980
|
+
th[1] = (tmaxy - tminy) * 0.5;
|
|
5981
|
+
th[2] = (tmaxz - tminz) * 0.5;
|
|
5982
|
+
this.min[0] = tminx;
|
|
5983
|
+
this.min[1] = tminy;
|
|
5984
|
+
this.min[2] = tminz;
|
|
5985
|
+
this.max[0] = tmaxx;
|
|
5986
|
+
this.max[1] = tmaxy;
|
|
5987
|
+
this.max[2] = tmaxz;
|
|
6207
5988
|
};
|
|
6208
|
-
|
|
6209
|
-
|
|
6210
|
-
|
|
6211
|
-
var
|
|
6212
|
-
|
|
6213
|
-
|
|
6214
|
-
|
|
6215
|
-
var
|
|
6216
|
-
|
|
6217
|
-
|
|
6218
|
-
|
|
5989
|
+
_proto.setFromTransformedAABB = function setFromTransformedAABB(aabb, m) {
|
|
5990
|
+
var bc = this.center;
|
|
5991
|
+
var br = this.halfExtents;
|
|
5992
|
+
var ac = aabb.center;
|
|
5993
|
+
var ar = aabb.halfExtents;
|
|
5994
|
+
var mx0 = m[0];
|
|
5995
|
+
var mx1 = m[4];
|
|
5996
|
+
var mx2 = m[8];
|
|
5997
|
+
var my0 = m[1];
|
|
5998
|
+
var my1 = m[5];
|
|
5999
|
+
var my2 = m[9];
|
|
6000
|
+
var mz0 = m[2];
|
|
6001
|
+
var mz1 = m[6];
|
|
6002
|
+
var mz2 = m[10];
|
|
6003
|
+
var mx0a = Math.abs(mx0);
|
|
6004
|
+
var mx1a = Math.abs(mx1);
|
|
6005
|
+
var mx2a = Math.abs(mx2);
|
|
6006
|
+
var my0a = Math.abs(my0);
|
|
6007
|
+
var my1a = Math.abs(my1);
|
|
6008
|
+
var my2a = Math.abs(my2);
|
|
6009
|
+
var mz0a = Math.abs(mz0);
|
|
6010
|
+
var mz1a = Math.abs(mz1);
|
|
6011
|
+
var mz2a = Math.abs(mz2);
|
|
6012
|
+
bc[0] = m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2];
|
|
6013
|
+
bc[1] = m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2];
|
|
6014
|
+
bc[2] = m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2];
|
|
6015
|
+
// vec3.set(
|
|
6016
|
+
// bc,
|
|
6017
|
+
// m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2],
|
|
6018
|
+
// m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2],
|
|
6019
|
+
// m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2],
|
|
6020
|
+
// );
|
|
6021
|
+
br[0] = mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2];
|
|
6022
|
+
br[1] = my0a * ar[0] + my1a * ar[1] + my2a * ar[2];
|
|
6023
|
+
br[2] = mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2];
|
|
6024
|
+
// vec3.set(
|
|
6025
|
+
// br,
|
|
6026
|
+
// mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2],
|
|
6027
|
+
// my0a * ar[0] + my1a * ar[1] + my2a * ar[2],
|
|
6028
|
+
// mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2],
|
|
6029
|
+
// );
|
|
6030
|
+
// this.min = vec3.sub(this.min, bc, br);
|
|
6031
|
+
// this.max = vec3.add(this.max, bc, br);
|
|
6032
|
+
subVec3(this.min, bc, br);
|
|
6033
|
+
addVec3(this.max, bc, br);
|
|
6034
|
+
};
|
|
6035
|
+
_proto.intersects = function intersects(aabb) {
|
|
6036
|
+
var aMax = this.getMax();
|
|
6037
|
+
var aMin = this.getMin();
|
|
6038
|
+
var bMax = aabb.getMax();
|
|
6039
|
+
var bMin = aabb.getMin();
|
|
6040
|
+
return aMin[0] <= bMax[0] && aMax[0] >= bMin[0] && aMin[1] <= bMax[1] && aMax[1] >= bMin[1] && aMin[2] <= bMax[2] && aMax[2] >= bMin[2];
|
|
6041
|
+
};
|
|
6042
|
+
_proto.intersection = function intersection(aabb) {
|
|
6043
|
+
if (!this.intersects(aabb)) {
|
|
6044
|
+
return null;
|
|
6045
|
+
}
|
|
6046
|
+
var intersection = new AABB();
|
|
6047
|
+
// const min = vec3.max(vec3.create(), this.getMin(), aabb.getMin());
|
|
6048
|
+
// const max = vec3.min(vec3.create(), this.getMax(), aabb.getMax());
|
|
6049
|
+
var min = maxVec3([0, 0, 0], this.getMin(), aabb.getMin());
|
|
6050
|
+
var max = minVec3([0, 0, 0], this.getMax(), aabb.getMax());
|
|
6051
|
+
intersection.setMinMax(min, max);
|
|
6052
|
+
return intersection;
|
|
6053
|
+
}
|
|
6054
|
+
// containsPoint(point: vec3) {
|
|
6055
|
+
// const min = this.getMin();
|
|
6056
|
+
// const max = this.getMax();
|
|
6057
|
+
// return !(
|
|
6058
|
+
// point[0] < min[0] ||
|
|
6059
|
+
// point[0] > max[0] ||
|
|
6060
|
+
// point[1] < min[1] ||
|
|
6061
|
+
// point[1] > max[1] ||
|
|
6062
|
+
// point[2] < min[2] ||
|
|
6063
|
+
// point[2] > max[2]
|
|
6064
|
+
// );
|
|
6065
|
+
// }
|
|
6066
|
+
/**
|
|
6067
|
+
* get n-vertex
|
|
6068
|
+
* @param plane plane of CullingVolume
|
|
6069
|
+
*/;
|
|
6070
|
+
_proto.getNegativeFarPoint = function getNegativeFarPoint(plane) {
|
|
6071
|
+
if (plane.pnVertexFlag === 0x111) {
|
|
6072
|
+
return copyVec3([0, 0, 0], this.min);
|
|
6073
|
+
// return vec3.copy(vec3.create(), this.min);
|
|
6074
|
+
} else if (plane.pnVertexFlag === 0x110) {
|
|
6075
|
+
return [this.min[0], this.min[1], this.max[2]];
|
|
6076
|
+
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
6077
|
+
} else if (plane.pnVertexFlag === 0x101) {
|
|
6078
|
+
return [this.min[0], this.max[1], this.min[2]];
|
|
6079
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
6080
|
+
} else if (plane.pnVertexFlag === 0x100) {
|
|
6081
|
+
return [this.min[0], this.max[1], this.max[2]];
|
|
6082
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
6083
|
+
} else if (plane.pnVertexFlag === 0x011) {
|
|
6084
|
+
return [this.max[0], this.min[1], this.min[2]];
|
|
6085
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
6086
|
+
} else if (plane.pnVertexFlag === 0x010) {
|
|
6087
|
+
return [this.max[0], this.min[1], this.max[2]];
|
|
6088
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
6089
|
+
} else if (plane.pnVertexFlag === 0x001) {
|
|
6090
|
+
return [this.max[0], this.max[1], this.min[2]];
|
|
6091
|
+
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
6092
|
+
} else {
|
|
6093
|
+
return [this.max[0], this.max[1], this.max[2]];
|
|
6094
|
+
// return vec3.fromValues(this.max[0], this.max[1], this.max[2]);
|
|
6219
6095
|
}
|
|
6220
|
-
|
|
6221
|
-
|
|
6222
|
-
|
|
6223
|
-
|
|
6096
|
+
}
|
|
6097
|
+
/**
|
|
6098
|
+
* get p-vertex
|
|
6099
|
+
* @param plane plane of CullingVolume
|
|
6100
|
+
*/;
|
|
6101
|
+
_proto.getPositiveFarPoint = function getPositiveFarPoint(plane) {
|
|
6102
|
+
if (plane.pnVertexFlag === 0x111) {
|
|
6103
|
+
return copyVec3([0, 0, 0], this.max);
|
|
6104
|
+
// return vec3.copy(vec3.create(), this.max);
|
|
6105
|
+
} else if (plane.pnVertexFlag === 0x110) {
|
|
6106
|
+
return [this.max[0], this.max[1], this.min[2]];
|
|
6107
|
+
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
6108
|
+
} else if (plane.pnVertexFlag === 0x101) {
|
|
6109
|
+
return [this.max[0], this.min[1], this.max[2]];
|
|
6110
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
6111
|
+
} else if (plane.pnVertexFlag === 0x100) {
|
|
6112
|
+
return [this.max[0], this.min[1], this.min[2]];
|
|
6113
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
6114
|
+
} else if (plane.pnVertexFlag === 0x011) {
|
|
6115
|
+
return [this.min[0], this.max[1], this.max[2]];
|
|
6116
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
6117
|
+
} else if (plane.pnVertexFlag === 0x010) {
|
|
6118
|
+
return [this.min[0], this.max[1], this.min[2]];
|
|
6119
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
6120
|
+
} else if (plane.pnVertexFlag === 0x001) {
|
|
6121
|
+
return [this.min[0], this.min[1], this.max[2]];
|
|
6122
|
+
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
6123
|
+
} else {
|
|
6124
|
+
return [this.min[0], this.min[1], this.min[2]];
|
|
6125
|
+
// return vec3.fromValues(this.min[0], this.min[1], this.min[2]);
|
|
6224
6126
|
}
|
|
6225
|
-
return cloned;
|
|
6226
6127
|
};
|
|
6227
|
-
return
|
|
6128
|
+
return AABB;
|
|
6228
6129
|
}();
|
|
6229
6130
|
|
|
6230
|
-
var
|
|
6231
|
-
|
|
6232
|
-
|
|
6233
|
-
|
|
6234
|
-
|
|
6131
|
+
var Plane = /*#__PURE__*/function () {
|
|
6132
|
+
/**
|
|
6133
|
+
* lookup table for p-vertex & n-vertex when doing frustum culling
|
|
6134
|
+
*/
|
|
6135
|
+
|
|
6136
|
+
function Plane(distance, normal) {
|
|
6137
|
+
this.distance = void 0;
|
|
6138
|
+
this.normal = void 0;
|
|
6139
|
+
this.pnVertexFlag = void 0;
|
|
6140
|
+
this.distance = distance || 0;
|
|
6141
|
+
this.normal = normal || glMatrix.vec3.fromValues(0, 1, 0);
|
|
6142
|
+
this.updatePNVertexFlag();
|
|
6235
6143
|
}
|
|
6236
|
-
var _proto =
|
|
6237
|
-
_proto.
|
|
6238
|
-
|
|
6144
|
+
var _proto = Plane.prototype;
|
|
6145
|
+
_proto.updatePNVertexFlag = function updatePNVertexFlag() {
|
|
6146
|
+
this.pnVertexFlag = (Number(this.normal[0] >= 0) << 8) + (Number(this.normal[1] >= 0) << 4) + Number(this.normal[2] >= 0);
|
|
6239
6147
|
};
|
|
6240
|
-
|
|
6148
|
+
_proto.distanceToPoint = function distanceToPoint(point) {
|
|
6149
|
+
return glMatrix.vec3.dot(point, this.normal) - this.distance;
|
|
6150
|
+
};
|
|
6151
|
+
_proto.normalize = function normalize() {
|
|
6152
|
+
var invLen = 1 / glMatrix.vec3.len(this.normal);
|
|
6153
|
+
glMatrix.vec3.scale(this.normal, this.normal, invLen);
|
|
6154
|
+
this.distance *= invLen;
|
|
6155
|
+
};
|
|
6156
|
+
_proto.intersectsLine = function intersectsLine(start, end, point) {
|
|
6157
|
+
var d0 = this.distanceToPoint(start);
|
|
6158
|
+
var d1 = this.distanceToPoint(end);
|
|
6159
|
+
var t = d0 / (d0 - d1);
|
|
6160
|
+
var intersects = t >= 0 && t <= 1;
|
|
6161
|
+
if (intersects && point) {
|
|
6162
|
+
glMatrix.vec3.lerp(point, start, end, t);
|
|
6163
|
+
}
|
|
6164
|
+
return intersects;
|
|
6165
|
+
};
|
|
6166
|
+
return Plane;
|
|
6241
6167
|
}();
|
|
6242
6168
|
|
|
6243
|
-
|
|
6244
|
-
|
|
6245
|
-
|
|
6246
|
-
|
|
6247
|
-
|
|
6169
|
+
(function (Mask) {
|
|
6170
|
+
Mask[Mask["OUTSIDE"] = 4294967295] = "OUTSIDE";
|
|
6171
|
+
Mask[Mask["INSIDE"] = 0] = "INSIDE";
|
|
6172
|
+
Mask[Mask["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
|
|
6173
|
+
})(exports.Mask || (exports.Mask = {}));
|
|
6174
|
+
var Frustum = /*#__PURE__*/function () {
|
|
6175
|
+
function Frustum(planes) {
|
|
6176
|
+
this.planes = [];
|
|
6177
|
+
if (planes) {
|
|
6178
|
+
this.planes = planes;
|
|
6179
|
+
} else {
|
|
6180
|
+
for (var i = 0; i < 6; i++) {
|
|
6181
|
+
this.planes.push(new Plane());
|
|
6182
|
+
}
|
|
6183
|
+
}
|
|
6248
6184
|
}
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6185
|
+
/**
|
|
6186
|
+
* extract 6 planes from projectionMatrix
|
|
6187
|
+
* @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
|
|
6188
|
+
*/
|
|
6189
|
+
var _proto = Frustum.prototype;
|
|
6190
|
+
_proto.extractFromVPMatrix = function extractFromVPMatrix(projectionMatrix) {
|
|
6191
|
+
// @ts-ignore
|
|
6192
|
+
var m0 = projectionMatrix[0],
|
|
6193
|
+
m1 = projectionMatrix[1],
|
|
6194
|
+
m2 = projectionMatrix[2],
|
|
6195
|
+
m3 = projectionMatrix[3],
|
|
6196
|
+
m4 = projectionMatrix[4],
|
|
6197
|
+
m5 = projectionMatrix[5],
|
|
6198
|
+
m6 = projectionMatrix[6],
|
|
6199
|
+
m7 = projectionMatrix[7],
|
|
6200
|
+
m8 = projectionMatrix[8],
|
|
6201
|
+
m9 = projectionMatrix[9],
|
|
6202
|
+
m10 = projectionMatrix[10],
|
|
6203
|
+
m11 = projectionMatrix[11],
|
|
6204
|
+
m12 = projectionMatrix[12],
|
|
6205
|
+
m13 = projectionMatrix[13],
|
|
6206
|
+
m14 = projectionMatrix[14],
|
|
6207
|
+
m15 = projectionMatrix[15];
|
|
6208
|
+
// right
|
|
6209
|
+
glMatrix.vec3.set(this.planes[0].normal, m3 - m0, m7 - m4, m11 - m8);
|
|
6210
|
+
this.planes[0].distance = m15 - m12;
|
|
6211
|
+
// left
|
|
6212
|
+
glMatrix.vec3.set(this.planes[1].normal, m3 + m0, m7 + m4, m11 + m8);
|
|
6213
|
+
this.planes[1].distance = m15 + m12;
|
|
6214
|
+
// bottom
|
|
6215
|
+
glMatrix.vec3.set(this.planes[2].normal, m3 + m1, m7 + m5, m11 + m9);
|
|
6216
|
+
this.planes[2].distance = m15 + m13;
|
|
6217
|
+
// top
|
|
6218
|
+
glMatrix.vec3.set(this.planes[3].normal, m3 - m1, m7 - m5, m11 - m9);
|
|
6219
|
+
this.planes[3].distance = m15 - m13;
|
|
6220
|
+
// far
|
|
6221
|
+
glMatrix.vec3.set(this.planes[4].normal, m3 - m2, m7 - m6, m11 - m10);
|
|
6222
|
+
this.planes[4].distance = m15 - m14;
|
|
6223
|
+
// near
|
|
6224
|
+
glMatrix.vec3.set(this.planes[5].normal, m3 + m2, m7 + m6, m11 + m10);
|
|
6225
|
+
this.planes[5].distance = m15 + m14;
|
|
6226
|
+
this.planes.forEach(function (plane) {
|
|
6227
|
+
plane.normalize();
|
|
6228
|
+
plane.updatePNVertexFlag();
|
|
6229
|
+
});
|
|
6252
6230
|
};
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6231
|
+
return Frustum;
|
|
6232
|
+
}();
|
|
6233
|
+
|
|
6234
|
+
var Point = /*#__PURE__*/function () {
|
|
6235
|
+
function Point(x, y) {
|
|
6236
|
+
if (x === void 0) {
|
|
6237
|
+
x = 0;
|
|
6259
6238
|
}
|
|
6260
|
-
|
|
6261
|
-
|
|
6262
|
-
// set position in world space
|
|
6263
|
-
var point = offsetPath.getPoint(offsetDistance);
|
|
6264
|
-
if (point) {
|
|
6265
|
-
object.parsedStyle.defX = point.x;
|
|
6266
|
-
object.parsedStyle.defY = point.y;
|
|
6267
|
-
object.setLocalPosition(point.x, point.y);
|
|
6268
|
-
}
|
|
6239
|
+
if (y === void 0) {
|
|
6240
|
+
y = 0;
|
|
6269
6241
|
}
|
|
6242
|
+
this.x = 0;
|
|
6243
|
+
this.y = 0;
|
|
6244
|
+
this.x = x;
|
|
6245
|
+
this.y = y;
|
|
6246
|
+
}
|
|
6247
|
+
var _proto = Point.prototype;
|
|
6248
|
+
_proto.clone = function clone() {
|
|
6249
|
+
return new Point(this.x, this.y);
|
|
6270
6250
|
};
|
|
6271
|
-
|
|
6251
|
+
_proto.copyFrom = function copyFrom(p) {
|
|
6252
|
+
this.x = p.x;
|
|
6253
|
+
this.y = p.y;
|
|
6254
|
+
};
|
|
6255
|
+
return Point;
|
|
6272
6256
|
}();
|
|
6273
6257
|
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
this.
|
|
6280
|
-
this.
|
|
6281
|
-
this.
|
|
6258
|
+
var Rectangle = /*#__PURE__*/function () {
|
|
6259
|
+
function Rectangle(x, y, width, height) {
|
|
6260
|
+
this.x = void 0;
|
|
6261
|
+
this.y = void 0;
|
|
6262
|
+
this.width = void 0;
|
|
6263
|
+
this.height = void 0;
|
|
6264
|
+
this.left = void 0;
|
|
6265
|
+
this.right = void 0;
|
|
6266
|
+
this.top = void 0;
|
|
6267
|
+
this.bottom = void 0;
|
|
6268
|
+
this.x = x;
|
|
6269
|
+
this.y = y;
|
|
6270
|
+
this.width = width;
|
|
6271
|
+
this.height = height;
|
|
6272
|
+
this.left = x;
|
|
6273
|
+
this.right = x + width;
|
|
6274
|
+
this.top = y;
|
|
6275
|
+
this.bottom = y + height;
|
|
6282
6276
|
}
|
|
6283
|
-
var _proto =
|
|
6284
|
-
_proto.
|
|
6285
|
-
|
|
6286
|
-
};
|
|
6287
|
-
return CSSPropertyOpacity;
|
|
6277
|
+
var _proto = Rectangle.prototype;
|
|
6278
|
+
_proto.toJSON = function toJSON() {};
|
|
6279
|
+
return Rectangle;
|
|
6288
6280
|
}();
|
|
6289
6281
|
|
|
6290
6282
|
var CSSPropertyPath = /*#__PURE__*/function () {
|
|
@@ -7627,12 +7619,12 @@ var Element = /*#__PURE__*/function (_Node) {
|
|
|
7627
7619
|
localPosition: [0, 0, 0],
|
|
7628
7620
|
localRotation: [0, 0, 0, 1],
|
|
7629
7621
|
localScale: [1, 1, 1],
|
|
7630
|
-
localTransform:
|
|
7622
|
+
localTransform: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
7631
7623
|
localSkew: [0, 0],
|
|
7632
7624
|
position: [0, 0, 0],
|
|
7633
7625
|
rotation: [0, 0, 0, 1],
|
|
7634
7626
|
scaling: [1, 1, 1],
|
|
7635
|
-
worldTransform:
|
|
7627
|
+
worldTransform: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
7636
7628
|
origin: [0, 0, 0]
|
|
7637
7629
|
};
|
|
7638
7630
|
_this.sortable = {
|
|
@@ -9142,7 +9134,7 @@ var Circle = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9142
9134
|
}, style) : _extends({}, style),
|
|
9143
9135
|
initialParsedStyle: {
|
|
9144
9136
|
anchor: [0.5, 0.5],
|
|
9145
|
-
transformOrigin: runtime.enableCSSParsing ? null : [
|
|
9137
|
+
transformOrigin: runtime.enableCSSParsing ? null : [PECENTAGE_50, PECENTAGE_50]
|
|
9146
9138
|
}
|
|
9147
9139
|
}, rest)) || this;
|
|
9148
9140
|
}
|
|
@@ -9230,7 +9222,7 @@ var Ellipse = /*#__PURE__*/function (_DisplayObject) {
|
|
|
9230
9222
|
}, style) : _extends({}, style),
|
|
9231
9223
|
initialParsedStyle: {
|
|
9232
9224
|
anchor: [0.5, 0.5],
|
|
9233
|
-
transformOrigin: runtime.enableCSSParsing ? null : [
|
|
9225
|
+
transformOrigin: runtime.enableCSSParsing ? null : [PECENTAGE_50, PECENTAGE_50]
|
|
9234
9226
|
}
|
|
9235
9227
|
}, rest)) || this;
|
|
9236
9228
|
}
|
|
@@ -10088,6 +10080,7 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
10088
10080
|
var _proto = Text.prototype;
|
|
10089
10081
|
_proto.getComputedTextLength = function getComputedTextLength() {
|
|
10090
10082
|
var _this$parsedStyle$met;
|
|
10083
|
+
this.forceUpdateGeometry();
|
|
10091
10084
|
return ((_this$parsedStyle$met = this.parsedStyle.metrics) === null || _this$parsedStyle$met === void 0 ? void 0 : _this$parsedStyle$met.maxLineWidth) || 0;
|
|
10092
10085
|
}
|
|
10093
10086
|
// getEndPositionOfChar(charnum: number): DOMPoint {
|
|
@@ -10114,11 +10107,18 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
|
|
|
10114
10107
|
;
|
|
10115
10108
|
_proto.getLineBoundingRects = function getLineBoundingRects() {
|
|
10116
10109
|
var _this$parsedStyle$met2;
|
|
10110
|
+
this.forceUpdateGeometry();
|
|
10117
10111
|
return ((_this$parsedStyle$met2 = this.parsedStyle.metrics) === null || _this$parsedStyle$met2 === void 0 ? void 0 : _this$parsedStyle$met2.lineMetrics) || [];
|
|
10118
10112
|
};
|
|
10119
10113
|
_proto.isOverflowing = function isOverflowing() {
|
|
10114
|
+
this.forceUpdateGeometry();
|
|
10120
10115
|
return !!this.parsedStyle.isOverflowing;
|
|
10121
10116
|
};
|
|
10117
|
+
_proto.forceUpdateGeometry = function forceUpdateGeometry() {
|
|
10118
|
+
if (!this.parsedStyle.metrics) {
|
|
10119
|
+
runtime.styleValueRegistry.updateGeometry(this);
|
|
10120
|
+
}
|
|
10121
|
+
};
|
|
10122
10122
|
return Text;
|
|
10123
10123
|
}(DisplayObject);
|
|
10124
10124
|
|
|
@@ -11093,7 +11093,8 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
11093
11093
|
* eg. r of Circle, width/height of Rect
|
|
11094
11094
|
*/;
|
|
11095
11095
|
_proto.updateGeometry = function updateGeometry(object) {
|
|
11096
|
-
var
|
|
11096
|
+
var nodeName = object.nodeName;
|
|
11097
|
+
var geometryUpdater = runtime.geometryUpdaterFactory[nodeName];
|
|
11097
11098
|
if (geometryUpdater) {
|
|
11098
11099
|
var geometry = object.geometry;
|
|
11099
11100
|
if (!geometry.contentBounds) {
|
|
@@ -11114,10 +11115,6 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
11114
11115
|
offsetY = _geometryUpdater$upda4 === void 0 ? 0 : _geometryUpdater$upda4,
|
|
11115
11116
|
_geometryUpdater$upda5 = _geometryUpdater$upda.offsetZ,
|
|
11116
11117
|
offsetZ = _geometryUpdater$upda5 === void 0 ? 0 : _geometryUpdater$upda5;
|
|
11117
|
-
// account for negative width / height of Rect
|
|
11118
|
-
// @see https://github.com/antvis/g/issues/957
|
|
11119
|
-
var flipY = width < 0;
|
|
11120
|
-
var flipX = height < 0;
|
|
11121
11118
|
// init with content box
|
|
11122
11119
|
var halfExtents = [Math.abs(width) / 2, Math.abs(height) / 2, depth / 2];
|
|
11123
11120
|
// const halfExtents = vec3.set(
|
|
@@ -11137,7 +11134,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
11137
11134
|
transformOrigin = parsedStyle.transformOrigin;
|
|
11138
11135
|
var anchor = parsedStyle.anchor;
|
|
11139
11136
|
// <Text> use textAlign & textBaseline instead of anchor
|
|
11140
|
-
if (
|
|
11137
|
+
if (nodeName === exports.Shape.TEXT) {
|
|
11141
11138
|
delete parsedStyle.anchor;
|
|
11142
11139
|
}
|
|
11143
11140
|
var center = [(1 - (anchor && anchor[0] || 0) * 2) * width / 2 + offsetX, (1 - (anchor && anchor[1] || 0) * 2) * height / 2 + offsetY, (1 - (anchor && anchor[2] || 0) * 2) * halfExtents[2] + offsetZ];
|
|
@@ -11150,7 +11147,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
11150
11147
|
// update geometry's AABB
|
|
11151
11148
|
geometry.contentBounds.update(center, halfExtents);
|
|
11152
11149
|
// @see https://github.molgen.mpg.de/git-mirror/cairo/blob/master/src/cairo-stroke-style.c#L97..L128
|
|
11153
|
-
var expansion =
|
|
11150
|
+
var expansion = nodeName === exports.Shape.POLYLINE || nodeName === exports.Shape.POLYGON || nodeName === exports.Shape.PATH ? Math.SQRT2 : 0.5;
|
|
11154
11151
|
// if (lineCap?.value === 'square') {
|
|
11155
11152
|
// expansion = Math.SQRT1_2;
|
|
11156
11153
|
// }
|
|
@@ -11221,13 +11218,19 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
|
|
|
11221
11218
|
});
|
|
11222
11219
|
anchor = parsedStyle.anchor;
|
|
11223
11220
|
geometry.dirty = false;
|
|
11221
|
+
// if (nodeName === Shape.RECT) {
|
|
11222
|
+
// account for negative width / height of Rect
|
|
11223
|
+
// @see https://github.com/antvis/g/issues/957
|
|
11224
|
+
var flipY = width < 0;
|
|
11225
|
+
var flipX = height < 0;
|
|
11226
|
+
// } else {
|
|
11227
|
+
// }
|
|
11224
11228
|
// set transform origin
|
|
11225
11229
|
var usedOriginXValue = (flipY ? -1 : 1) * (transformOrigin ? convertPercentUnit(transformOrigin[0], 0, object) : 0);
|
|
11226
11230
|
var usedOriginYValue = (flipX ? -1 : 1) * (transformOrigin ? convertPercentUnit(transformOrigin[1], 1, object) : 0);
|
|
11227
11231
|
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0] || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
11228
11232
|
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1] || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
11229
11233
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
11230
|
-
// console.log('calc geometry', object);
|
|
11231
11234
|
// FIXME setOrigin may have already dirtified to root.
|
|
11232
11235
|
// runtime.sceneGraphService.dirtifyToRoot(object);
|
|
11233
11236
|
}
|
|
@@ -13785,10 +13788,10 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
13785
13788
|
z = 0;
|
|
13786
13789
|
}
|
|
13787
13790
|
if (typeof origin === 'number') {
|
|
13788
|
-
origin =
|
|
13791
|
+
origin = [origin, y, z];
|
|
13789
13792
|
}
|
|
13790
13793
|
var transform = element.transformable;
|
|
13791
|
-
if (
|
|
13794
|
+
if (origin[0] === transform.origin[0] && origin[1] === transform.origin[1] && origin[2] === transform.origin[2]) {
|
|
13792
13795
|
return;
|
|
13793
13796
|
}
|
|
13794
13797
|
var originVec = transform.origin;
|
|
@@ -14108,7 +14111,7 @@ var DefaultSceneGraphService = /*#__PURE__*/function () {
|
|
|
14108
14111
|
var clipped = findClosestClipPathTarget(element);
|
|
14109
14112
|
if (clipped) {
|
|
14110
14113
|
// use bounds under world space
|
|
14111
|
-
var clipPathBounds = clipped.
|
|
14114
|
+
var clipPathBounds = clipped.parsedStyle.clipPath.getBounds(render);
|
|
14112
14115
|
if (!aabb) {
|
|
14113
14116
|
aabb = clipPathBounds;
|
|
14114
14117
|
} else if (clipPathBounds) {
|
|
@@ -14846,7 +14849,7 @@ var EventPlugin = /*#__PURE__*/function () {
|
|
|
14846
14849
|
var normalizedEvents = _this.normalizeToPointerEvent(nativeEvent, canvas);
|
|
14847
14850
|
for (var _iterator = _createForOfIteratorHelperLoose(normalizedEvents), _step; !(_step = _iterator()).done;) {
|
|
14848
14851
|
var normalizedEvent = _step.value;
|
|
14849
|
-
var event = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent, canvas);
|
|
14852
|
+
var event = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent, canvas, nativeEvent);
|
|
14850
14853
|
_this.context.eventService.mapEvent(event);
|
|
14851
14854
|
}
|
|
14852
14855
|
_this.setCursor(_this.context.eventService.cursor);
|
|
@@ -14901,7 +14904,7 @@ var EventPlugin = /*#__PURE__*/function () {
|
|
|
14901
14904
|
}
|
|
14902
14905
|
for (var _iterator2 = _createForOfIteratorHelperLoose(events), _step2; !(_step2 = _iterator2()).done;) {
|
|
14903
14906
|
var event = _step2.value;
|
|
14904
|
-
var federatedEvent = _this2.bootstrapEvent(_this2.rootPointerEvent, event, canvas);
|
|
14907
|
+
var federatedEvent = _this2.bootstrapEvent(_this2.rootPointerEvent, event, canvas, nativeEvent);
|
|
14905
14908
|
_this2.context.eventService.mapEvent(federatedEvent);
|
|
14906
14909
|
}
|
|
14907
14910
|
_this2.setCursor(_this2.context.eventService.cursor);
|
|
@@ -14920,7 +14923,7 @@ var EventPlugin = /*#__PURE__*/function () {
|
|
|
14920
14923
|
var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
|
|
14921
14924
|
for (var _iterator3 = _createForOfIteratorHelperLoose(normalizedEvents), _step3; !(_step3 = _iterator3()).done;) {
|
|
14922
14925
|
var normalizedEvent = _step3.value;
|
|
14923
|
-
var event = _this2.bootstrapEvent(_this2.rootPointerEvent, normalizedEvent, canvas);
|
|
14926
|
+
var event = _this2.bootstrapEvent(_this2.rootPointerEvent, normalizedEvent, canvas, nativeEvent);
|
|
14924
14927
|
event.type += outside;
|
|
14925
14928
|
_this2.context.eventService.mapEvent(event);
|
|
14926
14929
|
}
|
|
@@ -14955,22 +14958,22 @@ var EventPlugin = /*#__PURE__*/function () {
|
|
|
14955
14958
|
y: y
|
|
14956
14959
|
};
|
|
14957
14960
|
};
|
|
14958
|
-
_proto.bootstrapEvent = function bootstrapEvent(event,
|
|
14961
|
+
_proto.bootstrapEvent = function bootstrapEvent(event, normalizedEvent, view, nativeEvent) {
|
|
14959
14962
|
event.view = view;
|
|
14960
14963
|
event.originalEvent = null;
|
|
14961
14964
|
event.nativeEvent = nativeEvent;
|
|
14962
|
-
event.pointerId =
|
|
14963
|
-
event.width =
|
|
14964
|
-
event.height =
|
|
14965
|
-
event.isPrimary =
|
|
14966
|
-
event.pointerType =
|
|
14967
|
-
event.pressure =
|
|
14968
|
-
event.tangentialPressure =
|
|
14969
|
-
event.tiltX =
|
|
14970
|
-
event.tiltY =
|
|
14971
|
-
event.twist =
|
|
14972
|
-
this.transferMouseData(event,
|
|
14973
|
-
var _this$getViewportXY = this.getViewportXY(
|
|
14965
|
+
event.pointerId = normalizedEvent.pointerId;
|
|
14966
|
+
event.width = normalizedEvent.width;
|
|
14967
|
+
event.height = normalizedEvent.height;
|
|
14968
|
+
event.isPrimary = normalizedEvent.isPrimary;
|
|
14969
|
+
event.pointerType = normalizedEvent.pointerType;
|
|
14970
|
+
event.pressure = normalizedEvent.pressure;
|
|
14971
|
+
event.tangentialPressure = normalizedEvent.tangentialPressure;
|
|
14972
|
+
event.tiltX = normalizedEvent.tiltX;
|
|
14973
|
+
event.tiltY = normalizedEvent.tiltY;
|
|
14974
|
+
event.twist = normalizedEvent.twist;
|
|
14975
|
+
this.transferMouseData(event, normalizedEvent);
|
|
14976
|
+
var _this$getViewportXY = this.getViewportXY(normalizedEvent),
|
|
14974
14977
|
x = _this$getViewportXY.x,
|
|
14975
14978
|
y = _this$getViewportXY.y;
|
|
14976
14979
|
event.viewport.x = x;
|