@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.umd.js
CHANGED
|
@@ -6991,6 +6991,7 @@
|
|
|
6991
6991
|
}
|
|
6992
6992
|
return new CSSUnitValue(value, unitOrName);
|
|
6993
6993
|
};
|
|
6994
|
+
var PECENTAGE_50 = new CSSUnitValue(50, '%');
|
|
6994
6995
|
|
|
6995
6996
|
function define(constructor, factory, prototype) {
|
|
6996
6997
|
constructor.prototype = factory.prototype = prototype;
|
|
@@ -7405,8 +7406,8 @@
|
|
|
7405
7406
|
function findClosestClipPathTarget(object) {
|
|
7406
7407
|
var el = object;
|
|
7407
7408
|
do {
|
|
7408
|
-
var _el$
|
|
7409
|
-
var clipPath = (_el$
|
|
7409
|
+
var _el$parsedStyle;
|
|
7410
|
+
var clipPath = (_el$parsedStyle = el.parsedStyle) === null || _el$parsedStyle === void 0 ? void 0 : _el$parsedStyle.clipPath;
|
|
7410
7411
|
if (clipPath) return el;
|
|
7411
7412
|
el = el.parentElement;
|
|
7412
7413
|
} while (el !== null);
|
|
@@ -10803,8 +10804,7 @@
|
|
|
10803
10804
|
var fontSizeString = isNumber(fontSize) && fontSize + "px" || '16px';
|
|
10804
10805
|
// Clean-up fontFamily property by quoting each font name
|
|
10805
10806
|
// this will support font names with spaces
|
|
10806
|
-
|
|
10807
|
-
var fontFamilies = isString(fontFamily) ? fontFamily.split(',') : [fontFamily];
|
|
10807
|
+
var fontFamilies = fontFamily.split(',');
|
|
10808
10808
|
for (var i = fontFamilies.length - 1; i >= 0; i--) {
|
|
10809
10809
|
// Trim any extra white-space
|
|
10810
10810
|
var _fontFamily = fontFamilies[i].trim();
|
|
@@ -11213,566 +11213,149 @@
|
|
|
11213
11213
|
}];
|
|
11214
11214
|
}
|
|
11215
11215
|
|
|
11216
|
+
function parseDimension(unitRegExp, string) {
|
|
11217
|
+
if (isNil(string)) {
|
|
11218
|
+
return getOrCreateUnitValue(0, 'px');
|
|
11219
|
+
}
|
|
11220
|
+
string = ("" + string).trim().toLowerCase();
|
|
11221
|
+
if (isFinite(Number(string))) {
|
|
11222
|
+
if ('px'.search(unitRegExp) >= 0) {
|
|
11223
|
+
return getOrCreateUnitValue(Number(string), 'px');
|
|
11224
|
+
} else if ('deg'.search(unitRegExp) >= 0) {
|
|
11225
|
+
return getOrCreateUnitValue(Number(string), 'deg');
|
|
11226
|
+
}
|
|
11227
|
+
}
|
|
11228
|
+
var matchedUnits = [];
|
|
11229
|
+
string = string.replace(unitRegExp, function (match) {
|
|
11230
|
+
matchedUnits.push(match);
|
|
11231
|
+
return 'U' + match;
|
|
11232
|
+
});
|
|
11233
|
+
var taggedUnitRegExp = 'U(' + unitRegExp.source + ')';
|
|
11234
|
+
return matchedUnits.map(function (unit) {
|
|
11235
|
+
return getOrCreateUnitValue(Number(string.replace(new RegExp('U' + unit, 'g'), '').replace(new RegExp(taggedUnitRegExp, 'g'), '*0')), unit);
|
|
11236
|
+
})[0];
|
|
11237
|
+
}
|
|
11216
11238
|
/**
|
|
11217
|
-
*
|
|
11218
|
-
*
|
|
11219
|
-
*
|
|
11239
|
+
* <length>
|
|
11240
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
11241
|
+
* length with only absolute unit, eg. 1px
|
|
11220
11242
|
*/
|
|
11221
|
-
var
|
|
11222
|
-
|
|
11223
|
-
|
|
11224
|
-
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11228
|
-
|
|
11229
|
-
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11243
|
+
var parseLength = memoize(function (css) {
|
|
11244
|
+
return parseDimension(new RegExp('px', 'g'), css);
|
|
11245
|
+
});
|
|
11246
|
+
/**
|
|
11247
|
+
* <percentage>
|
|
11248
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
|
|
11249
|
+
*/
|
|
11250
|
+
var parserPercentage = memoize(function (css) {
|
|
11251
|
+
return parseDimension(new RegExp('%', 'g'), css);
|
|
11252
|
+
});
|
|
11253
|
+
/**
|
|
11254
|
+
* length with absolute or relative unit,
|
|
11255
|
+
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
11256
|
+
*
|
|
11257
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
11258
|
+
*/
|
|
11259
|
+
// export const parseLengthOrPercentage = memoize((css: string): CSSUnitValue => {
|
|
11260
|
+
// if (isNumber(css) || isFinite(Number(css))) {
|
|
11261
|
+
// return getOrCreateUnitValue(Number(css), 'px');
|
|
11262
|
+
// }
|
|
11263
|
+
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
11264
|
+
// });
|
|
11265
|
+
var parseLengthOrPercentage = function parseLengthOrPercentage(css) {
|
|
11266
|
+
if (isNumber(css) || isFinite(Number(css))) {
|
|
11267
|
+
return getOrCreateUnitValue(Number(css), 'px');
|
|
11268
|
+
// return Number(css);
|
|
11241
11269
|
}
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11250
|
-
|
|
11251
|
-
|
|
11252
|
-
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11259
|
-
|
|
11260
|
-
|
|
11261
|
-
|
|
11262
|
-
|
|
11263
|
-
|
|
11264
|
-
|
|
11265
|
-
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
|
|
11269
|
-
|
|
11270
|
-
|
|
11271
|
-
|
|
11272
|
-
|
|
11273
|
-
|
|
11274
|
-
|
|
11275
|
-
|
|
11276
|
-
}
|
|
11277
|
-
if (AABB.isEmpty(this)) {
|
|
11278
|
-
this.setMinMax(aabb.getMin(), aabb.getMax());
|
|
11279
|
-
return;
|
|
11280
|
-
}
|
|
11281
|
-
var tc = this.center;
|
|
11282
|
-
var tcx = tc[0];
|
|
11283
|
-
var tcy = tc[1];
|
|
11284
|
-
var tcz = tc[2];
|
|
11285
|
-
var th = this.halfExtents;
|
|
11286
|
-
var thx = th[0];
|
|
11287
|
-
var thy = th[1];
|
|
11288
|
-
var thz = th[2];
|
|
11289
|
-
var tminx = tcx - thx;
|
|
11290
|
-
var tmaxx = tcx + thx;
|
|
11291
|
-
var tminy = tcy - thy;
|
|
11292
|
-
var tmaxy = tcy + thy;
|
|
11293
|
-
var tminz = tcz - thz;
|
|
11294
|
-
var tmaxz = tcz + thz;
|
|
11295
|
-
var oc = aabb.center;
|
|
11296
|
-
var ocx = oc[0];
|
|
11297
|
-
var ocy = oc[1];
|
|
11298
|
-
var ocz = oc[2];
|
|
11299
|
-
var oh = aabb.halfExtents;
|
|
11300
|
-
var ohx = oh[0];
|
|
11301
|
-
var ohy = oh[1];
|
|
11302
|
-
var ohz = oh[2];
|
|
11303
|
-
var ominx = ocx - ohx;
|
|
11304
|
-
var omaxx = ocx + ohx;
|
|
11305
|
-
var ominy = ocy - ohy;
|
|
11306
|
-
var omaxy = ocy + ohy;
|
|
11307
|
-
var ominz = ocz - ohz;
|
|
11308
|
-
var omaxz = ocz + ohz;
|
|
11309
|
-
if (ominx < tminx) {
|
|
11310
|
-
tminx = ominx;
|
|
11311
|
-
}
|
|
11312
|
-
if (omaxx > tmaxx) {
|
|
11313
|
-
tmaxx = omaxx;
|
|
11314
|
-
}
|
|
11315
|
-
if (ominy < tminy) {
|
|
11316
|
-
tminy = ominy;
|
|
11270
|
+
|
|
11271
|
+
return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
|
|
11272
|
+
};
|
|
11273
|
+
var parseAngle = memoize(function (css) {
|
|
11274
|
+
return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
|
|
11275
|
+
});
|
|
11276
|
+
/**
|
|
11277
|
+
* merge CSSUnitValue
|
|
11278
|
+
*
|
|
11279
|
+
* @example
|
|
11280
|
+
* 10px + 20px = 30px
|
|
11281
|
+
* 10deg + 10rad
|
|
11282
|
+
* 10% + 20% = 30%
|
|
11283
|
+
*/
|
|
11284
|
+
function mergeDimensions(left, right, target, nonNegative, index) {
|
|
11285
|
+
if (index === void 0) {
|
|
11286
|
+
index = 0;
|
|
11287
|
+
}
|
|
11288
|
+
var unit = '';
|
|
11289
|
+
var leftValue = left.value || 0;
|
|
11290
|
+
var rightValue = right.value || 0;
|
|
11291
|
+
var canonicalUnit = toCanonicalUnit(left.unit);
|
|
11292
|
+
var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
|
|
11293
|
+
var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
|
|
11294
|
+
if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
|
|
11295
|
+
leftValue = leftCanonicalUnitValue.value;
|
|
11296
|
+
rightValue = rightCanonicalUnitValue.value;
|
|
11297
|
+
unit = unitTypeToString(left.unit);
|
|
11298
|
+
} else {
|
|
11299
|
+
// format '%' to 'px'
|
|
11300
|
+
if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
|
|
11301
|
+
leftValue = convertPercentUnit(left, index, target);
|
|
11302
|
+
rightValue = convertPercentUnit(right, index, target);
|
|
11303
|
+
unit = 'px';
|
|
11317
11304
|
}
|
|
11318
|
-
|
|
11319
|
-
|
|
11305
|
+
}
|
|
11306
|
+
// // format 'rad' 'turn' to 'deg'
|
|
11307
|
+
// if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
|
|
11308
|
+
// leftValue = convertAngleUnit(left);
|
|
11309
|
+
// rightValue = convertAngleUnit(right);
|
|
11310
|
+
// unit = 'deg';
|
|
11311
|
+
// }
|
|
11312
|
+
return [leftValue, rightValue, function (value) {
|
|
11313
|
+
if (nonNegative) {
|
|
11314
|
+
value = Math.max(value, 0);
|
|
11320
11315
|
}
|
|
11321
|
-
|
|
11322
|
-
|
|
11316
|
+
return value + unit;
|
|
11317
|
+
}];
|
|
11318
|
+
}
|
|
11319
|
+
function convertAngleUnit(value) {
|
|
11320
|
+
var deg = 0;
|
|
11321
|
+
if (value.unit === exports.UnitType.kDegrees) {
|
|
11322
|
+
deg = value.value;
|
|
11323
|
+
} else if (value.unit === exports.UnitType.kRadians) {
|
|
11324
|
+
deg = rad2deg(Number(value.value));
|
|
11325
|
+
} else if (value.unit === exports.UnitType.kTurns) {
|
|
11326
|
+
deg = turn2deg(Number(value.value));
|
|
11327
|
+
}
|
|
11328
|
+
return deg;
|
|
11329
|
+
}
|
|
11330
|
+
function parseDimensionArrayFormat(string, size) {
|
|
11331
|
+
var parsed;
|
|
11332
|
+
if (Array.isArray(string)) {
|
|
11333
|
+
// [1, '2px', 3]
|
|
11334
|
+
parsed = string.map(function (segment) {
|
|
11335
|
+
return Number(segment);
|
|
11336
|
+
});
|
|
11337
|
+
} else if (isString(string)) {
|
|
11338
|
+
parsed = string.split(' ').map(function (segment) {
|
|
11339
|
+
return Number(segment);
|
|
11340
|
+
});
|
|
11341
|
+
} else if (isNumber(string)) {
|
|
11342
|
+
parsed = [string];
|
|
11343
|
+
}
|
|
11344
|
+
if (size === 2) {
|
|
11345
|
+
if (parsed.length === 1) {
|
|
11346
|
+
return [parsed[0], parsed[0]];
|
|
11347
|
+
} else {
|
|
11348
|
+
return [parsed[0], parsed[1]];
|
|
11323
11349
|
}
|
|
11324
|
-
|
|
11325
|
-
|
|
11326
|
-
|
|
11327
|
-
|
|
11328
|
-
|
|
11329
|
-
|
|
11330
|
-
|
|
11331
|
-
|
|
11332
|
-
|
|
11333
|
-
this.min[0] = tminx;
|
|
11334
|
-
this.min[1] = tminy;
|
|
11335
|
-
this.min[2] = tminz;
|
|
11336
|
-
this.max[0] = tmaxx;
|
|
11337
|
-
this.max[1] = tmaxy;
|
|
11338
|
-
this.max[2] = tmaxz;
|
|
11339
|
-
};
|
|
11340
|
-
_proto.setFromTransformedAABB = function setFromTransformedAABB(aabb, m) {
|
|
11341
|
-
var bc = this.center;
|
|
11342
|
-
var br = this.halfExtents;
|
|
11343
|
-
var ac = aabb.center;
|
|
11344
|
-
var ar = aabb.halfExtents;
|
|
11345
|
-
var mx0 = m[0];
|
|
11346
|
-
var mx1 = m[4];
|
|
11347
|
-
var mx2 = m[8];
|
|
11348
|
-
var my0 = m[1];
|
|
11349
|
-
var my1 = m[5];
|
|
11350
|
-
var my2 = m[9];
|
|
11351
|
-
var mz0 = m[2];
|
|
11352
|
-
var mz1 = m[6];
|
|
11353
|
-
var mz2 = m[10];
|
|
11354
|
-
var mx0a = Math.abs(mx0);
|
|
11355
|
-
var mx1a = Math.abs(mx1);
|
|
11356
|
-
var mx2a = Math.abs(mx2);
|
|
11357
|
-
var my0a = Math.abs(my0);
|
|
11358
|
-
var my1a = Math.abs(my1);
|
|
11359
|
-
var my2a = Math.abs(my2);
|
|
11360
|
-
var mz0a = Math.abs(mz0);
|
|
11361
|
-
var mz1a = Math.abs(mz1);
|
|
11362
|
-
var mz2a = Math.abs(mz2);
|
|
11363
|
-
bc[0] = m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2];
|
|
11364
|
-
bc[1] = m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2];
|
|
11365
|
-
bc[2] = m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2];
|
|
11366
|
-
// vec3.set(
|
|
11367
|
-
// bc,
|
|
11368
|
-
// m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2],
|
|
11369
|
-
// m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2],
|
|
11370
|
-
// m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2],
|
|
11371
|
-
// );
|
|
11372
|
-
br[0] = mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2];
|
|
11373
|
-
br[1] = my0a * ar[0] + my1a * ar[1] + my2a * ar[2];
|
|
11374
|
-
br[2] = mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2];
|
|
11375
|
-
// vec3.set(
|
|
11376
|
-
// br,
|
|
11377
|
-
// mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2],
|
|
11378
|
-
// my0a * ar[0] + my1a * ar[1] + my2a * ar[2],
|
|
11379
|
-
// mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2],
|
|
11380
|
-
// );
|
|
11381
|
-
// this.min = vec3.sub(this.min, bc, br);
|
|
11382
|
-
// this.max = vec3.add(this.max, bc, br);
|
|
11383
|
-
subVec3(this.min, bc, br);
|
|
11384
|
-
addVec3(this.max, bc, br);
|
|
11385
|
-
};
|
|
11386
|
-
_proto.intersects = function intersects(aabb) {
|
|
11387
|
-
var aMax = this.getMax();
|
|
11388
|
-
var aMin = this.getMin();
|
|
11389
|
-
var bMax = aabb.getMax();
|
|
11390
|
-
var bMin = aabb.getMin();
|
|
11391
|
-
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];
|
|
11392
|
-
};
|
|
11393
|
-
_proto.intersection = function intersection(aabb) {
|
|
11394
|
-
if (!this.intersects(aabb)) {
|
|
11395
|
-
return null;
|
|
11396
|
-
}
|
|
11397
|
-
var intersection = new AABB();
|
|
11398
|
-
// const min = vec3.max(vec3.create(), this.getMin(), aabb.getMin());
|
|
11399
|
-
// const max = vec3.min(vec3.create(), this.getMax(), aabb.getMax());
|
|
11400
|
-
var min = maxVec3([0, 0, 0], this.getMin(), aabb.getMin());
|
|
11401
|
-
var max = minVec3([0, 0, 0], this.getMax(), aabb.getMax());
|
|
11402
|
-
intersection.setMinMax(min, max);
|
|
11403
|
-
return intersection;
|
|
11404
|
-
}
|
|
11405
|
-
// containsPoint(point: vec3) {
|
|
11406
|
-
// const min = this.getMin();
|
|
11407
|
-
// const max = this.getMax();
|
|
11408
|
-
// return !(
|
|
11409
|
-
// point[0] < min[0] ||
|
|
11410
|
-
// point[0] > max[0] ||
|
|
11411
|
-
// point[1] < min[1] ||
|
|
11412
|
-
// point[1] > max[1] ||
|
|
11413
|
-
// point[2] < min[2] ||
|
|
11414
|
-
// point[2] > max[2]
|
|
11415
|
-
// );
|
|
11416
|
-
// }
|
|
11417
|
-
/**
|
|
11418
|
-
* get n-vertex
|
|
11419
|
-
* @param plane plane of CullingVolume
|
|
11420
|
-
*/;
|
|
11421
|
-
_proto.getNegativeFarPoint = function getNegativeFarPoint(plane) {
|
|
11422
|
-
if (plane.pnVertexFlag === 0x111) {
|
|
11423
|
-
return copyVec3([0, 0, 0], this.min);
|
|
11424
|
-
// return vec3.copy(vec3.create(), this.min);
|
|
11425
|
-
} else if (plane.pnVertexFlag === 0x110) {
|
|
11426
|
-
return [this.min[0], this.min[1], this.max[2]];
|
|
11427
|
-
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
11428
|
-
} else if (plane.pnVertexFlag === 0x101) {
|
|
11429
|
-
return [this.min[0], this.max[1], this.min[2]];
|
|
11430
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
11431
|
-
} else if (plane.pnVertexFlag === 0x100) {
|
|
11432
|
-
return [this.min[0], this.max[1], this.max[2]];
|
|
11433
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
11434
|
-
} else if (plane.pnVertexFlag === 0x011) {
|
|
11435
|
-
return [this.max[0], this.min[1], this.min[2]];
|
|
11436
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
11437
|
-
} else if (plane.pnVertexFlag === 0x010) {
|
|
11438
|
-
return [this.max[0], this.min[1], this.max[2]];
|
|
11439
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
11440
|
-
} else if (plane.pnVertexFlag === 0x001) {
|
|
11441
|
-
return [this.max[0], this.max[1], this.min[2]];
|
|
11442
|
-
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
11443
|
-
} else {
|
|
11444
|
-
return [this.max[0], this.max[1], this.max[2]];
|
|
11445
|
-
// return vec3.fromValues(this.max[0], this.max[1], this.max[2]);
|
|
11446
|
-
}
|
|
11447
|
-
}
|
|
11448
|
-
/**
|
|
11449
|
-
* get p-vertex
|
|
11450
|
-
* @param plane plane of CullingVolume
|
|
11451
|
-
*/;
|
|
11452
|
-
_proto.getPositiveFarPoint = function getPositiveFarPoint(plane) {
|
|
11453
|
-
if (plane.pnVertexFlag === 0x111) {
|
|
11454
|
-
return copyVec3([0, 0, 0], this.max);
|
|
11455
|
-
// return vec3.copy(vec3.create(), this.max);
|
|
11456
|
-
} else if (plane.pnVertexFlag === 0x110) {
|
|
11457
|
-
return [this.max[0], this.max[1], this.min[2]];
|
|
11458
|
-
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
11459
|
-
} else if (plane.pnVertexFlag === 0x101) {
|
|
11460
|
-
return [this.max[0], this.min[1], this.max[2]];
|
|
11461
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
11462
|
-
} else if (plane.pnVertexFlag === 0x100) {
|
|
11463
|
-
return [this.max[0], this.min[1], this.min[2]];
|
|
11464
|
-
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
11465
|
-
} else if (plane.pnVertexFlag === 0x011) {
|
|
11466
|
-
return [this.min[0], this.max[1], this.max[2]];
|
|
11467
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
11468
|
-
} else if (plane.pnVertexFlag === 0x010) {
|
|
11469
|
-
return [this.min[0], this.max[1], this.min[2]];
|
|
11470
|
-
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
11471
|
-
} else if (plane.pnVertexFlag === 0x001) {
|
|
11472
|
-
return [this.min[0], this.min[1], this.max[2]];
|
|
11473
|
-
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
11474
|
-
} else {
|
|
11475
|
-
return [this.min[0], this.min[1], this.min[2]];
|
|
11476
|
-
// return vec3.fromValues(this.min[0], this.min[1], this.min[2]);
|
|
11477
|
-
}
|
|
11478
|
-
};
|
|
11479
|
-
return AABB;
|
|
11480
|
-
}();
|
|
11481
|
-
|
|
11482
|
-
var Plane = /*#__PURE__*/function () {
|
|
11483
|
-
/**
|
|
11484
|
-
* lookup table for p-vertex & n-vertex when doing frustum culling
|
|
11485
|
-
*/
|
|
11486
|
-
|
|
11487
|
-
function Plane(distance, normal) {
|
|
11488
|
-
this.distance = void 0;
|
|
11489
|
-
this.normal = void 0;
|
|
11490
|
-
this.pnVertexFlag = void 0;
|
|
11491
|
-
this.distance = distance || 0;
|
|
11492
|
-
this.normal = normal || fromValues$2(0, 1, 0);
|
|
11493
|
-
this.updatePNVertexFlag();
|
|
11494
|
-
}
|
|
11495
|
-
var _proto = Plane.prototype;
|
|
11496
|
-
_proto.updatePNVertexFlag = function updatePNVertexFlag() {
|
|
11497
|
-
this.pnVertexFlag = (Number(this.normal[0] >= 0) << 8) + (Number(this.normal[1] >= 0) << 4) + Number(this.normal[2] >= 0);
|
|
11498
|
-
};
|
|
11499
|
-
_proto.distanceToPoint = function distanceToPoint(point) {
|
|
11500
|
-
return dot(point, this.normal) - this.distance;
|
|
11501
|
-
};
|
|
11502
|
-
_proto.normalize = function normalize() {
|
|
11503
|
-
var invLen = 1 / len(this.normal);
|
|
11504
|
-
scale$1(this.normal, this.normal, invLen);
|
|
11505
|
-
this.distance *= invLen;
|
|
11506
|
-
};
|
|
11507
|
-
_proto.intersectsLine = function intersectsLine(start, end, point) {
|
|
11508
|
-
var d0 = this.distanceToPoint(start);
|
|
11509
|
-
var d1 = this.distanceToPoint(end);
|
|
11510
|
-
var t = d0 / (d0 - d1);
|
|
11511
|
-
var intersects = t >= 0 && t <= 1;
|
|
11512
|
-
if (intersects && point) {
|
|
11513
|
-
lerp(point, start, end, t);
|
|
11514
|
-
}
|
|
11515
|
-
return intersects;
|
|
11516
|
-
};
|
|
11517
|
-
return Plane;
|
|
11518
|
-
}();
|
|
11519
|
-
|
|
11520
|
-
(function (Mask) {
|
|
11521
|
-
Mask[Mask["OUTSIDE"] = 4294967295] = "OUTSIDE";
|
|
11522
|
-
Mask[Mask["INSIDE"] = 0] = "INSIDE";
|
|
11523
|
-
Mask[Mask["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
|
|
11524
|
-
})(exports.Mask || (exports.Mask = {}));
|
|
11525
|
-
var Frustum = /*#__PURE__*/function () {
|
|
11526
|
-
function Frustum(planes) {
|
|
11527
|
-
this.planes = [];
|
|
11528
|
-
if (planes) {
|
|
11529
|
-
this.planes = planes;
|
|
11530
|
-
} else {
|
|
11531
|
-
for (var i = 0; i < 6; i++) {
|
|
11532
|
-
this.planes.push(new Plane());
|
|
11533
|
-
}
|
|
11534
|
-
}
|
|
11535
|
-
}
|
|
11536
|
-
/**
|
|
11537
|
-
* extract 6 planes from projectionMatrix
|
|
11538
|
-
* @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
|
|
11539
|
-
*/
|
|
11540
|
-
var _proto = Frustum.prototype;
|
|
11541
|
-
_proto.extractFromVPMatrix = function extractFromVPMatrix(projectionMatrix) {
|
|
11542
|
-
// @ts-ignore
|
|
11543
|
-
var m0 = projectionMatrix[0],
|
|
11544
|
-
m1 = projectionMatrix[1],
|
|
11545
|
-
m2 = projectionMatrix[2],
|
|
11546
|
-
m3 = projectionMatrix[3],
|
|
11547
|
-
m4 = projectionMatrix[4],
|
|
11548
|
-
m5 = projectionMatrix[5],
|
|
11549
|
-
m6 = projectionMatrix[6],
|
|
11550
|
-
m7 = projectionMatrix[7],
|
|
11551
|
-
m8 = projectionMatrix[8],
|
|
11552
|
-
m9 = projectionMatrix[9],
|
|
11553
|
-
m10 = projectionMatrix[10],
|
|
11554
|
-
m11 = projectionMatrix[11],
|
|
11555
|
-
m12 = projectionMatrix[12],
|
|
11556
|
-
m13 = projectionMatrix[13],
|
|
11557
|
-
m14 = projectionMatrix[14],
|
|
11558
|
-
m15 = projectionMatrix[15];
|
|
11559
|
-
// right
|
|
11560
|
-
set$1(this.planes[0].normal, m3 - m0, m7 - m4, m11 - m8);
|
|
11561
|
-
this.planes[0].distance = m15 - m12;
|
|
11562
|
-
// left
|
|
11563
|
-
set$1(this.planes[1].normal, m3 + m0, m7 + m4, m11 + m8);
|
|
11564
|
-
this.planes[1].distance = m15 + m12;
|
|
11565
|
-
// bottom
|
|
11566
|
-
set$1(this.planes[2].normal, m3 + m1, m7 + m5, m11 + m9);
|
|
11567
|
-
this.planes[2].distance = m15 + m13;
|
|
11568
|
-
// top
|
|
11569
|
-
set$1(this.planes[3].normal, m3 - m1, m7 - m5, m11 - m9);
|
|
11570
|
-
this.planes[3].distance = m15 - m13;
|
|
11571
|
-
// far
|
|
11572
|
-
set$1(this.planes[4].normal, m3 - m2, m7 - m6, m11 - m10);
|
|
11573
|
-
this.planes[4].distance = m15 - m14;
|
|
11574
|
-
// near
|
|
11575
|
-
set$1(this.planes[5].normal, m3 + m2, m7 + m6, m11 + m10);
|
|
11576
|
-
this.planes[5].distance = m15 + m14;
|
|
11577
|
-
this.planes.forEach(function (plane) {
|
|
11578
|
-
plane.normalize();
|
|
11579
|
-
plane.updatePNVertexFlag();
|
|
11580
|
-
});
|
|
11581
|
-
};
|
|
11582
|
-
return Frustum;
|
|
11583
|
-
}();
|
|
11584
|
-
|
|
11585
|
-
var Point = /*#__PURE__*/function () {
|
|
11586
|
-
function Point(x, y) {
|
|
11587
|
-
if (x === void 0) {
|
|
11588
|
-
x = 0;
|
|
11589
|
-
}
|
|
11590
|
-
if (y === void 0) {
|
|
11591
|
-
y = 0;
|
|
11592
|
-
}
|
|
11593
|
-
this.x = 0;
|
|
11594
|
-
this.y = 0;
|
|
11595
|
-
this.x = x;
|
|
11596
|
-
this.y = y;
|
|
11597
|
-
}
|
|
11598
|
-
var _proto = Point.prototype;
|
|
11599
|
-
_proto.clone = function clone() {
|
|
11600
|
-
return new Point(this.x, this.y);
|
|
11601
|
-
};
|
|
11602
|
-
_proto.copyFrom = function copyFrom(p) {
|
|
11603
|
-
this.x = p.x;
|
|
11604
|
-
this.y = p.y;
|
|
11605
|
-
};
|
|
11606
|
-
return Point;
|
|
11607
|
-
}();
|
|
11608
|
-
|
|
11609
|
-
var Rectangle = /*#__PURE__*/function () {
|
|
11610
|
-
function Rectangle(x, y, width, height) {
|
|
11611
|
-
this.x = void 0;
|
|
11612
|
-
this.y = void 0;
|
|
11613
|
-
this.width = void 0;
|
|
11614
|
-
this.height = void 0;
|
|
11615
|
-
this.left = void 0;
|
|
11616
|
-
this.right = void 0;
|
|
11617
|
-
this.top = void 0;
|
|
11618
|
-
this.bottom = void 0;
|
|
11619
|
-
this.x = x;
|
|
11620
|
-
this.y = y;
|
|
11621
|
-
this.width = width;
|
|
11622
|
-
this.height = height;
|
|
11623
|
-
this.left = x;
|
|
11624
|
-
this.right = x + width;
|
|
11625
|
-
this.top = y;
|
|
11626
|
-
this.bottom = y + height;
|
|
11627
|
-
}
|
|
11628
|
-
var _proto = Rectangle.prototype;
|
|
11629
|
-
_proto.toJSON = function toJSON() {};
|
|
11630
|
-
return Rectangle;
|
|
11631
|
-
}();
|
|
11632
|
-
|
|
11633
|
-
function parseDimension(unitRegExp, string) {
|
|
11634
|
-
if (isNil(string)) {
|
|
11635
|
-
return getOrCreateUnitValue(0, 'px');
|
|
11636
|
-
}
|
|
11637
|
-
string = ("" + string).trim().toLowerCase();
|
|
11638
|
-
if (isFinite(Number(string))) {
|
|
11639
|
-
if ('px'.search(unitRegExp) >= 0) {
|
|
11640
|
-
return getOrCreateUnitValue(Number(string), 'px');
|
|
11641
|
-
} else if ('deg'.search(unitRegExp) >= 0) {
|
|
11642
|
-
return getOrCreateUnitValue(Number(string), 'deg');
|
|
11643
|
-
}
|
|
11644
|
-
}
|
|
11645
|
-
var matchedUnits = [];
|
|
11646
|
-
string = string.replace(unitRegExp, function (match) {
|
|
11647
|
-
matchedUnits.push(match);
|
|
11648
|
-
return 'U' + match;
|
|
11649
|
-
});
|
|
11650
|
-
var taggedUnitRegExp = 'U(' + unitRegExp.source + ')';
|
|
11651
|
-
return matchedUnits.map(function (unit) {
|
|
11652
|
-
return getOrCreateUnitValue(Number(string.replace(new RegExp('U' + unit, 'g'), '').replace(new RegExp(taggedUnitRegExp, 'g'), '*0')), unit);
|
|
11653
|
-
})[0];
|
|
11654
|
-
}
|
|
11655
|
-
/**
|
|
11656
|
-
* <length>
|
|
11657
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length
|
|
11658
|
-
* length with only absolute unit, eg. 1px
|
|
11659
|
-
*/
|
|
11660
|
-
var parseLength = memoize(function (css) {
|
|
11661
|
-
return parseDimension(new RegExp('px', 'g'), css);
|
|
11662
|
-
});
|
|
11663
|
-
/**
|
|
11664
|
-
* <percentage>
|
|
11665
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/percentage
|
|
11666
|
-
*/
|
|
11667
|
-
var parserPercentage = memoize(function (css) {
|
|
11668
|
-
return parseDimension(new RegExp('%', 'g'), css);
|
|
11669
|
-
});
|
|
11670
|
-
/**
|
|
11671
|
-
* length with absolute or relative unit,
|
|
11672
|
-
* eg. 1px, 0.7em, 50%, calc(100% - 200px);
|
|
11673
|
-
*
|
|
11674
|
-
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/length-percentage
|
|
11675
|
-
*/
|
|
11676
|
-
// export const parseLengthOrPercentage = memoize((css: string): CSSUnitValue => {
|
|
11677
|
-
// if (isNumber(css) || isFinite(Number(css))) {
|
|
11678
|
-
// return getOrCreateUnitValue(Number(css), 'px');
|
|
11679
|
-
// }
|
|
11680
|
-
// return parseDimension(new RegExp('px|%|em|rem', 'g'), css) as CSSUnitValue;
|
|
11681
|
-
// });
|
|
11682
|
-
var parseLengthOrPercentage = function parseLengthOrPercentage(css) {
|
|
11683
|
-
if (isNumber(css) || isFinite(Number(css))) {
|
|
11684
|
-
return getOrCreateUnitValue(Number(css), 'px');
|
|
11685
|
-
// return Number(css);
|
|
11686
|
-
}
|
|
11687
|
-
|
|
11688
|
-
return parseDimension(new RegExp('px|%|em|rem', 'g'), css);
|
|
11689
|
-
};
|
|
11690
|
-
var parseAngle = memoize(function (css) {
|
|
11691
|
-
return parseDimension(new RegExp('deg|rad|grad|turn', 'g'), css);
|
|
11692
|
-
});
|
|
11693
|
-
/**
|
|
11694
|
-
* merge CSSUnitValue
|
|
11695
|
-
*
|
|
11696
|
-
* @example
|
|
11697
|
-
* 10px + 20px = 30px
|
|
11698
|
-
* 10deg + 10rad
|
|
11699
|
-
* 10% + 20% = 30%
|
|
11700
|
-
*/
|
|
11701
|
-
function mergeDimensions(left, right, target, nonNegative, index) {
|
|
11702
|
-
if (index === void 0) {
|
|
11703
|
-
index = 0;
|
|
11704
|
-
}
|
|
11705
|
-
var unit = '';
|
|
11706
|
-
var leftValue = left.value || 0;
|
|
11707
|
-
var rightValue = right.value || 0;
|
|
11708
|
-
var canonicalUnit = toCanonicalUnit(left.unit);
|
|
11709
|
-
var leftCanonicalUnitValue = left.convertTo(canonicalUnit);
|
|
11710
|
-
var rightCanonicalUnitValue = right.convertTo(canonicalUnit);
|
|
11711
|
-
if (leftCanonicalUnitValue && rightCanonicalUnitValue) {
|
|
11712
|
-
leftValue = leftCanonicalUnitValue.value;
|
|
11713
|
-
rightValue = rightCanonicalUnitValue.value;
|
|
11714
|
-
unit = unitTypeToString(left.unit);
|
|
11715
|
-
} else {
|
|
11716
|
-
// format '%' to 'px'
|
|
11717
|
-
if (CSSUnitValue.isLength(left.unit) || CSSUnitValue.isLength(right.unit)) {
|
|
11718
|
-
leftValue = convertPercentUnit(left, index, target);
|
|
11719
|
-
rightValue = convertPercentUnit(right, index, target);
|
|
11720
|
-
unit = 'px';
|
|
11721
|
-
}
|
|
11722
|
-
}
|
|
11723
|
-
// // format 'rad' 'turn' to 'deg'
|
|
11724
|
-
// if (CSSUnitValue.isAngle(left.unit) || CSSUnitValue.isAngle(right.unit)) {
|
|
11725
|
-
// leftValue = convertAngleUnit(left);
|
|
11726
|
-
// rightValue = convertAngleUnit(right);
|
|
11727
|
-
// unit = 'deg';
|
|
11728
|
-
// }
|
|
11729
|
-
return [leftValue, rightValue, function (value) {
|
|
11730
|
-
if (nonNegative) {
|
|
11731
|
-
value = Math.max(value, 0);
|
|
11732
|
-
}
|
|
11733
|
-
return value + unit;
|
|
11734
|
-
}];
|
|
11735
|
-
}
|
|
11736
|
-
function convertAngleUnit(value) {
|
|
11737
|
-
var deg = 0;
|
|
11738
|
-
if (value.unit === exports.UnitType.kDegrees) {
|
|
11739
|
-
deg = value.value;
|
|
11740
|
-
} else if (value.unit === exports.UnitType.kRadians) {
|
|
11741
|
-
deg = rad2deg(Number(value.value));
|
|
11742
|
-
} else if (value.unit === exports.UnitType.kTurns) {
|
|
11743
|
-
deg = turn2deg(Number(value.value));
|
|
11744
|
-
}
|
|
11745
|
-
return deg;
|
|
11746
|
-
}
|
|
11747
|
-
function parseDimensionArrayFormat(string, size) {
|
|
11748
|
-
var parsed;
|
|
11749
|
-
if (Array.isArray(string)) {
|
|
11750
|
-
// [1, '2px', 3]
|
|
11751
|
-
parsed = string.map(function (segment) {
|
|
11752
|
-
return Number(segment);
|
|
11753
|
-
});
|
|
11754
|
-
} else if (isString(string)) {
|
|
11755
|
-
parsed = string.split(' ').map(function (segment) {
|
|
11756
|
-
return Number(segment);
|
|
11757
|
-
});
|
|
11758
|
-
} else if (isNumber(string)) {
|
|
11759
|
-
parsed = [string];
|
|
11760
|
-
}
|
|
11761
|
-
if (size === 2) {
|
|
11762
|
-
if (parsed.length === 1) {
|
|
11763
|
-
return [parsed[0], parsed[0]];
|
|
11764
|
-
} else {
|
|
11765
|
-
return [parsed[0], parsed[1]];
|
|
11766
|
-
}
|
|
11767
|
-
} else {
|
|
11768
|
-
if (parsed.length === 1) {
|
|
11769
|
-
return [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
11770
|
-
} else if (parsed.length === 2) {
|
|
11771
|
-
return [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
11772
|
-
} else if (parsed.length === 3) {
|
|
11773
|
-
return [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
11774
|
-
} else {
|
|
11775
|
-
return [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
11350
|
+
} else {
|
|
11351
|
+
if (parsed.length === 1) {
|
|
11352
|
+
return [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
11353
|
+
} else if (parsed.length === 2) {
|
|
11354
|
+
return [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
11355
|
+
} else if (parsed.length === 3) {
|
|
11356
|
+
return [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
11357
|
+
} else {
|
|
11358
|
+
return [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
11776
11359
|
}
|
|
11777
11360
|
}
|
|
11778
11361
|
}
|
|
@@ -11807,17 +11390,16 @@
|
|
|
11807
11390
|
// ];
|
|
11808
11391
|
// }
|
|
11809
11392
|
function convertPercentUnit(valueWithUnit, vec3Index, target) {
|
|
11393
|
+
if (valueWithUnit.value === 0) {
|
|
11394
|
+
return 0;
|
|
11395
|
+
}
|
|
11810
11396
|
if (valueWithUnit.unit === exports.UnitType.kPixels) {
|
|
11811
11397
|
return Number(valueWithUnit.value);
|
|
11812
11398
|
} else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
|
|
11813
11399
|
var bounds = target.nodeName === exports.Shape.GROUP ? target.getLocalBounds() :
|
|
11814
11400
|
// : target.getGeometryBounds();
|
|
11815
11401
|
target.geometry.contentBounds;
|
|
11816
|
-
|
|
11817
|
-
if (!AABB.isEmpty(bounds)) {
|
|
11818
|
-
size = bounds.halfExtents[vec3Index] * 2;
|
|
11819
|
-
}
|
|
11820
|
-
return Number(valueWithUnit.value) / 100 * size;
|
|
11402
|
+
return valueWithUnit.value / 100 * bounds.halfExtents[vec3Index] * 2;
|
|
11821
11403
|
}
|
|
11822
11404
|
return 0;
|
|
11823
11405
|
}
|
|
@@ -12507,420 +12089,830 @@
|
|
|
12507
12089
|
leftResult = rightResult;
|
|
12508
12090
|
rightResult = tmp;
|
|
12509
12091
|
}
|
|
12510
|
-
return [leftResult, rightResult, function (list) {
|
|
12511
|
-
return list.map(function (args, i) {
|
|
12512
|
-
var stringifiedArgs = args.map(function (arg, j) {
|
|
12513
|
-
return types[i][1][j](arg);
|
|
12514
|
-
}).join(',');
|
|
12515
|
-
if (types[i][0] === 'matrix' && stringifiedArgs.split(',').length === 16) {
|
|
12516
|
-
types[i][0] = 'matrix3d';
|
|
12517
|
-
}
|
|
12518
|
-
if (types[i][0] === 'matrix3d' && stringifiedArgs.split(',').length === 6) {
|
|
12519
|
-
types[i][0] = 'matrix';
|
|
12520
|
-
}
|
|
12521
|
-
return types[i][0] + '(' + stringifiedArgs + ')';
|
|
12522
|
-
}).join(' ');
|
|
12523
|
-
}];
|
|
12524
|
-
}
|
|
12092
|
+
return [leftResult, rightResult, function (list) {
|
|
12093
|
+
return list.map(function (args, i) {
|
|
12094
|
+
var stringifiedArgs = args.map(function (arg, j) {
|
|
12095
|
+
return types[i][1][j](arg);
|
|
12096
|
+
}).join(',');
|
|
12097
|
+
if (types[i][0] === 'matrix' && stringifiedArgs.split(',').length === 16) {
|
|
12098
|
+
types[i][0] = 'matrix3d';
|
|
12099
|
+
}
|
|
12100
|
+
if (types[i][0] === 'matrix3d' && stringifiedArgs.split(',').length === 6) {
|
|
12101
|
+
types[i][0] = 'matrix';
|
|
12102
|
+
}
|
|
12103
|
+
return types[i][0] + '(' + stringifiedArgs + ')';
|
|
12104
|
+
}).join(' ');
|
|
12105
|
+
}];
|
|
12106
|
+
}
|
|
12107
|
+
|
|
12108
|
+
/**
|
|
12109
|
+
* @see https://developer.mozilla.org/zh-CN/docs/Web/CSS/transform-origin
|
|
12110
|
+
* eg. 'center' 'top left' '50px 50px'
|
|
12111
|
+
*/
|
|
12112
|
+
var parseTransformOrigin = memoize(function (value) {
|
|
12113
|
+
if (isString(value)) {
|
|
12114
|
+
if (value === 'text-anchor') {
|
|
12115
|
+
return [getOrCreateUnitValue(0, 'px'), getOrCreateUnitValue(0, 'px')];
|
|
12116
|
+
}
|
|
12117
|
+
var values = value.split(' ');
|
|
12118
|
+
if (values.length === 1) {
|
|
12119
|
+
if (values[0] === 'top' || values[0] === 'bottom') {
|
|
12120
|
+
// 'top' -> 'center top'
|
|
12121
|
+
values[1] = values[0];
|
|
12122
|
+
values[0] = 'center';
|
|
12123
|
+
} else {
|
|
12124
|
+
// '50px' -> '50px center'
|
|
12125
|
+
values[1] = 'center';
|
|
12126
|
+
}
|
|
12127
|
+
}
|
|
12128
|
+
if (values.length !== 2) {
|
|
12129
|
+
return null;
|
|
12130
|
+
}
|
|
12131
|
+
// eg. center bottom
|
|
12132
|
+
return [parseLengthOrPercentage(convertKeyword2Percent(values[0])), parseLengthOrPercentage(convertKeyword2Percent(values[1]))];
|
|
12133
|
+
} else {
|
|
12134
|
+
return [getOrCreateUnitValue(value[0] || 0, 'px'), getOrCreateUnitValue(value[1] || 0, 'px')];
|
|
12135
|
+
}
|
|
12136
|
+
});
|
|
12137
|
+
function convertKeyword2Percent(keyword) {
|
|
12138
|
+
if (keyword === 'center') {
|
|
12139
|
+
return '50%';
|
|
12140
|
+
} else if (keyword === 'left' || keyword === 'top') {
|
|
12141
|
+
return '0';
|
|
12142
|
+
} else if (keyword === 'right' || keyword === 'bottom') {
|
|
12143
|
+
return '100%';
|
|
12144
|
+
}
|
|
12145
|
+
return keyword;
|
|
12146
|
+
}
|
|
12147
|
+
|
|
12148
|
+
var CSSPropertyAngle = /*#__PURE__*/function () {
|
|
12149
|
+
function CSSPropertyAngle() {
|
|
12150
|
+
this.parser = parseAngle;
|
|
12151
|
+
this.parserWithCSSDisabled = null;
|
|
12152
|
+
this.mixer = mergeNumbers;
|
|
12153
|
+
}
|
|
12154
|
+
var _proto = CSSPropertyAngle.prototype;
|
|
12155
|
+
_proto.calculator = function calculator(name, oldParsed, parsed, object) {
|
|
12156
|
+
return convertAngleUnit(parsed);
|
|
12157
|
+
};
|
|
12158
|
+
return CSSPropertyAngle;
|
|
12159
|
+
}();
|
|
12160
|
+
|
|
12161
|
+
/**
|
|
12162
|
+
* clipPath / textPath / offsetPath
|
|
12163
|
+
*/
|
|
12164
|
+
var CSSPropertyClipPath = /*#__PURE__*/function () {
|
|
12165
|
+
function CSSPropertyClipPath() {}
|
|
12166
|
+
var _proto = CSSPropertyClipPath.prototype;
|
|
12167
|
+
_proto.calculator = function calculator(name, oldPath, newPath, object) {
|
|
12168
|
+
// unset
|
|
12169
|
+
if (newPath instanceof CSSKeywordValue) {
|
|
12170
|
+
newPath = null;
|
|
12171
|
+
}
|
|
12172
|
+
runtime.sceneGraphService.updateDisplayObjectDependency(name, oldPath, newPath, object);
|
|
12173
|
+
if (name === 'clipPath') {
|
|
12174
|
+
// should affect children
|
|
12175
|
+
object.forEach(function (leaf) {
|
|
12176
|
+
if (leaf.childNodes.length === 0) {
|
|
12177
|
+
runtime.sceneGraphService.dirtifyToRoot(leaf);
|
|
12178
|
+
}
|
|
12179
|
+
});
|
|
12180
|
+
}
|
|
12181
|
+
return newPath;
|
|
12182
|
+
};
|
|
12183
|
+
return CSSPropertyClipPath;
|
|
12184
|
+
}();
|
|
12185
|
+
|
|
12186
|
+
var CSSPropertyColor = /*#__PURE__*/function () {
|
|
12187
|
+
function CSSPropertyColor() {
|
|
12188
|
+
this.parser = parseColor;
|
|
12189
|
+
this.parserWithCSSDisabled = parseColor;
|
|
12190
|
+
this.mixer = mergeColors;
|
|
12191
|
+
}
|
|
12192
|
+
var _proto = CSSPropertyColor.prototype;
|
|
12193
|
+
_proto.calculator = function calculator(name, oldParsed, parsed, object) {
|
|
12194
|
+
if (parsed instanceof CSSKeywordValue) {
|
|
12195
|
+
// 'unset' 'none'
|
|
12196
|
+
return parsed.value === 'none' ? noneColor : transparentColor;
|
|
12197
|
+
}
|
|
12198
|
+
return parsed;
|
|
12199
|
+
};
|
|
12200
|
+
return CSSPropertyColor;
|
|
12201
|
+
}();
|
|
12202
|
+
|
|
12203
|
+
var CSSPropertyFilter = /*#__PURE__*/function () {
|
|
12204
|
+
function CSSPropertyFilter() {
|
|
12205
|
+
this.parser = parseFilter;
|
|
12206
|
+
}
|
|
12207
|
+
var _proto = CSSPropertyFilter.prototype;
|
|
12208
|
+
_proto.calculator = function calculator(name, oldParsed, parsed) {
|
|
12209
|
+
// unset or none
|
|
12210
|
+
if (parsed instanceof CSSKeywordValue) {
|
|
12211
|
+
return [];
|
|
12212
|
+
}
|
|
12213
|
+
return parsed;
|
|
12214
|
+
};
|
|
12215
|
+
return CSSPropertyFilter;
|
|
12216
|
+
}();
|
|
12525
12217
|
|
|
12218
|
+
function getFontSize(object) {
|
|
12219
|
+
var fontSize = object.parsedStyle.fontSize;
|
|
12220
|
+
return isNil(fontSize) ? null : fontSize;
|
|
12221
|
+
}
|
|
12526
12222
|
/**
|
|
12527
|
-
*
|
|
12528
|
-
* eg. 'center' 'top left' '50px 50px'
|
|
12223
|
+
* <length> & <percentage>
|
|
12529
12224
|
*/
|
|
12530
|
-
var
|
|
12531
|
-
|
|
12532
|
-
|
|
12533
|
-
|
|
12225
|
+
var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
|
|
12226
|
+
function CSSPropertyLengthOrPercentage() {
|
|
12227
|
+
this.parser = parseLengthOrPercentage;
|
|
12228
|
+
this.parserWithCSSDisabled = null;
|
|
12229
|
+
this.mixer = mergeNumbers;
|
|
12230
|
+
}
|
|
12231
|
+
var _proto = CSSPropertyLengthOrPercentage.prototype;
|
|
12232
|
+
/**
|
|
12233
|
+
* according to parent's bounds
|
|
12234
|
+
*
|
|
12235
|
+
* @example
|
|
12236
|
+
* CSS.percent(50) -> CSS.px(0.5 * parent.width)
|
|
12237
|
+
*/
|
|
12238
|
+
_proto.calculator = function calculator(name, oldParsed, computed, object, registry) {
|
|
12239
|
+
if (isNumber(computed)) {
|
|
12240
|
+
return computed;
|
|
12534
12241
|
}
|
|
12535
|
-
|
|
12536
|
-
|
|
12537
|
-
|
|
12538
|
-
|
|
12539
|
-
|
|
12540
|
-
|
|
12541
|
-
|
|
12542
|
-
|
|
12543
|
-
|
|
12242
|
+
if (CSSUnitValue.isRelativeUnit(computed.unit)) {
|
|
12243
|
+
if (computed.unit === exports.UnitType.kPercentage) {
|
|
12244
|
+
// TODO: merge dimensions
|
|
12245
|
+
return 0;
|
|
12246
|
+
} else if (computed.unit === exports.UnitType.kEms) {
|
|
12247
|
+
if (object.parentNode) {
|
|
12248
|
+
var fontSize = getFontSize(object.parentNode);
|
|
12249
|
+
if (fontSize) {
|
|
12250
|
+
fontSize *= computed.value;
|
|
12251
|
+
return fontSize;
|
|
12252
|
+
} else {
|
|
12253
|
+
registry.addUnresolveProperty(object, name);
|
|
12254
|
+
}
|
|
12255
|
+
} else {
|
|
12256
|
+
registry.addUnresolveProperty(object, name);
|
|
12257
|
+
}
|
|
12258
|
+
return 0;
|
|
12259
|
+
} else if (computed.unit === exports.UnitType.kRems) {
|
|
12260
|
+
var _object$ownerDocument;
|
|
12261
|
+
if (object === null || object === void 0 ? void 0 : (_object$ownerDocument = object.ownerDocument) === null || _object$ownerDocument === void 0 ? void 0 : _object$ownerDocument.documentElement) {
|
|
12262
|
+
var _fontSize = getFontSize(object.ownerDocument.documentElement);
|
|
12263
|
+
if (_fontSize) {
|
|
12264
|
+
_fontSize *= computed.value;
|
|
12265
|
+
return _fontSize;
|
|
12266
|
+
} else {
|
|
12267
|
+
registry.addUnresolveProperty(object, name);
|
|
12268
|
+
}
|
|
12269
|
+
} else {
|
|
12270
|
+
registry.addUnresolveProperty(object, name);
|
|
12271
|
+
}
|
|
12272
|
+
return 0;
|
|
12544
12273
|
}
|
|
12274
|
+
} else {
|
|
12275
|
+
// remove listener if exists
|
|
12276
|
+
// registry.unregisterParentGeometryBoundsChangedHandler(object, name);
|
|
12277
|
+
// return absolute value
|
|
12278
|
+
return computed.value;
|
|
12545
12279
|
}
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12280
|
+
};
|
|
12281
|
+
return CSSPropertyLengthOrPercentage;
|
|
12282
|
+
}();
|
|
12283
|
+
|
|
12284
|
+
/**
|
|
12285
|
+
* format to Tuple2<CSSUnitValue>
|
|
12286
|
+
*
|
|
12287
|
+
* @example
|
|
12288
|
+
* rect.style.lineDash = 10;
|
|
12289
|
+
* rect.style.lineDash = [10, 10];
|
|
12290
|
+
* rect.style.lineDash = '10 10';
|
|
12291
|
+
*/
|
|
12292
|
+
var CSSPropertyLengthOrPercentage12 = /*#__PURE__*/function () {
|
|
12293
|
+
function CSSPropertyLengthOrPercentage12() {
|
|
12294
|
+
this.mixer = mergeNumberLists;
|
|
12553
12295
|
}
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12296
|
+
var _proto = CSSPropertyLengthOrPercentage12.prototype;
|
|
12297
|
+
_proto.parser = function parser(radius) {
|
|
12298
|
+
var parsed = parseDimensionArray(isNumber(radius) ? [radius] : radius);
|
|
12299
|
+
var formatted;
|
|
12300
|
+
if (parsed.length === 1) {
|
|
12301
|
+
formatted = [parsed[0], parsed[0]];
|
|
12302
|
+
} else {
|
|
12303
|
+
formatted = [parsed[0], parsed[1]];
|
|
12304
|
+
}
|
|
12305
|
+
return formatted;
|
|
12306
|
+
};
|
|
12307
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12308
|
+
return computed.map(function (c) {
|
|
12309
|
+
return c.value;
|
|
12310
|
+
});
|
|
12311
|
+
};
|
|
12312
|
+
return CSSPropertyLengthOrPercentage12;
|
|
12313
|
+
}();
|
|
12314
|
+
|
|
12315
|
+
/**
|
|
12316
|
+
* used in rounded rect
|
|
12317
|
+
*
|
|
12318
|
+
* @example
|
|
12319
|
+
* rect.style.radius = 10;
|
|
12320
|
+
* rect.style.radius = '10 10';
|
|
12321
|
+
* rect.style.radius = '10 10 10 10';
|
|
12322
|
+
*/
|
|
12323
|
+
var CSSPropertyLengthOrPercentage14 = /*#__PURE__*/function () {
|
|
12324
|
+
function CSSPropertyLengthOrPercentage14() {
|
|
12325
|
+
this.mixer = mergeNumberLists;
|
|
12562
12326
|
}
|
|
12563
|
-
|
|
12564
|
-
|
|
12327
|
+
var _proto = CSSPropertyLengthOrPercentage14.prototype;
|
|
12328
|
+
_proto.parser = function parser(radius) {
|
|
12329
|
+
var parsed = parseDimensionArray(isNumber(radius) ? [radius] : radius);
|
|
12330
|
+
var formatted;
|
|
12331
|
+
// format to Tuple<CSSUnitValue>
|
|
12332
|
+
if (parsed.length === 1) {
|
|
12333
|
+
formatted = [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
12334
|
+
} else if (parsed.length === 2) {
|
|
12335
|
+
formatted = [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
12336
|
+
} else if (parsed.length === 3) {
|
|
12337
|
+
formatted = [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
12338
|
+
} else {
|
|
12339
|
+
formatted = [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
12340
|
+
}
|
|
12341
|
+
return formatted;
|
|
12342
|
+
};
|
|
12343
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12344
|
+
return computed.map(function (c) {
|
|
12345
|
+
return c.value;
|
|
12346
|
+
});
|
|
12347
|
+
};
|
|
12348
|
+
return CSSPropertyLengthOrPercentage14;
|
|
12349
|
+
}();
|
|
12565
12350
|
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12351
|
+
/**
|
|
12352
|
+
* local position
|
|
12353
|
+
*/
|
|
12354
|
+
var CSSPropertyLocalPosition = /*#__PURE__*/function (_CSSPropertyLengthOrP) {
|
|
12355
|
+
_inheritsLoose(CSSPropertyLocalPosition, _CSSPropertyLengthOrP);
|
|
12356
|
+
function CSSPropertyLocalPosition() {
|
|
12357
|
+
return _CSSPropertyLengthOrP.apply(this, arguments) || this;
|
|
12571
12358
|
}
|
|
12572
|
-
var _proto =
|
|
12573
|
-
|
|
12574
|
-
|
|
12359
|
+
var _proto = CSSPropertyLocalPosition.prototype;
|
|
12360
|
+
/**
|
|
12361
|
+
* update local position
|
|
12362
|
+
*/
|
|
12363
|
+
_proto.postProcessor = function postProcessor(object, attributes) {
|
|
12364
|
+
var x;
|
|
12365
|
+
var y;
|
|
12366
|
+
var z;
|
|
12367
|
+
switch (object.nodeName) {
|
|
12368
|
+
case exports.Shape.CIRCLE:
|
|
12369
|
+
case exports.Shape.ELLIPSE:
|
|
12370
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
12371
|
+
cx = _object$parsedStyle.cx,
|
|
12372
|
+
cy = _object$parsedStyle.cy;
|
|
12373
|
+
if (!isNil(cx)) {
|
|
12374
|
+
x = cx;
|
|
12375
|
+
}
|
|
12376
|
+
if (!isNil(cy)) {
|
|
12377
|
+
y = cy;
|
|
12378
|
+
}
|
|
12379
|
+
break;
|
|
12380
|
+
case exports.Shape.LINE:
|
|
12381
|
+
var _object$parsedStyle2 = object.parsedStyle,
|
|
12382
|
+
x1 = _object$parsedStyle2.x1,
|
|
12383
|
+
x2 = _object$parsedStyle2.x2,
|
|
12384
|
+
y1 = _object$parsedStyle2.y1,
|
|
12385
|
+
y2 = _object$parsedStyle2.y2;
|
|
12386
|
+
var minX = Math.min(x1, x2);
|
|
12387
|
+
var minY = Math.min(y1, y2);
|
|
12388
|
+
x = minX;
|
|
12389
|
+
y = minY;
|
|
12390
|
+
z = 0;
|
|
12391
|
+
break;
|
|
12392
|
+
case exports.Shape.RECT:
|
|
12393
|
+
case exports.Shape.IMAGE:
|
|
12394
|
+
case exports.Shape.GROUP:
|
|
12395
|
+
case exports.Shape.HTML:
|
|
12396
|
+
case exports.Shape.TEXT:
|
|
12397
|
+
case exports.Shape.MESH:
|
|
12398
|
+
if (!isNil(object.parsedStyle.x)) {
|
|
12399
|
+
x = object.parsedStyle.x;
|
|
12400
|
+
}
|
|
12401
|
+
if (!isNil(object.parsedStyle.y)) {
|
|
12402
|
+
y = object.parsedStyle.y;
|
|
12403
|
+
}
|
|
12404
|
+
break;
|
|
12405
|
+
}
|
|
12406
|
+
if (object.nodeName !== exports.Shape.PATH && object.nodeName !== exports.Shape.POLYLINE && object.nodeName !== exports.Shape.POLYGON) {
|
|
12407
|
+
object.parsedStyle.defX = x || 0;
|
|
12408
|
+
object.parsedStyle.defY = y || 0;
|
|
12409
|
+
}
|
|
12410
|
+
var needResetLocalPosition = !isNil(x) || !isNil(y) || !isNil(z);
|
|
12411
|
+
// only if `transform` won't be processed later
|
|
12412
|
+
if (needResetLocalPosition && attributes.indexOf('transform') === -1) {
|
|
12413
|
+
// account for current transform if needed
|
|
12414
|
+
var transform = object.parsedStyle.transform;
|
|
12415
|
+
if (transform && transform.length) {
|
|
12416
|
+
parsedTransformToMat4(transform, object);
|
|
12417
|
+
} else {
|
|
12418
|
+
var _object$getLocalPosit = object.getLocalPosition(),
|
|
12419
|
+
ox = _object$getLocalPosit[0],
|
|
12420
|
+
oy = _object$getLocalPosit[1],
|
|
12421
|
+
oz = _object$getLocalPosit[2];
|
|
12422
|
+
object.setLocalPosition(isNil(x) ? ox : x, isNil(y) ? oy : y, isNil(z) ? oz : z);
|
|
12423
|
+
}
|
|
12424
|
+
}
|
|
12575
12425
|
};
|
|
12576
|
-
return
|
|
12577
|
-
}();
|
|
12426
|
+
return CSSPropertyLocalPosition;
|
|
12427
|
+
}(CSSPropertyLengthOrPercentage);
|
|
12578
12428
|
|
|
12579
|
-
|
|
12580
|
-
|
|
12581
|
-
|
|
12582
|
-
|
|
12583
|
-
|
|
12584
|
-
var _proto = CSSPropertyClipPath.prototype;
|
|
12585
|
-
_proto.calculator = function calculator(name, oldPath, newPath, object) {
|
|
12429
|
+
var CSSPropertyMarker = /*#__PURE__*/function () {
|
|
12430
|
+
function CSSPropertyMarker() {}
|
|
12431
|
+
var _proto = CSSPropertyMarker.prototype;
|
|
12432
|
+
_proto.calculator = function calculator(name, oldMarker, newMarker, object) {
|
|
12433
|
+
var _newMarker;
|
|
12586
12434
|
// unset
|
|
12587
|
-
if (
|
|
12588
|
-
|
|
12435
|
+
if (newMarker instanceof CSSKeywordValue) {
|
|
12436
|
+
newMarker = null;
|
|
12589
12437
|
}
|
|
12590
|
-
|
|
12591
|
-
if (
|
|
12592
|
-
// should
|
|
12593
|
-
|
|
12594
|
-
if (leaf.childNodes.length === 0) {
|
|
12595
|
-
runtime.sceneGraphService.dirtifyToRoot(leaf);
|
|
12596
|
-
}
|
|
12597
|
-
});
|
|
12438
|
+
var cloned = (_newMarker = newMarker) === null || _newMarker === void 0 ? void 0 : _newMarker.cloneNode(true);
|
|
12439
|
+
if (cloned) {
|
|
12440
|
+
// FIXME: SVG should not inherit parent's style, add a flag here
|
|
12441
|
+
cloned.style.isMarker = true;
|
|
12598
12442
|
}
|
|
12599
|
-
return
|
|
12443
|
+
return cloned;
|
|
12600
12444
|
};
|
|
12601
|
-
return
|
|
12445
|
+
return CSSPropertyMarker;
|
|
12602
12446
|
}();
|
|
12603
12447
|
|
|
12604
|
-
var
|
|
12605
|
-
function
|
|
12606
|
-
this.
|
|
12607
|
-
this.
|
|
12608
|
-
this.
|
|
12448
|
+
var CSSPropertyNumber = /*#__PURE__*/function () {
|
|
12449
|
+
function CSSPropertyNumber() {
|
|
12450
|
+
this.mixer = mergeNumbers;
|
|
12451
|
+
this.parser = parseNumber;
|
|
12452
|
+
this.parserWithCSSDisabled = null;
|
|
12609
12453
|
}
|
|
12610
|
-
var _proto =
|
|
12611
|
-
_proto.calculator = function calculator(name, oldParsed,
|
|
12612
|
-
|
|
12613
|
-
// 'unset' 'none'
|
|
12614
|
-
return parsed.value === 'none' ? noneColor : transparentColor;
|
|
12615
|
-
}
|
|
12616
|
-
return parsed;
|
|
12454
|
+
var _proto = CSSPropertyNumber.prototype;
|
|
12455
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12456
|
+
return computed.value;
|
|
12617
12457
|
};
|
|
12618
|
-
return
|
|
12458
|
+
return CSSPropertyNumber;
|
|
12619
12459
|
}();
|
|
12620
12460
|
|
|
12621
|
-
var
|
|
12622
|
-
function
|
|
12623
|
-
this.parser =
|
|
12461
|
+
var CSSPropertyOffsetDistance = /*#__PURE__*/function () {
|
|
12462
|
+
function CSSPropertyOffsetDistance() {
|
|
12463
|
+
this.parser = parseNumber;
|
|
12464
|
+
this.parserWithCSSDisabled = null;
|
|
12465
|
+
this.mixer = clampedMergeNumbers(0, 1);
|
|
12624
12466
|
}
|
|
12625
|
-
var _proto =
|
|
12626
|
-
_proto.calculator = function calculator(name, oldParsed,
|
|
12627
|
-
|
|
12628
|
-
|
|
12629
|
-
|
|
12467
|
+
var _proto = CSSPropertyOffsetDistance.prototype;
|
|
12468
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12469
|
+
return computed.value;
|
|
12470
|
+
};
|
|
12471
|
+
_proto.postProcessor = function postProcessor(object) {
|
|
12472
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
12473
|
+
offsetPath = _object$parsedStyle.offsetPath,
|
|
12474
|
+
offsetDistance = _object$parsedStyle.offsetDistance;
|
|
12475
|
+
if (!offsetPath) {
|
|
12476
|
+
return;
|
|
12477
|
+
}
|
|
12478
|
+
var nodeName = offsetPath.nodeName;
|
|
12479
|
+
if (nodeName === exports.Shape.LINE || nodeName === exports.Shape.PATH || nodeName === exports.Shape.POLYLINE) {
|
|
12480
|
+
// set position in world space
|
|
12481
|
+
var point = offsetPath.getPoint(offsetDistance);
|
|
12482
|
+
if (point) {
|
|
12483
|
+
object.parsedStyle.defX = point.x;
|
|
12484
|
+
object.parsedStyle.defY = point.y;
|
|
12485
|
+
object.setLocalPosition(point.x, point.y);
|
|
12486
|
+
}
|
|
12630
12487
|
}
|
|
12631
|
-
return parsed;
|
|
12632
12488
|
};
|
|
12633
|
-
return
|
|
12489
|
+
return CSSPropertyOffsetDistance;
|
|
12634
12490
|
}();
|
|
12635
12491
|
|
|
12636
|
-
function getFontSize(object) {
|
|
12637
|
-
var fontSize = object.parsedStyle.fontSize;
|
|
12638
|
-
return isNil(fontSize) ? null : fontSize;
|
|
12639
|
-
}
|
|
12640
12492
|
/**
|
|
12641
|
-
*
|
|
12493
|
+
* opacity
|
|
12642
12494
|
*/
|
|
12643
|
-
var
|
|
12644
|
-
function
|
|
12645
|
-
this.parser =
|
|
12495
|
+
var CSSPropertyOpacity = /*#__PURE__*/function () {
|
|
12496
|
+
function CSSPropertyOpacity() {
|
|
12497
|
+
this.parser = parseNumber;
|
|
12646
12498
|
this.parserWithCSSDisabled = null;
|
|
12647
|
-
this.mixer =
|
|
12499
|
+
this.mixer = clampedMergeNumbers(0, 1);
|
|
12648
12500
|
}
|
|
12649
|
-
var _proto =
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12501
|
+
var _proto = CSSPropertyOpacity.prototype;
|
|
12502
|
+
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12503
|
+
return computed.value;
|
|
12504
|
+
};
|
|
12505
|
+
return CSSPropertyOpacity;
|
|
12506
|
+
}();
|
|
12507
|
+
|
|
12508
|
+
/**
|
|
12509
|
+
* Axis-Aligned Bounding Box
|
|
12510
|
+
* 为了便于后续 Frustum Culling,通过查找表定义 p-vertex 和 n-vertex
|
|
12511
|
+
* @see https://github.com/antvis/GWebGPUEngine/issues/3
|
|
12512
|
+
*/
|
|
12513
|
+
var AABB = /*#__PURE__*/function () {
|
|
12514
|
+
function AABB() {
|
|
12515
|
+
this.center = [0, 0, 0];
|
|
12516
|
+
this.halfExtents = [0, 0, 0];
|
|
12517
|
+
this.min = [0, 0, 0];
|
|
12518
|
+
this.max = [0, 0, 0];
|
|
12519
|
+
}
|
|
12520
|
+
AABB.isEmpty = function isEmpty(aabb) {
|
|
12521
|
+
return !aabb || aabb.halfExtents[0] === 0 && aabb.halfExtents[1] === 0 && aabb.halfExtents[2] === 0;
|
|
12522
|
+
};
|
|
12523
|
+
var _proto = AABB.prototype;
|
|
12524
|
+
// center: vec3 = vec3.create();
|
|
12525
|
+
// halfExtents: vec3 = vec3.create();
|
|
12526
|
+
// min: vec3 = vec3.create();
|
|
12527
|
+
// max: vec3 = vec3.create();
|
|
12528
|
+
_proto.update = function update(center, halfExtents) {
|
|
12529
|
+
copyVec3(this.center, center);
|
|
12530
|
+
copyVec3(this.halfExtents, halfExtents);
|
|
12531
|
+
subVec3(this.min, this.center, this.halfExtents);
|
|
12532
|
+
addVec3(this.max, this.center, this.halfExtents);
|
|
12533
|
+
// vec3.copy(this.center, center);
|
|
12534
|
+
// vec3.copy(this.halfExtents, halfExtents);
|
|
12535
|
+
// vec3.sub(this.min, this.center, this.halfExtents);
|
|
12536
|
+
// vec3.add(this.max, this.center, this.halfExtents);
|
|
12537
|
+
};
|
|
12538
|
+
_proto.setMinMax = function setMinMax(min, max) {
|
|
12539
|
+
// vec3.add(this.center, max, min);
|
|
12540
|
+
// vec3.scale(this.center, this.center, 0.5);
|
|
12541
|
+
// vec3.sub(this.halfExtents, max, min);
|
|
12542
|
+
// vec3.scale(this.halfExtents, this.halfExtents, 0.5);
|
|
12543
|
+
// vec3.copy(this.min, min);
|
|
12544
|
+
// vec3.copy(this.max, max);
|
|
12545
|
+
addVec3(this.center, max, min);
|
|
12546
|
+
scaleVec3(this.center, this.center, 0.5);
|
|
12547
|
+
subVec3(this.halfExtents, max, min);
|
|
12548
|
+
scaleVec3(this.halfExtents, this.halfExtents, 0.5);
|
|
12549
|
+
copyVec3(this.min, min);
|
|
12550
|
+
copyVec3(this.max, max);
|
|
12551
|
+
};
|
|
12552
|
+
_proto.getMin = function getMin() {
|
|
12553
|
+
return this.min;
|
|
12554
|
+
};
|
|
12555
|
+
_proto.getMax = function getMax() {
|
|
12556
|
+
return this.max;
|
|
12557
|
+
};
|
|
12558
|
+
_proto.add = function add(aabb) {
|
|
12559
|
+
if (AABB.isEmpty(aabb)) {
|
|
12560
|
+
return;
|
|
12659
12561
|
}
|
|
12660
|
-
if (
|
|
12661
|
-
|
|
12662
|
-
|
|
12663
|
-
|
|
12664
|
-
|
|
12665
|
-
|
|
12666
|
-
|
|
12667
|
-
|
|
12668
|
-
|
|
12669
|
-
|
|
12670
|
-
|
|
12671
|
-
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12675
|
-
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12680
|
-
|
|
12681
|
-
|
|
12682
|
-
|
|
12683
|
-
|
|
12684
|
-
|
|
12685
|
-
|
|
12686
|
-
|
|
12687
|
-
|
|
12688
|
-
|
|
12689
|
-
|
|
12690
|
-
|
|
12691
|
-
|
|
12692
|
-
|
|
12693
|
-
|
|
12694
|
-
// registry.unregisterParentGeometryBoundsChangedHandler(object, name);
|
|
12695
|
-
// return absolute value
|
|
12696
|
-
return computed.value;
|
|
12562
|
+
if (AABB.isEmpty(this)) {
|
|
12563
|
+
this.setMinMax(aabb.getMin(), aabb.getMax());
|
|
12564
|
+
return;
|
|
12565
|
+
}
|
|
12566
|
+
var tc = this.center;
|
|
12567
|
+
var tcx = tc[0];
|
|
12568
|
+
var tcy = tc[1];
|
|
12569
|
+
var tcz = tc[2];
|
|
12570
|
+
var th = this.halfExtents;
|
|
12571
|
+
var thx = th[0];
|
|
12572
|
+
var thy = th[1];
|
|
12573
|
+
var thz = th[2];
|
|
12574
|
+
var tminx = tcx - thx;
|
|
12575
|
+
var tmaxx = tcx + thx;
|
|
12576
|
+
var tminy = tcy - thy;
|
|
12577
|
+
var tmaxy = tcy + thy;
|
|
12578
|
+
var tminz = tcz - thz;
|
|
12579
|
+
var tmaxz = tcz + thz;
|
|
12580
|
+
var oc = aabb.center;
|
|
12581
|
+
var ocx = oc[0];
|
|
12582
|
+
var ocy = oc[1];
|
|
12583
|
+
var ocz = oc[2];
|
|
12584
|
+
var oh = aabb.halfExtents;
|
|
12585
|
+
var ohx = oh[0];
|
|
12586
|
+
var ohy = oh[1];
|
|
12587
|
+
var ohz = oh[2];
|
|
12588
|
+
var ominx = ocx - ohx;
|
|
12589
|
+
var omaxx = ocx + ohx;
|
|
12590
|
+
var ominy = ocy - ohy;
|
|
12591
|
+
var omaxy = ocy + ohy;
|
|
12592
|
+
var ominz = ocz - ohz;
|
|
12593
|
+
var omaxz = ocz + ohz;
|
|
12594
|
+
if (ominx < tminx) {
|
|
12595
|
+
tminx = ominx;
|
|
12697
12596
|
}
|
|
12698
|
-
|
|
12699
|
-
|
|
12700
|
-
}();
|
|
12701
|
-
|
|
12702
|
-
/**
|
|
12703
|
-
* format to Tuple2<CSSUnitValue>
|
|
12704
|
-
*
|
|
12705
|
-
* @example
|
|
12706
|
-
* rect.style.lineDash = 10;
|
|
12707
|
-
* rect.style.lineDash = [10, 10];
|
|
12708
|
-
* rect.style.lineDash = '10 10';
|
|
12709
|
-
*/
|
|
12710
|
-
var CSSPropertyLengthOrPercentage12 = /*#__PURE__*/function () {
|
|
12711
|
-
function CSSPropertyLengthOrPercentage12() {
|
|
12712
|
-
this.mixer = mergeNumberLists;
|
|
12713
|
-
}
|
|
12714
|
-
var _proto = CSSPropertyLengthOrPercentage12.prototype;
|
|
12715
|
-
_proto.parser = function parser(radius) {
|
|
12716
|
-
var parsed = parseDimensionArray(isNumber(radius) ? [radius] : radius);
|
|
12717
|
-
var formatted;
|
|
12718
|
-
if (parsed.length === 1) {
|
|
12719
|
-
formatted = [parsed[0], parsed[0]];
|
|
12720
|
-
} else {
|
|
12721
|
-
formatted = [parsed[0], parsed[1]];
|
|
12597
|
+
if (omaxx > tmaxx) {
|
|
12598
|
+
tmaxx = omaxx;
|
|
12722
12599
|
}
|
|
12723
|
-
|
|
12724
|
-
|
|
12725
|
-
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12726
|
-
return computed.map(function (c) {
|
|
12727
|
-
return c.value;
|
|
12728
|
-
});
|
|
12729
|
-
};
|
|
12730
|
-
return CSSPropertyLengthOrPercentage12;
|
|
12731
|
-
}();
|
|
12732
|
-
|
|
12733
|
-
/**
|
|
12734
|
-
* used in rounded rect
|
|
12735
|
-
*
|
|
12736
|
-
* @example
|
|
12737
|
-
* rect.style.radius = 10;
|
|
12738
|
-
* rect.style.radius = '10 10';
|
|
12739
|
-
* rect.style.radius = '10 10 10 10';
|
|
12740
|
-
*/
|
|
12741
|
-
var CSSPropertyLengthOrPercentage14 = /*#__PURE__*/function () {
|
|
12742
|
-
function CSSPropertyLengthOrPercentage14() {
|
|
12743
|
-
this.mixer = mergeNumberLists;
|
|
12744
|
-
}
|
|
12745
|
-
var _proto = CSSPropertyLengthOrPercentage14.prototype;
|
|
12746
|
-
_proto.parser = function parser(radius) {
|
|
12747
|
-
var parsed = parseDimensionArray(isNumber(radius) ? [radius] : radius);
|
|
12748
|
-
var formatted;
|
|
12749
|
-
// format to Tuple<CSSUnitValue>
|
|
12750
|
-
if (parsed.length === 1) {
|
|
12751
|
-
formatted = [parsed[0], parsed[0], parsed[0], parsed[0]];
|
|
12752
|
-
} else if (parsed.length === 2) {
|
|
12753
|
-
formatted = [parsed[0], parsed[1], parsed[0], parsed[1]];
|
|
12754
|
-
} else if (parsed.length === 3) {
|
|
12755
|
-
formatted = [parsed[0], parsed[1], parsed[2], parsed[1]];
|
|
12756
|
-
} else {
|
|
12757
|
-
formatted = [parsed[0], parsed[1], parsed[2], parsed[3]];
|
|
12600
|
+
if (ominy < tminy) {
|
|
12601
|
+
tminy = ominy;
|
|
12758
12602
|
}
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
_proto.calculator = function calculator(name, oldParsed, computed) {
|
|
12762
|
-
return computed.map(function (c) {
|
|
12763
|
-
return c.value;
|
|
12764
|
-
});
|
|
12765
|
-
};
|
|
12766
|
-
return CSSPropertyLengthOrPercentage14;
|
|
12767
|
-
}();
|
|
12768
|
-
|
|
12769
|
-
/**
|
|
12770
|
-
* local position
|
|
12771
|
-
*/
|
|
12772
|
-
var CSSPropertyLocalPosition = /*#__PURE__*/function (_CSSPropertyLengthOrP) {
|
|
12773
|
-
_inheritsLoose(CSSPropertyLocalPosition, _CSSPropertyLengthOrP);
|
|
12774
|
-
function CSSPropertyLocalPosition() {
|
|
12775
|
-
return _CSSPropertyLengthOrP.apply(this, arguments) || this;
|
|
12776
|
-
}
|
|
12777
|
-
var _proto = CSSPropertyLocalPosition.prototype;
|
|
12778
|
-
/**
|
|
12779
|
-
* update local position
|
|
12780
|
-
*/
|
|
12781
|
-
_proto.postProcessor = function postProcessor(object, attributes) {
|
|
12782
|
-
var x;
|
|
12783
|
-
var y;
|
|
12784
|
-
var z;
|
|
12785
|
-
switch (object.nodeName) {
|
|
12786
|
-
case exports.Shape.CIRCLE:
|
|
12787
|
-
case exports.Shape.ELLIPSE:
|
|
12788
|
-
var _object$parsedStyle = object.parsedStyle,
|
|
12789
|
-
cx = _object$parsedStyle.cx,
|
|
12790
|
-
cy = _object$parsedStyle.cy;
|
|
12791
|
-
if (!isNil(cx)) {
|
|
12792
|
-
x = cx;
|
|
12793
|
-
}
|
|
12794
|
-
if (!isNil(cy)) {
|
|
12795
|
-
y = cy;
|
|
12796
|
-
}
|
|
12797
|
-
break;
|
|
12798
|
-
case exports.Shape.LINE:
|
|
12799
|
-
var _object$parsedStyle2 = object.parsedStyle,
|
|
12800
|
-
x1 = _object$parsedStyle2.x1,
|
|
12801
|
-
x2 = _object$parsedStyle2.x2,
|
|
12802
|
-
y1 = _object$parsedStyle2.y1,
|
|
12803
|
-
y2 = _object$parsedStyle2.y2;
|
|
12804
|
-
var minX = Math.min(x1, x2);
|
|
12805
|
-
var minY = Math.min(y1, y2);
|
|
12806
|
-
x = minX;
|
|
12807
|
-
y = minY;
|
|
12808
|
-
z = 0;
|
|
12809
|
-
break;
|
|
12810
|
-
case exports.Shape.RECT:
|
|
12811
|
-
case exports.Shape.IMAGE:
|
|
12812
|
-
case exports.Shape.GROUP:
|
|
12813
|
-
case exports.Shape.HTML:
|
|
12814
|
-
case exports.Shape.TEXT:
|
|
12815
|
-
case exports.Shape.MESH:
|
|
12816
|
-
if (!isNil(object.parsedStyle.x)) {
|
|
12817
|
-
x = object.parsedStyle.x;
|
|
12818
|
-
}
|
|
12819
|
-
if (!isNil(object.parsedStyle.y)) {
|
|
12820
|
-
y = object.parsedStyle.y;
|
|
12821
|
-
}
|
|
12822
|
-
break;
|
|
12603
|
+
if (omaxy > tmaxy) {
|
|
12604
|
+
tmaxy = omaxy;
|
|
12823
12605
|
}
|
|
12824
|
-
if (
|
|
12825
|
-
|
|
12826
|
-
object.parsedStyle.defY = y || 0;
|
|
12606
|
+
if (ominz < tminz) {
|
|
12607
|
+
tminz = ominz;
|
|
12827
12608
|
}
|
|
12828
|
-
|
|
12829
|
-
|
|
12830
|
-
if (needResetLocalPosition && attributes.indexOf('transform') === -1) {
|
|
12831
|
-
// account for current transform if needed
|
|
12832
|
-
var transform = object.parsedStyle.transform;
|
|
12833
|
-
if (transform && transform.length) {
|
|
12834
|
-
parsedTransformToMat4(transform, object);
|
|
12835
|
-
} else {
|
|
12836
|
-
var _object$getLocalPosit = object.getLocalPosition(),
|
|
12837
|
-
ox = _object$getLocalPosit[0],
|
|
12838
|
-
oy = _object$getLocalPosit[1],
|
|
12839
|
-
oz = _object$getLocalPosit[2];
|
|
12840
|
-
object.setLocalPosition(isNil(x) ? ox : x, isNil(y) ? oy : y, isNil(z) ? oz : z);
|
|
12841
|
-
}
|
|
12609
|
+
if (omaxz > tmaxz) {
|
|
12610
|
+
tmaxz = omaxz;
|
|
12842
12611
|
}
|
|
12612
|
+
tc[0] = (tminx + tmaxx) * 0.5;
|
|
12613
|
+
tc[1] = (tminy + tmaxy) * 0.5;
|
|
12614
|
+
tc[2] = (tminz + tmaxz) * 0.5;
|
|
12615
|
+
th[0] = (tmaxx - tminx) * 0.5;
|
|
12616
|
+
th[1] = (tmaxy - tminy) * 0.5;
|
|
12617
|
+
th[2] = (tmaxz - tminz) * 0.5;
|
|
12618
|
+
this.min[0] = tminx;
|
|
12619
|
+
this.min[1] = tminy;
|
|
12620
|
+
this.min[2] = tminz;
|
|
12621
|
+
this.max[0] = tmaxx;
|
|
12622
|
+
this.max[1] = tmaxy;
|
|
12623
|
+
this.max[2] = tmaxz;
|
|
12843
12624
|
};
|
|
12844
|
-
|
|
12845
|
-
|
|
12846
|
-
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
var
|
|
12852
|
-
|
|
12853
|
-
|
|
12854
|
-
|
|
12625
|
+
_proto.setFromTransformedAABB = function setFromTransformedAABB(aabb, m) {
|
|
12626
|
+
var bc = this.center;
|
|
12627
|
+
var br = this.halfExtents;
|
|
12628
|
+
var ac = aabb.center;
|
|
12629
|
+
var ar = aabb.halfExtents;
|
|
12630
|
+
var mx0 = m[0];
|
|
12631
|
+
var mx1 = m[4];
|
|
12632
|
+
var mx2 = m[8];
|
|
12633
|
+
var my0 = m[1];
|
|
12634
|
+
var my1 = m[5];
|
|
12635
|
+
var my2 = m[9];
|
|
12636
|
+
var mz0 = m[2];
|
|
12637
|
+
var mz1 = m[6];
|
|
12638
|
+
var mz2 = m[10];
|
|
12639
|
+
var mx0a = Math.abs(mx0);
|
|
12640
|
+
var mx1a = Math.abs(mx1);
|
|
12641
|
+
var mx2a = Math.abs(mx2);
|
|
12642
|
+
var my0a = Math.abs(my0);
|
|
12643
|
+
var my1a = Math.abs(my1);
|
|
12644
|
+
var my2a = Math.abs(my2);
|
|
12645
|
+
var mz0a = Math.abs(mz0);
|
|
12646
|
+
var mz1a = Math.abs(mz1);
|
|
12647
|
+
var mz2a = Math.abs(mz2);
|
|
12648
|
+
bc[0] = m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2];
|
|
12649
|
+
bc[1] = m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2];
|
|
12650
|
+
bc[2] = m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2];
|
|
12651
|
+
// vec3.set(
|
|
12652
|
+
// bc,
|
|
12653
|
+
// m[12] + mx0 * ac[0] + mx1 * ac[1] + mx2 * ac[2],
|
|
12654
|
+
// m[13] + my0 * ac[0] + my1 * ac[1] + my2 * ac[2],
|
|
12655
|
+
// m[14] + mz0 * ac[0] + mz1 * ac[1] + mz2 * ac[2],
|
|
12656
|
+
// );
|
|
12657
|
+
br[0] = mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2];
|
|
12658
|
+
br[1] = my0a * ar[0] + my1a * ar[1] + my2a * ar[2];
|
|
12659
|
+
br[2] = mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2];
|
|
12660
|
+
// vec3.set(
|
|
12661
|
+
// br,
|
|
12662
|
+
// mx0a * ar[0] + mx1a * ar[1] + mx2a * ar[2],
|
|
12663
|
+
// my0a * ar[0] + my1a * ar[1] + my2a * ar[2],
|
|
12664
|
+
// mz0a * ar[0] + mz1a * ar[1] + mz2a * ar[2],
|
|
12665
|
+
// );
|
|
12666
|
+
// this.min = vec3.sub(this.min, bc, br);
|
|
12667
|
+
// this.max = vec3.add(this.max, bc, br);
|
|
12668
|
+
subVec3(this.min, bc, br);
|
|
12669
|
+
addVec3(this.max, bc, br);
|
|
12670
|
+
};
|
|
12671
|
+
_proto.intersects = function intersects(aabb) {
|
|
12672
|
+
var aMax = this.getMax();
|
|
12673
|
+
var aMin = this.getMin();
|
|
12674
|
+
var bMax = aabb.getMax();
|
|
12675
|
+
var bMin = aabb.getMin();
|
|
12676
|
+
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];
|
|
12677
|
+
};
|
|
12678
|
+
_proto.intersection = function intersection(aabb) {
|
|
12679
|
+
if (!this.intersects(aabb)) {
|
|
12680
|
+
return null;
|
|
12681
|
+
}
|
|
12682
|
+
var intersection = new AABB();
|
|
12683
|
+
// const min = vec3.max(vec3.create(), this.getMin(), aabb.getMin());
|
|
12684
|
+
// const max = vec3.min(vec3.create(), this.getMax(), aabb.getMax());
|
|
12685
|
+
var min = maxVec3([0, 0, 0], this.getMin(), aabb.getMin());
|
|
12686
|
+
var max = minVec3([0, 0, 0], this.getMax(), aabb.getMax());
|
|
12687
|
+
intersection.setMinMax(min, max);
|
|
12688
|
+
return intersection;
|
|
12689
|
+
}
|
|
12690
|
+
// containsPoint(point: vec3) {
|
|
12691
|
+
// const min = this.getMin();
|
|
12692
|
+
// const max = this.getMax();
|
|
12693
|
+
// return !(
|
|
12694
|
+
// point[0] < min[0] ||
|
|
12695
|
+
// point[0] > max[0] ||
|
|
12696
|
+
// point[1] < min[1] ||
|
|
12697
|
+
// point[1] > max[1] ||
|
|
12698
|
+
// point[2] < min[2] ||
|
|
12699
|
+
// point[2] > max[2]
|
|
12700
|
+
// );
|
|
12701
|
+
// }
|
|
12702
|
+
/**
|
|
12703
|
+
* get n-vertex
|
|
12704
|
+
* @param plane plane of CullingVolume
|
|
12705
|
+
*/;
|
|
12706
|
+
_proto.getNegativeFarPoint = function getNegativeFarPoint(plane) {
|
|
12707
|
+
if (plane.pnVertexFlag === 0x111) {
|
|
12708
|
+
return copyVec3([0, 0, 0], this.min);
|
|
12709
|
+
// return vec3.copy(vec3.create(), this.min);
|
|
12710
|
+
} else if (plane.pnVertexFlag === 0x110) {
|
|
12711
|
+
return [this.min[0], this.min[1], this.max[2]];
|
|
12712
|
+
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
12713
|
+
} else if (plane.pnVertexFlag === 0x101) {
|
|
12714
|
+
return [this.min[0], this.max[1], this.min[2]];
|
|
12715
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
12716
|
+
} else if (plane.pnVertexFlag === 0x100) {
|
|
12717
|
+
return [this.min[0], this.max[1], this.max[2]];
|
|
12718
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
12719
|
+
} else if (plane.pnVertexFlag === 0x011) {
|
|
12720
|
+
return [this.max[0], this.min[1], this.min[2]];
|
|
12721
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
12722
|
+
} else if (plane.pnVertexFlag === 0x010) {
|
|
12723
|
+
return [this.max[0], this.min[1], this.max[2]];
|
|
12724
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
12725
|
+
} else if (plane.pnVertexFlag === 0x001) {
|
|
12726
|
+
return [this.max[0], this.max[1], this.min[2]];
|
|
12727
|
+
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
12728
|
+
} else {
|
|
12729
|
+
return [this.max[0], this.max[1], this.max[2]];
|
|
12730
|
+
// return vec3.fromValues(this.max[0], this.max[1], this.max[2]);
|
|
12855
12731
|
}
|
|
12856
|
-
|
|
12857
|
-
|
|
12858
|
-
|
|
12859
|
-
|
|
12732
|
+
}
|
|
12733
|
+
/**
|
|
12734
|
+
* get p-vertex
|
|
12735
|
+
* @param plane plane of CullingVolume
|
|
12736
|
+
*/;
|
|
12737
|
+
_proto.getPositiveFarPoint = function getPositiveFarPoint(plane) {
|
|
12738
|
+
if (plane.pnVertexFlag === 0x111) {
|
|
12739
|
+
return copyVec3([0, 0, 0], this.max);
|
|
12740
|
+
// return vec3.copy(vec3.create(), this.max);
|
|
12741
|
+
} else if (plane.pnVertexFlag === 0x110) {
|
|
12742
|
+
return [this.max[0], this.max[1], this.min[2]];
|
|
12743
|
+
// return vec3.fromValues(this.max[0], this.max[1], this.min[2]);
|
|
12744
|
+
} else if (plane.pnVertexFlag === 0x101) {
|
|
12745
|
+
return [this.max[0], this.min[1], this.max[2]];
|
|
12746
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.max[2]);
|
|
12747
|
+
} else if (plane.pnVertexFlag === 0x100) {
|
|
12748
|
+
return [this.max[0], this.min[1], this.min[2]];
|
|
12749
|
+
// return vec3.fromValues(this.max[0], this.min[1], this.min[2]);
|
|
12750
|
+
} else if (plane.pnVertexFlag === 0x011) {
|
|
12751
|
+
return [this.min[0], this.max[1], this.max[2]];
|
|
12752
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.max[2]);
|
|
12753
|
+
} else if (plane.pnVertexFlag === 0x010) {
|
|
12754
|
+
return [this.min[0], this.max[1], this.min[2]];
|
|
12755
|
+
// return vec3.fromValues(this.min[0], this.max[1], this.min[2]);
|
|
12756
|
+
} else if (plane.pnVertexFlag === 0x001) {
|
|
12757
|
+
return [this.min[0], this.min[1], this.max[2]];
|
|
12758
|
+
// return vec3.fromValues(this.min[0], this.min[1], this.max[2]);
|
|
12759
|
+
} else {
|
|
12760
|
+
return [this.min[0], this.min[1], this.min[2]];
|
|
12761
|
+
// return vec3.fromValues(this.min[0], this.min[1], this.min[2]);
|
|
12860
12762
|
}
|
|
12861
|
-
return cloned;
|
|
12862
12763
|
};
|
|
12863
|
-
return
|
|
12764
|
+
return AABB;
|
|
12864
12765
|
}();
|
|
12865
12766
|
|
|
12866
|
-
var
|
|
12867
|
-
|
|
12868
|
-
|
|
12869
|
-
|
|
12870
|
-
|
|
12767
|
+
var Plane = /*#__PURE__*/function () {
|
|
12768
|
+
/**
|
|
12769
|
+
* lookup table for p-vertex & n-vertex when doing frustum culling
|
|
12770
|
+
*/
|
|
12771
|
+
|
|
12772
|
+
function Plane(distance, normal) {
|
|
12773
|
+
this.distance = void 0;
|
|
12774
|
+
this.normal = void 0;
|
|
12775
|
+
this.pnVertexFlag = void 0;
|
|
12776
|
+
this.distance = distance || 0;
|
|
12777
|
+
this.normal = normal || fromValues$2(0, 1, 0);
|
|
12778
|
+
this.updatePNVertexFlag();
|
|
12871
12779
|
}
|
|
12872
|
-
var _proto =
|
|
12873
|
-
_proto.
|
|
12874
|
-
|
|
12780
|
+
var _proto = Plane.prototype;
|
|
12781
|
+
_proto.updatePNVertexFlag = function updatePNVertexFlag() {
|
|
12782
|
+
this.pnVertexFlag = (Number(this.normal[0] >= 0) << 8) + (Number(this.normal[1] >= 0) << 4) + Number(this.normal[2] >= 0);
|
|
12875
12783
|
};
|
|
12876
|
-
|
|
12784
|
+
_proto.distanceToPoint = function distanceToPoint(point) {
|
|
12785
|
+
return dot(point, this.normal) - this.distance;
|
|
12786
|
+
};
|
|
12787
|
+
_proto.normalize = function normalize() {
|
|
12788
|
+
var invLen = 1 / len(this.normal);
|
|
12789
|
+
scale$1(this.normal, this.normal, invLen);
|
|
12790
|
+
this.distance *= invLen;
|
|
12791
|
+
};
|
|
12792
|
+
_proto.intersectsLine = function intersectsLine(start, end, point) {
|
|
12793
|
+
var d0 = this.distanceToPoint(start);
|
|
12794
|
+
var d1 = this.distanceToPoint(end);
|
|
12795
|
+
var t = d0 / (d0 - d1);
|
|
12796
|
+
var intersects = t >= 0 && t <= 1;
|
|
12797
|
+
if (intersects && point) {
|
|
12798
|
+
lerp(point, start, end, t);
|
|
12799
|
+
}
|
|
12800
|
+
return intersects;
|
|
12801
|
+
};
|
|
12802
|
+
return Plane;
|
|
12877
12803
|
}();
|
|
12878
12804
|
|
|
12879
|
-
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
|
|
12805
|
+
(function (Mask) {
|
|
12806
|
+
Mask[Mask["OUTSIDE"] = 4294967295] = "OUTSIDE";
|
|
12807
|
+
Mask[Mask["INSIDE"] = 0] = "INSIDE";
|
|
12808
|
+
Mask[Mask["INDETERMINATE"] = 2147483647] = "INDETERMINATE";
|
|
12809
|
+
})(exports.Mask || (exports.Mask = {}));
|
|
12810
|
+
var Frustum = /*#__PURE__*/function () {
|
|
12811
|
+
function Frustum(planes) {
|
|
12812
|
+
this.planes = [];
|
|
12813
|
+
if (planes) {
|
|
12814
|
+
this.planes = planes;
|
|
12815
|
+
} else {
|
|
12816
|
+
for (var i = 0; i < 6; i++) {
|
|
12817
|
+
this.planes.push(new Plane());
|
|
12818
|
+
}
|
|
12819
|
+
}
|
|
12884
12820
|
}
|
|
12885
|
-
|
|
12886
|
-
|
|
12887
|
-
|
|
12821
|
+
/**
|
|
12822
|
+
* extract 6 planes from projectionMatrix
|
|
12823
|
+
* @see http://www8.cs.umu.se/kurser/5DV051/HT12/lab/plane_extraction.pdf
|
|
12824
|
+
*/
|
|
12825
|
+
var _proto = Frustum.prototype;
|
|
12826
|
+
_proto.extractFromVPMatrix = function extractFromVPMatrix(projectionMatrix) {
|
|
12827
|
+
// @ts-ignore
|
|
12828
|
+
var m0 = projectionMatrix[0],
|
|
12829
|
+
m1 = projectionMatrix[1],
|
|
12830
|
+
m2 = projectionMatrix[2],
|
|
12831
|
+
m3 = projectionMatrix[3],
|
|
12832
|
+
m4 = projectionMatrix[4],
|
|
12833
|
+
m5 = projectionMatrix[5],
|
|
12834
|
+
m6 = projectionMatrix[6],
|
|
12835
|
+
m7 = projectionMatrix[7],
|
|
12836
|
+
m8 = projectionMatrix[8],
|
|
12837
|
+
m9 = projectionMatrix[9],
|
|
12838
|
+
m10 = projectionMatrix[10],
|
|
12839
|
+
m11 = projectionMatrix[11],
|
|
12840
|
+
m12 = projectionMatrix[12],
|
|
12841
|
+
m13 = projectionMatrix[13],
|
|
12842
|
+
m14 = projectionMatrix[14],
|
|
12843
|
+
m15 = projectionMatrix[15];
|
|
12844
|
+
// right
|
|
12845
|
+
set$1(this.planes[0].normal, m3 - m0, m7 - m4, m11 - m8);
|
|
12846
|
+
this.planes[0].distance = m15 - m12;
|
|
12847
|
+
// left
|
|
12848
|
+
set$1(this.planes[1].normal, m3 + m0, m7 + m4, m11 + m8);
|
|
12849
|
+
this.planes[1].distance = m15 + m12;
|
|
12850
|
+
// bottom
|
|
12851
|
+
set$1(this.planes[2].normal, m3 + m1, m7 + m5, m11 + m9);
|
|
12852
|
+
this.planes[2].distance = m15 + m13;
|
|
12853
|
+
// top
|
|
12854
|
+
set$1(this.planes[3].normal, m3 - m1, m7 - m5, m11 - m9);
|
|
12855
|
+
this.planes[3].distance = m15 - m13;
|
|
12856
|
+
// far
|
|
12857
|
+
set$1(this.planes[4].normal, m3 - m2, m7 - m6, m11 - m10);
|
|
12858
|
+
this.planes[4].distance = m15 - m14;
|
|
12859
|
+
// near
|
|
12860
|
+
set$1(this.planes[5].normal, m3 + m2, m7 + m6, m11 + m10);
|
|
12861
|
+
this.planes[5].distance = m15 + m14;
|
|
12862
|
+
this.planes.forEach(function (plane) {
|
|
12863
|
+
plane.normalize();
|
|
12864
|
+
plane.updatePNVertexFlag();
|
|
12865
|
+
});
|
|
12888
12866
|
};
|
|
12889
|
-
|
|
12890
|
-
|
|
12891
|
-
|
|
12892
|
-
|
|
12893
|
-
|
|
12894
|
-
|
|
12867
|
+
return Frustum;
|
|
12868
|
+
}();
|
|
12869
|
+
|
|
12870
|
+
var Point = /*#__PURE__*/function () {
|
|
12871
|
+
function Point(x, y) {
|
|
12872
|
+
if (x === void 0) {
|
|
12873
|
+
x = 0;
|
|
12895
12874
|
}
|
|
12896
|
-
|
|
12897
|
-
|
|
12898
|
-
// set position in world space
|
|
12899
|
-
var point = offsetPath.getPoint(offsetDistance);
|
|
12900
|
-
if (point) {
|
|
12901
|
-
object.parsedStyle.defX = point.x;
|
|
12902
|
-
object.parsedStyle.defY = point.y;
|
|
12903
|
-
object.setLocalPosition(point.x, point.y);
|
|
12904
|
-
}
|
|
12875
|
+
if (y === void 0) {
|
|
12876
|
+
y = 0;
|
|
12905
12877
|
}
|
|
12878
|
+
this.x = 0;
|
|
12879
|
+
this.y = 0;
|
|
12880
|
+
this.x = x;
|
|
12881
|
+
this.y = y;
|
|
12882
|
+
}
|
|
12883
|
+
var _proto = Point.prototype;
|
|
12884
|
+
_proto.clone = function clone() {
|
|
12885
|
+
return new Point(this.x, this.y);
|
|
12906
12886
|
};
|
|
12907
|
-
|
|
12887
|
+
_proto.copyFrom = function copyFrom(p) {
|
|
12888
|
+
this.x = p.x;
|
|
12889
|
+
this.y = p.y;
|
|
12890
|
+
};
|
|
12891
|
+
return Point;
|
|
12908
12892
|
}();
|
|
12909
12893
|
|
|
12910
|
-
|
|
12911
|
-
|
|
12912
|
-
|
|
12913
|
-
|
|
12914
|
-
|
|
12915
|
-
this.
|
|
12916
|
-
this.
|
|
12917
|
-
this.
|
|
12894
|
+
var Rectangle = /*#__PURE__*/function () {
|
|
12895
|
+
function Rectangle(x, y, width, height) {
|
|
12896
|
+
this.x = void 0;
|
|
12897
|
+
this.y = void 0;
|
|
12898
|
+
this.width = void 0;
|
|
12899
|
+
this.height = void 0;
|
|
12900
|
+
this.left = void 0;
|
|
12901
|
+
this.right = void 0;
|
|
12902
|
+
this.top = void 0;
|
|
12903
|
+
this.bottom = void 0;
|
|
12904
|
+
this.x = x;
|
|
12905
|
+
this.y = y;
|
|
12906
|
+
this.width = width;
|
|
12907
|
+
this.height = height;
|
|
12908
|
+
this.left = x;
|
|
12909
|
+
this.right = x + width;
|
|
12910
|
+
this.top = y;
|
|
12911
|
+
this.bottom = y + height;
|
|
12918
12912
|
}
|
|
12919
|
-
var _proto =
|
|
12920
|
-
_proto.
|
|
12921
|
-
|
|
12922
|
-
};
|
|
12923
|
-
return CSSPropertyOpacity;
|
|
12913
|
+
var _proto = Rectangle.prototype;
|
|
12914
|
+
_proto.toJSON = function toJSON() {};
|
|
12915
|
+
return Rectangle;
|
|
12924
12916
|
}();
|
|
12925
12917
|
|
|
12926
12918
|
var CSSPropertyPath = /*#__PURE__*/function () {
|
|
@@ -14601,12 +14593,12 @@
|
|
|
14601
14593
|
localPosition: [0, 0, 0],
|
|
14602
14594
|
localRotation: [0, 0, 0, 1],
|
|
14603
14595
|
localScale: [1, 1, 1],
|
|
14604
|
-
localTransform:
|
|
14596
|
+
localTransform: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
14605
14597
|
localSkew: [0, 0],
|
|
14606
14598
|
position: [0, 0, 0],
|
|
14607
14599
|
rotation: [0, 0, 0, 1],
|
|
14608
14600
|
scaling: [1, 1, 1],
|
|
14609
|
-
worldTransform:
|
|
14601
|
+
worldTransform: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1],
|
|
14610
14602
|
origin: [0, 0, 0]
|
|
14611
14603
|
};
|
|
14612
14604
|
_this.sortable = {
|
|
@@ -16116,7 +16108,7 @@
|
|
|
16116
16108
|
}, style) : _extends({}, style),
|
|
16117
16109
|
initialParsedStyle: {
|
|
16118
16110
|
anchor: [0.5, 0.5],
|
|
16119
|
-
transformOrigin: runtime.enableCSSParsing ? null : [
|
|
16111
|
+
transformOrigin: runtime.enableCSSParsing ? null : [PECENTAGE_50, PECENTAGE_50]
|
|
16120
16112
|
}
|
|
16121
16113
|
}, rest)) || this;
|
|
16122
16114
|
}
|
|
@@ -16204,7 +16196,7 @@
|
|
|
16204
16196
|
}, style) : _extends({}, style),
|
|
16205
16197
|
initialParsedStyle: {
|
|
16206
16198
|
anchor: [0.5, 0.5],
|
|
16207
|
-
transformOrigin: runtime.enableCSSParsing ? null : [
|
|
16199
|
+
transformOrigin: runtime.enableCSSParsing ? null : [PECENTAGE_50, PECENTAGE_50]
|
|
16208
16200
|
}
|
|
16209
16201
|
}, rest)) || this;
|
|
16210
16202
|
}
|
|
@@ -17062,6 +17054,7 @@
|
|
|
17062
17054
|
var _proto = Text.prototype;
|
|
17063
17055
|
_proto.getComputedTextLength = function getComputedTextLength() {
|
|
17064
17056
|
var _this$parsedStyle$met;
|
|
17057
|
+
this.forceUpdateGeometry();
|
|
17065
17058
|
return ((_this$parsedStyle$met = this.parsedStyle.metrics) === null || _this$parsedStyle$met === void 0 ? void 0 : _this$parsedStyle$met.maxLineWidth) || 0;
|
|
17066
17059
|
}
|
|
17067
17060
|
// getEndPositionOfChar(charnum: number): DOMPoint {
|
|
@@ -17088,11 +17081,18 @@
|
|
|
17088
17081
|
;
|
|
17089
17082
|
_proto.getLineBoundingRects = function getLineBoundingRects() {
|
|
17090
17083
|
var _this$parsedStyle$met2;
|
|
17084
|
+
this.forceUpdateGeometry();
|
|
17091
17085
|
return ((_this$parsedStyle$met2 = this.parsedStyle.metrics) === null || _this$parsedStyle$met2 === void 0 ? void 0 : _this$parsedStyle$met2.lineMetrics) || [];
|
|
17092
17086
|
};
|
|
17093
17087
|
_proto.isOverflowing = function isOverflowing() {
|
|
17088
|
+
this.forceUpdateGeometry();
|
|
17094
17089
|
return !!this.parsedStyle.isOverflowing;
|
|
17095
17090
|
};
|
|
17091
|
+
_proto.forceUpdateGeometry = function forceUpdateGeometry() {
|
|
17092
|
+
if (!this.parsedStyle.metrics) {
|
|
17093
|
+
runtime.styleValueRegistry.updateGeometry(this);
|
|
17094
|
+
}
|
|
17095
|
+
};
|
|
17096
17096
|
return Text;
|
|
17097
17097
|
}(DisplayObject);
|
|
17098
17098
|
|
|
@@ -18067,7 +18067,8 @@
|
|
|
18067
18067
|
* eg. r of Circle, width/height of Rect
|
|
18068
18068
|
*/;
|
|
18069
18069
|
_proto.updateGeometry = function updateGeometry(object) {
|
|
18070
|
-
var
|
|
18070
|
+
var nodeName = object.nodeName;
|
|
18071
|
+
var geometryUpdater = runtime.geometryUpdaterFactory[nodeName];
|
|
18071
18072
|
if (geometryUpdater) {
|
|
18072
18073
|
var geometry = object.geometry;
|
|
18073
18074
|
if (!geometry.contentBounds) {
|
|
@@ -18088,10 +18089,6 @@
|
|
|
18088
18089
|
offsetY = _geometryUpdater$upda4 === void 0 ? 0 : _geometryUpdater$upda4,
|
|
18089
18090
|
_geometryUpdater$upda5 = _geometryUpdater$upda.offsetZ,
|
|
18090
18091
|
offsetZ = _geometryUpdater$upda5 === void 0 ? 0 : _geometryUpdater$upda5;
|
|
18091
|
-
// account for negative width / height of Rect
|
|
18092
|
-
// @see https://github.com/antvis/g/issues/957
|
|
18093
|
-
var flipY = width < 0;
|
|
18094
|
-
var flipX = height < 0;
|
|
18095
18092
|
// init with content box
|
|
18096
18093
|
var halfExtents = [Math.abs(width) / 2, Math.abs(height) / 2, depth / 2];
|
|
18097
18094
|
// const halfExtents = vec3.set(
|
|
@@ -18111,7 +18108,7 @@
|
|
|
18111
18108
|
transformOrigin = parsedStyle.transformOrigin;
|
|
18112
18109
|
var anchor = parsedStyle.anchor;
|
|
18113
18110
|
// <Text> use textAlign & textBaseline instead of anchor
|
|
18114
|
-
if (
|
|
18111
|
+
if (nodeName === exports.Shape.TEXT) {
|
|
18115
18112
|
delete parsedStyle.anchor;
|
|
18116
18113
|
}
|
|
18117
18114
|
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];
|
|
@@ -18124,7 +18121,7 @@
|
|
|
18124
18121
|
// update geometry's AABB
|
|
18125
18122
|
geometry.contentBounds.update(center, halfExtents);
|
|
18126
18123
|
// @see https://github.molgen.mpg.de/git-mirror/cairo/blob/master/src/cairo-stroke-style.c#L97..L128
|
|
18127
|
-
var expansion =
|
|
18124
|
+
var expansion = nodeName === exports.Shape.POLYLINE || nodeName === exports.Shape.POLYGON || nodeName === exports.Shape.PATH ? Math.SQRT2 : 0.5;
|
|
18128
18125
|
// if (lineCap?.value === 'square') {
|
|
18129
18126
|
// expansion = Math.SQRT1_2;
|
|
18130
18127
|
// }
|
|
@@ -18195,13 +18192,19 @@
|
|
|
18195
18192
|
});
|
|
18196
18193
|
anchor = parsedStyle.anchor;
|
|
18197
18194
|
geometry.dirty = false;
|
|
18195
|
+
// if (nodeName === Shape.RECT) {
|
|
18196
|
+
// account for negative width / height of Rect
|
|
18197
|
+
// @see https://github.com/antvis/g/issues/957
|
|
18198
|
+
var flipY = width < 0;
|
|
18199
|
+
var flipX = height < 0;
|
|
18200
|
+
// } else {
|
|
18201
|
+
// }
|
|
18198
18202
|
// set transform origin
|
|
18199
18203
|
var usedOriginXValue = (flipY ? -1 : 1) * (transformOrigin ? convertPercentUnit(transformOrigin[0], 0, object) : 0);
|
|
18200
18204
|
var usedOriginYValue = (flipX ? -1 : 1) * (transformOrigin ? convertPercentUnit(transformOrigin[1], 1, object) : 0);
|
|
18201
18205
|
usedOriginXValue = usedOriginXValue - (flipY ? -1 : 1) * (anchor && anchor[0] || 0) * geometry.contentBounds.halfExtents[0] * 2;
|
|
18202
18206
|
usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1] || 0) * geometry.contentBounds.halfExtents[1] * 2;
|
|
18203
18207
|
object.setOrigin(usedOriginXValue, usedOriginYValue);
|
|
18204
|
-
// console.log('calc geometry', object);
|
|
18205
18208
|
// FIXME setOrigin may have already dirtified to root.
|
|
18206
18209
|
// runtime.sceneGraphService.dirtifyToRoot(object);
|
|
18207
18210
|
}
|
|
@@ -20759,10 +20762,10 @@
|
|
|
20759
20762
|
z = 0;
|
|
20760
20763
|
}
|
|
20761
20764
|
if (typeof origin === 'number') {
|
|
20762
|
-
origin =
|
|
20765
|
+
origin = [origin, y, z];
|
|
20763
20766
|
}
|
|
20764
20767
|
var transform = element.transformable;
|
|
20765
|
-
if (
|
|
20768
|
+
if (origin[0] === transform.origin[0] && origin[1] === transform.origin[1] && origin[2] === transform.origin[2]) {
|
|
20766
20769
|
return;
|
|
20767
20770
|
}
|
|
20768
20771
|
var originVec = transform.origin;
|
|
@@ -21082,7 +21085,7 @@
|
|
|
21082
21085
|
var clipped = findClosestClipPathTarget(element);
|
|
21083
21086
|
if (clipped) {
|
|
21084
21087
|
// use bounds under world space
|
|
21085
|
-
var clipPathBounds = clipped.
|
|
21088
|
+
var clipPathBounds = clipped.parsedStyle.clipPath.getBounds(render);
|
|
21086
21089
|
if (!aabb) {
|
|
21087
21090
|
aabb = clipPathBounds;
|
|
21088
21091
|
} else if (clipPathBounds) {
|
|
@@ -21820,7 +21823,7 @@
|
|
|
21820
21823
|
var normalizedEvents = _this.normalizeToPointerEvent(nativeEvent, canvas);
|
|
21821
21824
|
for (var _iterator = _createForOfIteratorHelperLoose(normalizedEvents), _step; !(_step = _iterator()).done;) {
|
|
21822
21825
|
var normalizedEvent = _step.value;
|
|
21823
|
-
var event = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent, canvas);
|
|
21826
|
+
var event = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvent, canvas, nativeEvent);
|
|
21824
21827
|
_this.context.eventService.mapEvent(event);
|
|
21825
21828
|
}
|
|
21826
21829
|
_this.setCursor(_this.context.eventService.cursor);
|
|
@@ -21875,7 +21878,7 @@
|
|
|
21875
21878
|
}
|
|
21876
21879
|
for (var _iterator2 = _createForOfIteratorHelperLoose(events), _step2; !(_step2 = _iterator2()).done;) {
|
|
21877
21880
|
var event = _step2.value;
|
|
21878
|
-
var federatedEvent = _this2.bootstrapEvent(_this2.rootPointerEvent, event, canvas);
|
|
21881
|
+
var federatedEvent = _this2.bootstrapEvent(_this2.rootPointerEvent, event, canvas, nativeEvent);
|
|
21879
21882
|
_this2.context.eventService.mapEvent(federatedEvent);
|
|
21880
21883
|
}
|
|
21881
21884
|
_this2.setCursor(_this2.context.eventService.cursor);
|
|
@@ -21894,7 +21897,7 @@
|
|
|
21894
21897
|
var normalizedEvents = _this2.normalizeToPointerEvent(nativeEvent, canvas);
|
|
21895
21898
|
for (var _iterator3 = _createForOfIteratorHelperLoose(normalizedEvents), _step3; !(_step3 = _iterator3()).done;) {
|
|
21896
21899
|
var normalizedEvent = _step3.value;
|
|
21897
|
-
var event = _this2.bootstrapEvent(_this2.rootPointerEvent, normalizedEvent, canvas);
|
|
21900
|
+
var event = _this2.bootstrapEvent(_this2.rootPointerEvent, normalizedEvent, canvas, nativeEvent);
|
|
21898
21901
|
event.type += outside;
|
|
21899
21902
|
_this2.context.eventService.mapEvent(event);
|
|
21900
21903
|
}
|
|
@@ -21929,22 +21932,22 @@
|
|
|
21929
21932
|
y: y
|
|
21930
21933
|
};
|
|
21931
21934
|
};
|
|
21932
|
-
_proto.bootstrapEvent = function bootstrapEvent(event,
|
|
21935
|
+
_proto.bootstrapEvent = function bootstrapEvent(event, normalizedEvent, view, nativeEvent) {
|
|
21933
21936
|
event.view = view;
|
|
21934
21937
|
event.originalEvent = null;
|
|
21935
21938
|
event.nativeEvent = nativeEvent;
|
|
21936
|
-
event.pointerId =
|
|
21937
|
-
event.width =
|
|
21938
|
-
event.height =
|
|
21939
|
-
event.isPrimary =
|
|
21940
|
-
event.pointerType =
|
|
21941
|
-
event.pressure =
|
|
21942
|
-
event.tangentialPressure =
|
|
21943
|
-
event.tiltX =
|
|
21944
|
-
event.tiltY =
|
|
21945
|
-
event.twist =
|
|
21946
|
-
this.transferMouseData(event,
|
|
21947
|
-
var _this$getViewportXY = this.getViewportXY(
|
|
21939
|
+
event.pointerId = normalizedEvent.pointerId;
|
|
21940
|
+
event.width = normalizedEvent.width;
|
|
21941
|
+
event.height = normalizedEvent.height;
|
|
21942
|
+
event.isPrimary = normalizedEvent.isPrimary;
|
|
21943
|
+
event.pointerType = normalizedEvent.pointerType;
|
|
21944
|
+
event.pressure = normalizedEvent.pressure;
|
|
21945
|
+
event.tangentialPressure = normalizedEvent.tangentialPressure;
|
|
21946
|
+
event.tiltX = normalizedEvent.tiltX;
|
|
21947
|
+
event.tiltY = normalizedEvent.tiltY;
|
|
21948
|
+
event.twist = normalizedEvent.twist;
|
|
21949
|
+
this.transferMouseData(event, normalizedEvent);
|
|
21950
|
+
var _this$getViewportXY = this.getViewportXY(normalizedEvent),
|
|
21948
21951
|
x = _this$getViewportXY.x,
|
|
21949
21952
|
y = _this$getViewportXY.y;
|
|
21950
21953
|
event.viewport.x = x;
|