@visactor/vrender 0.22.8-alpha.0 → 0.22.9-alpha.1
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/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/dist/index.es.js +218 -76
- package/dist/index.js +224 -75
- package/dist/index.min.js +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -492,11 +492,14 @@
|
|
|
492
492
|
const ContributionProvider = Symbol("ContributionProvider");
|
|
493
493
|
class ContributionProviderCache {
|
|
494
494
|
constructor(serviceIdentifier, container) {
|
|
495
|
-
this.serviceIdentifier = serviceIdentifier, this.container = container;
|
|
495
|
+
this.serviceIdentifier = serviceIdentifier, this.container = container, ContributionStore.setStore(this.serviceIdentifier, this);
|
|
496
496
|
}
|
|
497
497
|
getContributions() {
|
|
498
498
|
return this.caches || (this.caches = [], this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier))), this.caches;
|
|
499
499
|
}
|
|
500
|
+
refresh() {
|
|
501
|
+
this.caches && (this.caches.length = 0, this.container && this.container.isBound(this.serviceIdentifier) && this.caches.push(...this.container.getAll(this.serviceIdentifier)));
|
|
502
|
+
}
|
|
500
503
|
}
|
|
501
504
|
function bindContributionProvider(bind, id) {
|
|
502
505
|
bind(ContributionProvider).toDynamicValue(_ref => {
|
|
@@ -514,6 +517,20 @@
|
|
|
514
517
|
return new ContributionProviderCache(id, container);
|
|
515
518
|
}).whenTargetNamed(id);
|
|
516
519
|
}
|
|
520
|
+
class ContributionStore {
|
|
521
|
+
static getStore(id) {
|
|
522
|
+
return this.store.get(id);
|
|
523
|
+
}
|
|
524
|
+
static setStore(id, cache) {
|
|
525
|
+
this.store.set(id, cache);
|
|
526
|
+
}
|
|
527
|
+
static refreshAllContributions() {
|
|
528
|
+
this.store.forEach(cache => {
|
|
529
|
+
cache.refresh();
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
ContributionStore.store = new Map();
|
|
517
534
|
|
|
518
535
|
class Hook {
|
|
519
536
|
constructor(args, name) {
|
|
@@ -580,6 +597,48 @@
|
|
|
580
597
|
const VGlobal = Symbol.for("VGlobal");
|
|
581
598
|
const DEFAULT_TEXT_FONT_FAMILY = "PingFang SC,Helvetica Neue,Microsoft Yahei,system-ui,-apple-system,segoe ui,Roboto,Helvetica,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol";
|
|
582
599
|
|
|
600
|
+
class EventListenerManager {
|
|
601
|
+
constructor() {
|
|
602
|
+
this._listenerMap = new Map(), this._eventListenerTransformer = event => event;
|
|
603
|
+
}
|
|
604
|
+
setEventListenerTransformer(transformer) {
|
|
605
|
+
this._eventListenerTransformer = transformer || (event => event);
|
|
606
|
+
}
|
|
607
|
+
addEventListener(type, listener, options) {
|
|
608
|
+
if (!listener) return;
|
|
609
|
+
const wrappedListener = event => {
|
|
610
|
+
const transformedEvent = this._eventListenerTransformer(event);
|
|
611
|
+
"function" == typeof listener ? listener(transformedEvent) : listener.handleEvent && listener.handleEvent(transformedEvent);
|
|
612
|
+
};
|
|
613
|
+
this._listenerMap.has(type) || this._listenerMap.set(type, new Map()), this._listenerMap.get(type).set(listener, wrappedListener), this._nativeAddEventListener(type, wrappedListener, options);
|
|
614
|
+
}
|
|
615
|
+
removeEventListener(type, listener, options) {
|
|
616
|
+
var _a;
|
|
617
|
+
if (!listener) return;
|
|
618
|
+
const wrappedListener = null === (_a = this._listenerMap.get(type)) || void 0 === _a ? void 0 : _a.get(listener);
|
|
619
|
+
wrappedListener && (this._nativeRemoveEventListener(type, wrappedListener, options), this._listenerMap.get(type).delete(listener), 0 === this._listenerMap.get(type).size && this._listenerMap.delete(type));
|
|
620
|
+
}
|
|
621
|
+
dispatchEvent(event) {
|
|
622
|
+
return this._nativeDispatchEvent(event);
|
|
623
|
+
}
|
|
624
|
+
clearAllEventListeners() {
|
|
625
|
+
this._listenerMap.forEach((listenersMap, type) => {
|
|
626
|
+
listenersMap.forEach((wrappedListener, originalListener) => {
|
|
627
|
+
this._nativeRemoveEventListener(type, wrappedListener, void 0);
|
|
628
|
+
});
|
|
629
|
+
}), this._listenerMap.clear();
|
|
630
|
+
}
|
|
631
|
+
_nativeAddEventListener(type, listener, options) {
|
|
632
|
+
throw new Error("_nativeAddEventListener must be implemented by derived classes");
|
|
633
|
+
}
|
|
634
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
635
|
+
throw new Error("_nativeRemoveEventListener must be implemented by derived classes");
|
|
636
|
+
}
|
|
637
|
+
_nativeDispatchEvent(event) {
|
|
638
|
+
throw new Error("_nativeDispatchEvent must be implemented by derived classes");
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
|
|
583
642
|
var __decorate$1N = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
584
643
|
var d,
|
|
585
644
|
c = arguments.length,
|
|
@@ -620,7 +679,7 @@
|
|
|
620
679
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
621
680
|
});
|
|
622
681
|
};
|
|
623
|
-
exports.DefaultGlobal = class DefaultGlobal {
|
|
682
|
+
exports.DefaultGlobal = class DefaultGlobal extends EventListenerManager {
|
|
624
683
|
get env() {
|
|
625
684
|
return this._env;
|
|
626
685
|
}
|
|
@@ -664,10 +723,19 @@
|
|
|
664
723
|
this._env || this.setEnv("browser"), this.envContribution.applyStyles = support;
|
|
665
724
|
}
|
|
666
725
|
constructor(contributions) {
|
|
667
|
-
this.contributions = contributions, this._isImageAnonymous = !0, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
726
|
+
super(), this.contributions = contributions, this._isImageAnonymous = !0, this.eventListenerTransformer = event => event, this.id = Generator.GenAutoIncrementId(), this.hooks = {
|
|
668
727
|
onSetEnv: new SyncHook(["lastEnv", "env", "global"])
|
|
669
728
|
}, this.measureTextMethod = "native", this.optimizeVisible = !1;
|
|
670
729
|
}
|
|
730
|
+
_nativeAddEventListener(type, listener, options) {
|
|
731
|
+
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
732
|
+
}
|
|
733
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
734
|
+
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
735
|
+
}
|
|
736
|
+
_nativeDispatchEvent(event) {
|
|
737
|
+
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
738
|
+
}
|
|
671
739
|
bindContribution(params) {
|
|
672
740
|
const promiseArr = [];
|
|
673
741
|
if (this.contributions.getContributions().forEach(contribution => {
|
|
@@ -708,15 +776,6 @@
|
|
|
708
776
|
releaseCanvas(canvas) {
|
|
709
777
|
return this._env || this.setEnv("browser"), this.envContribution.releaseCanvas(canvas);
|
|
710
778
|
}
|
|
711
|
-
addEventListener(type, listener, options) {
|
|
712
|
-
return this._env || this.setEnv("browser"), this.envContribution.addEventListener(type, listener, options);
|
|
713
|
-
}
|
|
714
|
-
removeEventListener(type, listener, options) {
|
|
715
|
-
return this._env || this.setEnv("browser"), this.envContribution.removeEventListener(type, listener, options);
|
|
716
|
-
}
|
|
717
|
-
dispatchEvent(event) {
|
|
718
|
-
return this._env || this.setEnv("browser"), this.envContribution.dispatchEvent(event);
|
|
719
|
-
}
|
|
720
779
|
getRequestAnimationFrame() {
|
|
721
780
|
return this._env || this.setEnv("browser"), this.envContribution.getRequestAnimationFrame();
|
|
722
781
|
}
|
|
@@ -1178,14 +1237,14 @@
|
|
|
1178
1237
|
};
|
|
1179
1238
|
var isArrayLike$1 = isArrayLike;
|
|
1180
1239
|
|
|
1181
|
-
const isNumber = function (value) {
|
|
1240
|
+
const isNumber$1 = function (value) {
|
|
1182
1241
|
let fuzzy = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
1183
1242
|
const type = typeof value;
|
|
1184
1243
|
return fuzzy ? "number" === type : "number" === type || isType$1(value, "Number");
|
|
1185
1244
|
};
|
|
1186
|
-
var isNumber$
|
|
1245
|
+
var isNumber$2 = isNumber$1;
|
|
1187
1246
|
|
|
1188
|
-
const isValidNumber = value => isNumber$
|
|
1247
|
+
const isValidNumber = value => isNumber$2(value) && Number.isFinite(value);
|
|
1189
1248
|
var isValidNumber$1 = isValidNumber;
|
|
1190
1249
|
|
|
1191
1250
|
const isValidUrl = value => new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(value);
|
|
@@ -1268,7 +1327,7 @@
|
|
|
1268
1327
|
}(LoggerLevel || (LoggerLevel = {}));
|
|
1269
1328
|
class Logger {
|
|
1270
1329
|
static getInstance(level, method) {
|
|
1271
|
-
return Logger._instance && isNumber$
|
|
1330
|
+
return Logger._instance && isNumber$2(level) ? Logger._instance.level(level) : Logger._instance || (Logger._instance = new Logger(level, method)), Logger._instance;
|
|
1272
1331
|
}
|
|
1273
1332
|
static setInstance(logger) {
|
|
1274
1333
|
return Logger._instance = logger;
|
|
@@ -1412,10 +1471,10 @@
|
|
|
1412
1471
|
return this.x = x, this.y = y, this;
|
|
1413
1472
|
}
|
|
1414
1473
|
add(point) {
|
|
1415
|
-
return isNumber$
|
|
1474
|
+
return isNumber$2(point) ? (this.x += point, void (this.y += point)) : (this.x += point.x, this.y += point.y, this);
|
|
1416
1475
|
}
|
|
1417
1476
|
sub(point) {
|
|
1418
|
-
return isNumber$
|
|
1477
|
+
return isNumber$2(point) ? (this.x -= point, void (this.y -= point)) : (this.x -= point.x, this.y -= point.y, this);
|
|
1419
1478
|
}
|
|
1420
1479
|
multi(point) {
|
|
1421
1480
|
throw new Error("暂不支持");
|
|
@@ -2476,10 +2535,10 @@
|
|
|
2476
2535
|
return ((value = Math.max(0, Math.min(255, Math.round(value) || 0))) < 16 ? "0" : "") + value.toString(16);
|
|
2477
2536
|
}
|
|
2478
2537
|
function rgb(value) {
|
|
2479
|
-
return isNumber$
|
|
2538
|
+
return isNumber$2(value) ? new RGB(value >> 16, value >> 8 & 255, 255 & value, 1) : isArray$1(value) ? new RGB(value[0], value[1], value[2]) : new RGB(255, 255, 255);
|
|
2480
2539
|
}
|
|
2481
2540
|
function rgba(value) {
|
|
2482
|
-
return isNumber$
|
|
2541
|
+
return isNumber$2(value) ? new RGB(value >>> 24, value >>> 16 & 255, value >>> 8 & 255, 255 & value) : isArray$1(value) ? new RGB(value[0], value[1], value[2], value[3]) : new RGB(255, 255, 255, 1);
|
|
2483
2542
|
}
|
|
2484
2543
|
function SRGBToLinear(c) {
|
|
2485
2544
|
return c < .04045 ? .0773993808 * c : Math.pow(.9478672986 * c + .0521327014, 2.4);
|
|
@@ -5248,6 +5307,9 @@
|
|
|
5248
5307
|
function isNotAroundZero(val) {
|
|
5249
5308
|
return val > EPSILON || val < -EPSILON;
|
|
5250
5309
|
}
|
|
5310
|
+
function isNumber(data) {
|
|
5311
|
+
return "number" == typeof data && Number.isFinite(data);
|
|
5312
|
+
}
|
|
5251
5313
|
const _v0 = [0, 0],
|
|
5252
5314
|
_v1 = [0, 0],
|
|
5253
5315
|
_v2 = [0, 0];
|
|
@@ -5652,7 +5714,7 @@
|
|
|
5652
5714
|
};
|
|
5653
5715
|
const VWindow = Symbol.for("VWindow");
|
|
5654
5716
|
const WindowHandlerContribution = Symbol.for("WindowHandlerContribution");
|
|
5655
|
-
exports.DefaultWindow = class DefaultWindow {
|
|
5717
|
+
exports.DefaultWindow = class DefaultWindow extends EventListenerManager {
|
|
5656
5718
|
get width() {
|
|
5657
5719
|
if (this._handler) {
|
|
5658
5720
|
const wh = this._handler.getWH();
|
|
@@ -5671,7 +5733,7 @@
|
|
|
5671
5733
|
return this._handler.getDpr();
|
|
5672
5734
|
}
|
|
5673
5735
|
constructor() {
|
|
5674
|
-
this.hooks = {
|
|
5736
|
+
super(), this.hooks = {
|
|
5675
5737
|
onChange: new SyncHook(["x", "y", "width", "height"])
|
|
5676
5738
|
}, this.active = () => {
|
|
5677
5739
|
const global = this.global;
|
|
@@ -5679,6 +5741,15 @@
|
|
|
5679
5741
|
container.getNamed(WindowHandlerContribution, global.env).configure(this, global), this.actived = !0;
|
|
5680
5742
|
}, this._uid = Generator.GenAutoIncrementId(), this.global = application.global, this.postInit();
|
|
5681
5743
|
}
|
|
5744
|
+
_nativeAddEventListener(type, listener, options) {
|
|
5745
|
+
return this._handler.addEventListener(type, listener, options);
|
|
5746
|
+
}
|
|
5747
|
+
_nativeRemoveEventListener(type, listener, options) {
|
|
5748
|
+
return this._handler.removeEventListener(type, listener, options);
|
|
5749
|
+
}
|
|
5750
|
+
_nativeDispatchEvent(event) {
|
|
5751
|
+
return this._handler.dispatchEvent(event);
|
|
5752
|
+
}
|
|
5682
5753
|
postInit() {
|
|
5683
5754
|
this.global.hooks.onSetEnv.tap("window", this.active), this.active();
|
|
5684
5755
|
}
|
|
@@ -5718,7 +5789,7 @@
|
|
|
5718
5789
|
throw new Error("暂不支持");
|
|
5719
5790
|
}
|
|
5720
5791
|
release() {
|
|
5721
|
-
return this.global.hooks.onSetEnv.unTap("window", this.active), this._handler.releaseWindow();
|
|
5792
|
+
return this.global.hooks.onSetEnv.unTap("window", this.active), this.clearAllEventListeners(), this._handler.releaseWindow();
|
|
5722
5793
|
}
|
|
5723
5794
|
getContext() {
|
|
5724
5795
|
return this._handler.getContext();
|
|
@@ -5729,15 +5800,6 @@
|
|
|
5729
5800
|
getImageBuffer(type) {
|
|
5730
5801
|
return this._handler.getImageBuffer ? this._handler.getImageBuffer(type) : null;
|
|
5731
5802
|
}
|
|
5732
|
-
addEventListener(type, listener, options) {
|
|
5733
|
-
return this._handler.addEventListener(type, listener, options);
|
|
5734
|
-
}
|
|
5735
|
-
removeEventListener(type, listener, options) {
|
|
5736
|
-
return this._handler.removeEventListener(type, listener, options);
|
|
5737
|
-
}
|
|
5738
|
-
dispatchEvent(event) {
|
|
5739
|
-
return this._handler.dispatchEvent(event);
|
|
5740
|
-
}
|
|
5741
5803
|
getBoundingClientRect() {
|
|
5742
5804
|
return this._handler.getBoundingClientRect();
|
|
5743
5805
|
}
|
|
@@ -6946,19 +7008,17 @@
|
|
|
6946
7008
|
globalObj: globalObj,
|
|
6947
7009
|
domElement: domElement
|
|
6948
7010
|
} = this;
|
|
6949
|
-
this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.
|
|
7011
|
+
this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.addEventListener("pointermove", this.onPointerMove, !0), globalObj.addEventListener("pointerup", this.onPointerUp, !0)) : (domElement.addEventListener("pointermove", this.onPointerMove, !0), domElement.addEventListener("pointerup", this.onPointerUp, !0)), domElement.addEventListener("pointerdown", this.onPointerDown, !0), domElement.addEventListener("pointerleave", this.onPointerOverOut, !0), domElement.addEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.addEventListener("mousemove", this.onPointerMove, !0), globalObj.addEventListener("mouseup", this.onPointerUp, !0)) : (domElement.addEventListener("mousemove", this.onPointerMove, !0), domElement.addEventListener("mouseup", this.onPointerUp, !0)), domElement.addEventListener("mousedown", this.onPointerDown, !0), domElement.addEventListener("mouseout", this.onPointerOverOut, !0), domElement.addEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.addEventListener("touchstart", this.onPointerDown, !0), domElement.addEventListener("touchend", this.onPointerUp, !0), domElement.addEventListener("touchmove", this.onPointerMove, !0)), domElement.addEventListener("wheel", this.onWheel, {
|
|
6950
7012
|
capture: !0
|
|
6951
7013
|
}), this.eventsAdded = !0;
|
|
6952
7014
|
}
|
|
6953
7015
|
removeEvents() {
|
|
6954
|
-
var _a;
|
|
6955
7016
|
if (!this.eventsAdded || !this.domElement) return;
|
|
6956
7017
|
const {
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
this.supportsPointerEvents ? (globalDocument.removeEventListener("pointermove", this.onPointerMove, !0), globalDocument.removeEventListener("pointerup", this.onPointerUp, !0), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalDocument.removeEventListener("mousemove", this.onPointerMove, !0), globalDocument.removeEventListener("mouseup", this.onPointerUp, !0), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
|
|
7018
|
+
globalObj: globalObj,
|
|
7019
|
+
domElement: domElement
|
|
7020
|
+
} = this;
|
|
7021
|
+
this.supportsPointerEvents ? (globalObj.getDocument() ? (globalObj.removeEventListener("pointermove", this.onPointerMove, !0), globalObj.removeEventListener("pointerup", this.onPointerUp, !0)) : (domElement.removeEventListener("pointermove", this.onPointerMove, !0), domElement.removeEventListener("pointerup", this.onPointerUp, !0)), domElement.removeEventListener("pointerdown", this.onPointerDown, !0), domElement.removeEventListener("pointerleave", this.onPointerOverOut, !0), domElement.removeEventListener("pointerover", this.onPointerOverOut, !0)) : (globalObj.getDocument() ? (globalObj.removeEventListener("mousemove", this.onPointerMove, !0), globalObj.removeEventListener("mouseup", this.onPointerUp, !0)) : (domElement.removeEventListener("mousemove", this.onPointerMove, !0), domElement.removeEventListener("mouseup", this.onPointerUp, !0)), domElement.removeEventListener("mousedown", this.onPointerDown, !0), domElement.removeEventListener("mouseout", this.onPointerOverOut, !0), domElement.removeEventListener("mouseover", this.onPointerOverOut, !0)), this.supportsTouchEvents && (domElement.removeEventListener("touchstart", this.onPointerDown, !0), domElement.removeEventListener("touchend", this.onPointerUp, !0), domElement.removeEventListener("touchmove", this.onPointerMove, !0)), domElement.removeEventListener("wheel", this.onWheel, !0), this.domElement = null, this.eventsAdded = !1;
|
|
6962
7022
|
}
|
|
6963
7023
|
mapToViewportPoint(event) {
|
|
6964
7024
|
return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
|
|
@@ -7952,7 +8012,7 @@
|
|
|
7952
8012
|
}
|
|
7953
8013
|
onBind() {
|
|
7954
8014
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7955
|
-
this.fromNumber = isNumber$
|
|
8015
|
+
this.fromNumber = isNumber$2(null === (_a = this.from) || void 0 === _a ? void 0 : _a.text) ? null === (_b = this.from) || void 0 === _b ? void 0 : _b.text : Number.parseFloat(null === (_c = this.from) || void 0 === _c ? void 0 : _c.text), this.toNumber = isNumber$2(null === (_d = this.to) || void 0 === _d ? void 0 : _d.text) ? null === (_e = this.to) || void 0 === _e ? void 0 : _e.text : Number.parseFloat(null === (_f = this.to) || void 0 === _f ? void 0 : _f.text), Number.isFinite(this.toNumber) || (this.fromNumber = 0), Number.isFinite(this.toNumber) || (this.valid = !1), !1 !== this.valid && (this.decimalLength = null !== (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.fixed) && void 0 !== _h ? _h : Math.max(getDecimalPlaces(this.fromNumber), getDecimalPlaces(this.toNumber)));
|
|
7956
8016
|
}
|
|
7957
8017
|
onEnd() {}
|
|
7958
8018
|
onUpdate(end, ratio, out) {
|
|
@@ -9095,7 +9155,7 @@
|
|
|
9095
9155
|
return res;
|
|
9096
9156
|
};
|
|
9097
9157
|
const samplingPoints = (points, count) => {
|
|
9098
|
-
const validatePoints = points.filter(point => !1 !== point.defined && isNumber$
|
|
9158
|
+
const validatePoints = points.filter(point => !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y));
|
|
9099
9159
|
if (0 === validatePoints.length) return [];
|
|
9100
9160
|
if (1 === validatePoints.length) return new Array(count).fill(0).map(i => validatePoints[0]);
|
|
9101
9161
|
const res = [];
|
|
@@ -9131,7 +9191,7 @@
|
|
|
9131
9191
|
var _a;
|
|
9132
9192
|
return res.concat(null !== (_a = seg.points) && void 0 !== _a ? _a : []);
|
|
9133
9193
|
}, []));
|
|
9134
|
-
const validatePoints = points.filter(point => !1 !== point.defined && isNumber$
|
|
9194
|
+
const validatePoints = points.filter(point => !1 !== point.defined && isNumber$2(point.x) && isNumber$2(point.y));
|
|
9135
9195
|
if (!validatePoints.length) return [];
|
|
9136
9196
|
const allPoints = [];
|
|
9137
9197
|
validatePoints.forEach(point => {
|
|
@@ -9337,10 +9397,10 @@
|
|
|
9337
9397
|
|
|
9338
9398
|
function colorArrayToString(color) {
|
|
9339
9399
|
let alphaChannel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;
|
|
9340
|
-
return Array.isArray(color) && isNumber$
|
|
9400
|
+
return Array.isArray(color) && isNumber$2(color[0]) ? alphaChannel ? `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])},${color[3].toFixed(2)})` : `rgb(${Math.round(color[0])},${Math.round(color[1])},${Math.round(color[2])})` : color;
|
|
9341
9401
|
}
|
|
9342
9402
|
function interpolateColor(from, to, ratio, alphaChannel, cb) {
|
|
9343
|
-
if (Array.isArray(from) && !isNumber$
|
|
9403
|
+
if (Array.isArray(from) && !isNumber$2(from[0]) || Array.isArray(to) && !isNumber$2(to[0])) {
|
|
9344
9404
|
return new Array(4).fill(0).map((_, index) => _interpolateColor(isArray$1(from) ? from[index] : from, isArray$1(to) ? to[index] : to, ratio, alphaChannel));
|
|
9345
9405
|
}
|
|
9346
9406
|
return _interpolateColor(from, to, ratio, alphaChannel, cb);
|
|
@@ -9868,13 +9928,13 @@
|
|
|
9868
9928
|
|
|
9869
9929
|
class BaseSymbol {
|
|
9870
9930
|
bounds(size, bounds) {
|
|
9871
|
-
if (isNumber$
|
|
9931
|
+
if (isNumber$2(size)) {
|
|
9872
9932
|
const halfS = size / 2;
|
|
9873
9933
|
bounds.x1 = -halfS, bounds.x2 = halfS, bounds.y1 = -halfS, bounds.y2 = halfS;
|
|
9874
9934
|
} else bounds.x1 = -size[0] / 2, bounds.x2 = size[0] / 2, bounds.y1 = -size[1] / 2, bounds.y2 = size[1] / 2;
|
|
9875
9935
|
}
|
|
9876
9936
|
parseSize(size) {
|
|
9877
|
-
return isNumber$
|
|
9937
|
+
return isNumber$2(size) ? size : Math.min(size[0], size[1]);
|
|
9878
9938
|
}
|
|
9879
9939
|
}
|
|
9880
9940
|
|
|
@@ -10293,10 +10353,10 @@
|
|
|
10293
10353
|
super(...arguments), this.type = "rect", this.pathStr = "M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z";
|
|
10294
10354
|
}
|
|
10295
10355
|
draw(ctx, size, x, y) {
|
|
10296
|
-
return isNumber$
|
|
10356
|
+
return isNumber$2(size) ? rectSize(ctx, size, x, y) : rectSizeArray(ctx, size, x, y);
|
|
10297
10357
|
}
|
|
10298
10358
|
drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
|
|
10299
|
-
isNumber$
|
|
10359
|
+
isNumber$2(size) && (size = [size, size / 2]);
|
|
10300
10360
|
const drawLength = 2 * (size[0] + size[1]) * clipRange,
|
|
10301
10361
|
points = [{
|
|
10302
10362
|
x: x + size[0] / 2,
|
|
@@ -10328,7 +10388,7 @@
|
|
|
10328
10388
|
return !1;
|
|
10329
10389
|
}
|
|
10330
10390
|
drawOffset(ctx, size, x, y, offset) {
|
|
10331
|
-
return isNumber$
|
|
10391
|
+
return isNumber$2(size) ? rectSize(ctx, size + 2 * offset, x, y) : rectSizeArray(ctx, [size[0] + 2 * offset, size[1] + 2 * offset], x, y);
|
|
10332
10392
|
}
|
|
10333
10393
|
}
|
|
10334
10394
|
var rect = new RectSymbol();
|
|
@@ -10348,7 +10408,7 @@
|
|
|
10348
10408
|
return size = this.parseSize(size), this.drawOffset(ctx, size, x, y, 0, z, cb);
|
|
10349
10409
|
}
|
|
10350
10410
|
parseSize(size) {
|
|
10351
|
-
return isNumber$
|
|
10411
|
+
return isNumber$2(size) ? size : Math.min(size[0], size[1]);
|
|
10352
10412
|
}
|
|
10353
10413
|
drawWithClipRange(ctx, size, x, y, clipRange, z, cb) {
|
|
10354
10414
|
return size = this.parseSize(size), this.isSvg ? !!this.svgCache && (this.svgCache.forEach(item => {
|
|
@@ -12604,12 +12664,12 @@
|
|
|
12604
12664
|
textBaseline: textBaseline
|
|
12605
12665
|
} = attribute;
|
|
12606
12666
|
if (null != attribute.forceBoundsHeight) {
|
|
12607
|
-
const h = isNumber$
|
|
12667
|
+
const h = isNumber$2(attribute.forceBoundsHeight) ? attribute.forceBoundsHeight : attribute.forceBoundsHeight(),
|
|
12608
12668
|
dy = textLayoutOffsetY(textBaseline, h, h);
|
|
12609
12669
|
aabbBounds.set(aabbBounds.x1, dy, aabbBounds.x2, dy + h);
|
|
12610
12670
|
}
|
|
12611
12671
|
if (null != attribute.forceBoundsWidth) {
|
|
12612
|
-
const w = isNumber$
|
|
12672
|
+
const w = isNumber$2(attribute.forceBoundsWidth) ? attribute.forceBoundsWidth : attribute.forceBoundsWidth(),
|
|
12613
12673
|
dx = textDrawOffsetX(textAlign, w);
|
|
12614
12674
|
aabbBounds.set(dx, aabbBounds.y1, dx + w, aabbBounds.y2);
|
|
12615
12675
|
}
|
|
@@ -14708,7 +14768,7 @@
|
|
|
14708
14768
|
}
|
|
14709
14769
|
} else {
|
|
14710
14770
|
const richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
|
|
14711
|
-
if (isNumber$
|
|
14771
|
+
if (isNumber$2(richTextConfig.text) && (richTextConfig.text = `${richTextConfig.text}`), richTextConfig.text && richTextConfig.text.includes("\n")) {
|
|
14712
14772
|
const textParts = richTextConfig.text.split("\n");
|
|
14713
14773
|
for (let j = 0; j < textParts.length; j++) if (0 === j) paragraphs.push(new Paragraph(textParts[j], !1, richTextConfig, ascentDescentMode));else if (textParts[j] || i === textConfig.length - 1) paragraphs.push(new Paragraph(textParts[j], !0, richTextConfig, ascentDescentMode));else {
|
|
14714
14774
|
const nextRichTextConfig = this.combinedStyleToCharacter(textConfig[i + 1]);
|
|
@@ -14995,7 +15055,7 @@
|
|
|
14995
15055
|
} = this.attribute;
|
|
14996
15056
|
if (outerRadius += outerPadding, innerRadius -= innerPadding, 0 === cornerRadius || "0%" === cornerRadius) return 0;
|
|
14997
15057
|
const deltaRadius = Math.abs(outerRadius - innerRadius),
|
|
14998
|
-
parseCR = cornerRadius => Math.min(isNumber$
|
|
15058
|
+
parseCR = cornerRadius => Math.min(isNumber$2(cornerRadius, !0) ? cornerRadius : deltaRadius * parseFloat(cornerRadius) / 100, deltaRadius / 2);
|
|
14999
15059
|
if (isArray$1(cornerRadius)) {
|
|
15000
15060
|
const crList = cornerRadius.map(cr => parseCR(cr) || 0);
|
|
15001
15061
|
return 0 === crList.length ? [crList[0], crList[0], crList[0], crList[0]] : 2 === crList.length ? [crList[0], crList[1], crList[0], crList[1]] : (3 === crList.length && crList.push(0), crList);
|
|
@@ -15997,7 +16057,7 @@
|
|
|
15997
16057
|
let roundCorner = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !0;
|
|
15998
16058
|
let edgeCb = arguments.length > 7 ? arguments[7] : undefined;
|
|
15999
16059
|
let cornerRadius;
|
|
16000
|
-
if (Array.isArray(roundCorner) && (edgeCb = roundCorner, roundCorner = !0), width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$
|
|
16060
|
+
if (Array.isArray(roundCorner) && (edgeCb = roundCorner, roundCorner = !0), width < 0 && (x += width, width = -width), height < 0 && (y += height, height = -height), isNumber$2(rectCornerRadius, !0)) cornerRadius = [rectCornerRadius = abs(rectCornerRadius), rectCornerRadius, rectCornerRadius, rectCornerRadius];else if (Array.isArray(rectCornerRadius)) {
|
|
16001
16061
|
const cornerRadiusArr = rectCornerRadius;
|
|
16002
16062
|
let cr0, cr1;
|
|
16003
16063
|
switch (cornerRadiusArr.length) {
|
|
@@ -16273,6 +16333,9 @@
|
|
|
16273
16333
|
init(contributions) {
|
|
16274
16334
|
contributions && (this._renderContribitions = contributions.getContributions()), this._renderContribitions || (this._renderContribitions = []), this.builtinContributions || (this.builtinContributions = []), this.builtinContributions.push(defaultBaseClipRenderBeforeContribution), this.builtinContributions.push(defaultBaseClipRenderAfterContribution), this.builtinContributions.forEach(item => this._renderContribitions.push(item)), this._renderContribitions.length && (this._renderContribitions.sort((a, b) => b.order - a.order), this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.beforeFillStroke), this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === exports.BaseRenderContributionTime.afterFillStroke));
|
|
16275
16335
|
}
|
|
16336
|
+
reInit() {
|
|
16337
|
+
this.init(this.graphicRenderContributions);
|
|
16338
|
+
}
|
|
16276
16339
|
beforeRenderStep(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, params) {
|
|
16277
16340
|
this._beforeRenderContribitions && this._beforeRenderContribitions.forEach(c => {
|
|
16278
16341
|
if (c.supportedAppName && graphic.stage && graphic.stage.params && graphic.stage.params.context && graphic.stage.params.context.appName) {
|
|
@@ -16442,8 +16505,8 @@
|
|
|
16442
16505
|
};
|
|
16443
16506
|
};
|
|
16444
16507
|
exports.DefaultCanvasArcRender = class DefaultCanvasArcRender extends BaseRender {
|
|
16445
|
-
constructor(
|
|
16446
|
-
super(), this.
|
|
16508
|
+
constructor(graphicRenderContributions) {
|
|
16509
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = ARC_NUMBER_TYPE, this.builtinContributions = [defaultArcRenderContribution, defaultArcBackgroundRenderContribution, defaultArcTextureRenderContribution], this.init(graphicRenderContributions);
|
|
16447
16510
|
}
|
|
16448
16511
|
drawArcTailCapPath(arc, context, cx, cy, outerRadius, innerRadius, _sa, _ea) {
|
|
16449
16512
|
const capAngle = _ea - _sa,
|
|
@@ -16618,8 +16681,8 @@
|
|
|
16618
16681
|
};
|
|
16619
16682
|
};
|
|
16620
16683
|
exports.DefaultCanvasCircleRender = class DefaultCanvasCircleRender extends BaseRender {
|
|
16621
|
-
constructor(
|
|
16622
|
-
super(), this.
|
|
16684
|
+
constructor(graphicRenderContributions) {
|
|
16685
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = CIRCLE_NUMBER_TYPE, this.builtinContributions = [defaultCircleRenderContribution, defaultCircleBackgroundRenderContribution, defaultCircleTextureRenderContribution], this.init(graphicRenderContributions);
|
|
16623
16686
|
}
|
|
16624
16687
|
drawShape(circle, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
16625
16688
|
const circleAttribute = getTheme(circle, null == params ? void 0 : params.theme).circle,
|
|
@@ -17005,8 +17068,8 @@
|
|
|
17005
17068
|
};
|
|
17006
17069
|
};
|
|
17007
17070
|
exports.DefaultCanvasAreaRender = class DefaultCanvasAreaRender extends BaseRender {
|
|
17008
|
-
constructor(
|
|
17009
|
-
super(), this.
|
|
17071
|
+
constructor(graphicRenderContributions) {
|
|
17072
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = AREA_NUMBER_TYPE, this.builtinContributions = [defaultAreaTextureRenderContribution, defaultAreaBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
17010
17073
|
}
|
|
17011
17074
|
drawLinearAreaHighPerformance(area, context, fill, stroke, fillOpacity, strokeOpacity, offsetX, offsetY, areaAttribute, drawContext, params, fillCb, strokeCb) {
|
|
17012
17075
|
var _a, _b, _c;
|
|
@@ -17249,8 +17312,8 @@
|
|
|
17249
17312
|
};
|
|
17250
17313
|
};
|
|
17251
17314
|
exports.DefaultCanvasPathRender = class DefaultCanvasPathRender extends BaseRender {
|
|
17252
|
-
constructor(
|
|
17253
|
-
super(), this.
|
|
17315
|
+
constructor(graphicRenderContributions) {
|
|
17316
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = PATH_NUMBER_TYPE, this.builtinContributions = [defaultPathBackgroundRenderContribution, defaultPathTextureRenderContribution], this.init(graphicRenderContributions);
|
|
17254
17317
|
}
|
|
17255
17318
|
drawShape(path, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17256
17319
|
var _a, _b, _c;
|
|
@@ -17305,8 +17368,8 @@
|
|
|
17305
17368
|
};
|
|
17306
17369
|
};
|
|
17307
17370
|
exports.DefaultCanvasRectRender = class DefaultCanvasRectRender extends BaseRender {
|
|
17308
|
-
constructor(
|
|
17309
|
-
super(), this.
|
|
17371
|
+
constructor(graphicRenderContributions) {
|
|
17372
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.type = "rect", this.numberType = RECT_NUMBER_TYPE, this.builtinContributions = [defaultRectRenderContribution, defaultRectBackgroundRenderContribution, defaultRectTextureRenderContribution], this.init(graphicRenderContributions);
|
|
17310
17373
|
}
|
|
17311
17374
|
drawShape(rect, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17312
17375
|
var _a;
|
|
@@ -17377,8 +17440,8 @@
|
|
|
17377
17440
|
};
|
|
17378
17441
|
};
|
|
17379
17442
|
exports.DefaultCanvasSymbolRender = class DefaultCanvasSymbolRender extends BaseRender {
|
|
17380
|
-
constructor(
|
|
17381
|
-
super(), this.
|
|
17443
|
+
constructor(graphicRenderContributions) {
|
|
17444
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = SYMBOL_NUMBER_TYPE, this.builtinContributions = [defaultSymbolRenderContribution, defaultSymbolBackgroundRenderContribution, defaultSymbolTextureRenderContribution, defaultSymbolClipRangeStrokeRenderContribution], this.init(graphicRenderContributions);
|
|
17382
17445
|
}
|
|
17383
17446
|
drawShape(symbol, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17384
17447
|
var _a;
|
|
@@ -17549,8 +17612,8 @@
|
|
|
17549
17612
|
};
|
|
17550
17613
|
};
|
|
17551
17614
|
exports.DefaultCanvasTextRender = class DefaultCanvasTextRender extends BaseRender {
|
|
17552
|
-
constructor(
|
|
17553
|
-
super(), this.
|
|
17615
|
+
constructor(graphicRenderContributions) {
|
|
17616
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = TEXT_NUMBER_TYPE, this.builtinContributions = [defaultTextBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
17554
17617
|
}
|
|
17555
17618
|
drawShape(text, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17556
17619
|
var _a, _b, _c;
|
|
@@ -17764,8 +17827,8 @@
|
|
|
17764
17827
|
};
|
|
17765
17828
|
};
|
|
17766
17829
|
exports.DefaultCanvasPolygonRender = class DefaultCanvasPolygonRender extends BaseRender {
|
|
17767
|
-
constructor(
|
|
17768
|
-
super(), this.
|
|
17830
|
+
constructor(graphicRenderContributions) {
|
|
17831
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = POLYGON_NUMBER_TYPE, this.builtinContributions = [defaultPolygonBackgroundRenderContribution, defaultPolygonTextureRenderContribution], this.init(graphicRenderContributions);
|
|
17769
17832
|
}
|
|
17770
17833
|
drawShape(polygon, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17771
17834
|
const polygonAttribute = getTheme(polygon, null == params ? void 0 : params.theme).polygon,
|
|
@@ -17820,6 +17883,9 @@
|
|
|
17820
17883
|
constructor(groupRenderContribitions) {
|
|
17821
17884
|
this.groupRenderContribitions = groupRenderContribitions, this.numberType = GROUP_NUMBER_TYPE;
|
|
17822
17885
|
}
|
|
17886
|
+
reInit() {
|
|
17887
|
+
this._groupRenderContribitions = this.groupRenderContribitions.getContributions() || [], this._groupRenderContribitions.push(defaultGroupBackgroundRenderContribution);
|
|
17888
|
+
}
|
|
17823
17889
|
drawShape(group, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17824
17890
|
const groupAttribute = getTheme(group, null == params ? void 0 : params.theme).group,
|
|
17825
17891
|
{
|
|
@@ -17950,8 +18016,8 @@
|
|
|
17950
18016
|
};
|
|
17951
18017
|
const repeatStr = ["", "repeat-x", "repeat-y", "repeat"];
|
|
17952
18018
|
exports.DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender {
|
|
17953
|
-
constructor(
|
|
17954
|
-
super(), this.
|
|
18019
|
+
constructor(graphicRenderContributions) {
|
|
18020
|
+
super(), this.graphicRenderContributions = graphicRenderContributions, this.numberType = IMAGE_NUMBER_TYPE, this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution], this.init(graphicRenderContributions);
|
|
17955
18021
|
}
|
|
17956
18022
|
drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
17957
18023
|
const imageAttribute = getTheme(image).image,
|
|
@@ -18281,6 +18347,9 @@
|
|
|
18281
18347
|
afterDraw(params) {
|
|
18282
18348
|
this.drawContribution.afterDraw && this.drawContribution.afterDraw(this, Object.assign({}, this.drawParams));
|
|
18283
18349
|
}
|
|
18350
|
+
reInit() {
|
|
18351
|
+
this.drawContribution.reInit();
|
|
18352
|
+
}
|
|
18284
18353
|
render(groups, params) {
|
|
18285
18354
|
this.renderTreeRoots = groups, this.drawParams = params;
|
|
18286
18355
|
const updateBounds = params.updateBounds;
|
|
@@ -18684,6 +18753,11 @@
|
|
|
18684
18753
|
constructor(contributions, drawItemInterceptorContributions) {
|
|
18685
18754
|
this.contributions = contributions, this.drawItemInterceptorContributions = drawItemInterceptorContributions, this.currentRenderMap = new Map(), this.defaultRenderMap = new Map(), this.styleRenderMap = new Map(), this.dirtyBounds = new Bounds(), this.backupDirtyBounds = new Bounds(), this.global = application.global, this.layerService = application.layerService, isArray$1(this.contributions) || (this.contributions = [this.contributions]), this.init();
|
|
18686
18755
|
}
|
|
18756
|
+
reInit() {
|
|
18757
|
+
this.init(), this.contributions.forEach(item => {
|
|
18758
|
+
item.reInit();
|
|
18759
|
+
});
|
|
18760
|
+
}
|
|
18687
18761
|
init() {
|
|
18688
18762
|
this.contributions.forEach(item => {
|
|
18689
18763
|
if (item.style) {
|
|
@@ -19811,6 +19885,9 @@
|
|
|
19811
19885
|
getPickerService() {
|
|
19812
19886
|
return this.pickerService || (this.pickerService = container.get(PickerService)), this.pickerService;
|
|
19813
19887
|
}
|
|
19888
|
+
reInit() {
|
|
19889
|
+
this.renderService.reInit(), this.pickerService.reInit();
|
|
19890
|
+
}
|
|
19814
19891
|
}
|
|
19815
19892
|
|
|
19816
19893
|
function createStage(params) {
|
|
@@ -20408,6 +20485,9 @@
|
|
|
20408
20485
|
constructor(pickItemInterceptorContributions, pickServiceInterceptorContributions) {
|
|
20409
20486
|
this.pickItemInterceptorContributions = pickItemInterceptorContributions, this.pickServiceInterceptorContributions = pickServiceInterceptorContributions, this.type = "default", this.global = application.global;
|
|
20410
20487
|
}
|
|
20488
|
+
reInit() {
|
|
20489
|
+
this._init();
|
|
20490
|
+
}
|
|
20411
20491
|
_init() {
|
|
20412
20492
|
this.InterceptorContributions = this.pickItemInterceptorContributions.getContributions().sort((a, b) => a.order - b.order), this.pickerServiceInterceptorContributions = this.pickServiceInterceptorContributions.getContributions().sort((a, b) => a.order - b.order);
|
|
20413
20493
|
}
|
|
@@ -20522,6 +20602,7 @@
|
|
|
20522
20602
|
this.configure(global, env);
|
|
20523
20603
|
}), this.configure(this.global, this.global.env);
|
|
20524
20604
|
}
|
|
20605
|
+
reInit() {}
|
|
20525
20606
|
configure(global, env) {}
|
|
20526
20607
|
pick(graphics, point, params) {
|
|
20527
20608
|
let result = {
|
|
@@ -20594,6 +20675,62 @@
|
|
|
20594
20675
|
return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
|
|
20595
20676
|
}
|
|
20596
20677
|
|
|
20678
|
+
function isIdentityMatrix(matrix) {
|
|
20679
|
+
return 1 === matrix.a && 0 === matrix.b && 0 === matrix.c && 1 === matrix.d && 0 === matrix.e && 0 === matrix.f;
|
|
20680
|
+
}
|
|
20681
|
+
function createEventTransformer(containerElement, getMatrix, getRect, transformPoint) {
|
|
20682
|
+
return event => {
|
|
20683
|
+
if (!(event instanceof MouseEvent || event instanceof TouchEvent || event instanceof PointerEvent)) return event;
|
|
20684
|
+
const transformMatrix = getMatrix();
|
|
20685
|
+
if (isIdentityMatrix(transformMatrix)) return event;
|
|
20686
|
+
const containerRect = getRect(),
|
|
20687
|
+
transformedEvent = new event.constructor(event.type, event);
|
|
20688
|
+
if (Object.defineProperties(transformedEvent, {
|
|
20689
|
+
target: {
|
|
20690
|
+
value: event.target
|
|
20691
|
+
},
|
|
20692
|
+
currentTarget: {
|
|
20693
|
+
value: event.currentTarget
|
|
20694
|
+
}
|
|
20695
|
+
}), event instanceof MouseEvent || event instanceof PointerEvent) transformPoint(event.clientX, event.clientY, transformMatrix, containerRect, transformedEvent);else if (event instanceof TouchEvent && event.touches.length > 0) {
|
|
20696
|
+
const touch = event.touches[0];
|
|
20697
|
+
transformPoint(touch.clientX, touch.clientY, transformMatrix, containerRect, transformedEvent);
|
|
20698
|
+
}
|
|
20699
|
+
return transformedEvent;
|
|
20700
|
+
};
|
|
20701
|
+
}
|
|
20702
|
+
function createCanvasEventTransformer(canvasElement, getMatrix, getRect, transformPoint) {
|
|
20703
|
+
return createEventTransformer(canvasElement.parentElement || canvasElement, getMatrix, getRect, transformPoint);
|
|
20704
|
+
}
|
|
20705
|
+
function registerWindowEventTransformer(window, container, getMatrix, getRect, transformPoint) {
|
|
20706
|
+
const transformer = createEventTransformer(container, getMatrix, getRect, transformPoint);
|
|
20707
|
+
window.setEventListenerTransformer(transformer);
|
|
20708
|
+
}
|
|
20709
|
+
function registerGlobalEventTransformer(global, container, getMatrix, getRect, transformPoint) {
|
|
20710
|
+
const transformer = createEventTransformer(container, getMatrix, getRect, transformPoint);
|
|
20711
|
+
global.setEventListenerTransformer(transformer);
|
|
20712
|
+
}
|
|
20713
|
+
function transformPointForCanvas(clientX, clientY, matrix, rect, transformedEvent) {
|
|
20714
|
+
const transformedPoint = {
|
|
20715
|
+
x: clientX,
|
|
20716
|
+
y: clientY
|
|
20717
|
+
};
|
|
20718
|
+
matrix.transformPoint(transformedPoint, transformedPoint), Object.defineProperties(transformedEvent, {
|
|
20719
|
+
_canvasX: {
|
|
20720
|
+
value: transformedPoint.x
|
|
20721
|
+
},
|
|
20722
|
+
_canvasY: {
|
|
20723
|
+
value: transformedPoint.y
|
|
20724
|
+
}
|
|
20725
|
+
});
|
|
20726
|
+
}
|
|
20727
|
+
function mapToCanvasPointForCanvas(nativeEvent) {
|
|
20728
|
+
if (isNumber(nativeEvent._canvasX) && isNumber(nativeEvent._canvasY)) return {
|
|
20729
|
+
x: nativeEvent._canvasX,
|
|
20730
|
+
y: nativeEvent._canvasY
|
|
20731
|
+
};
|
|
20732
|
+
}
|
|
20733
|
+
|
|
20597
20734
|
var __rest$1 = undefined && undefined.__rest || function (s, e) {
|
|
20598
20735
|
var t = {};
|
|
20599
20736
|
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0 && (t[p] = s[p]);
|
|
@@ -21805,6 +21942,7 @@
|
|
|
21805
21942
|
constructor() {
|
|
21806
21943
|
this.numberType = GLYPH_NUMBER_TYPE;
|
|
21807
21944
|
}
|
|
21945
|
+
reInit() {}
|
|
21808
21946
|
drawShape(glyph, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
21809
21947
|
drawContext.drawContribution && glyph.getSubGraphic().forEach(item => {
|
|
21810
21948
|
const renderer = drawContext.drawContribution.getRenderContribution(item);
|
|
@@ -24337,6 +24475,10 @@
|
|
|
24337
24475
|
drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb) {
|
|
24338
24476
|
if (this.canvasRenderer.drawShape) return this.canvasRenderer.drawShape(graphic, ctx, x, y, drawContext, params, fillCb, strokeCb);
|
|
24339
24477
|
}
|
|
24478
|
+
reInit() {
|
|
24479
|
+
var _a;
|
|
24480
|
+
null === (_a = this.canvasRenderer) || void 0 === _a || _a.reInit();
|
|
24481
|
+
}
|
|
24340
24482
|
}
|
|
24341
24483
|
|
|
24342
24484
|
var __decorate$18 = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -27151,7 +27293,7 @@
|
|
|
27151
27293
|
x += point.x, y += point.y, pickContext.setTransformForCurrent();
|
|
27152
27294
|
} else x = 0, y = 0, onlyTranslate = !1, pickContext.transformFromMatrix(rect.transMatrix, !0);
|
|
27153
27295
|
let picked = !0;
|
|
27154
|
-
if (!onlyTranslate || rect.shadowRoot || isNumber$
|
|
27296
|
+
if (!onlyTranslate || rect.shadowRoot || isNumber$2(cornerRadius, !0) && 0 !== cornerRadius || isArray$1(cornerRadius) && cornerRadius.some(num => 0 !== num)) picked = !1, this.canvasRenderer.drawShape(rect, pickContext, x, y, {}, null, (context, rectAttribute, themeAttribute) => !!picked || (picked = context.isPointInPath(point.x, point.y), picked), (context, rectAttribute, themeAttribute) => {
|
|
27155
27297
|
if (picked) return !0;
|
|
27156
27298
|
const lineWidth = rectAttribute.lineWidth || themeAttribute.lineWidth,
|
|
27157
27299
|
pickStrokeBuffer = rectAttribute.pickStrokeBuffer || themeAttribute.pickStrokeBuffer,
|
|
@@ -31891,7 +32033,7 @@
|
|
|
31891
32033
|
|
|
31892
32034
|
const roughModule = _roughModule;
|
|
31893
32035
|
|
|
31894
|
-
const version = "0.22.
|
|
32036
|
+
const version = "0.22.9-alpha.1";
|
|
31895
32037
|
preLoadAllModule();
|
|
31896
32038
|
if (isBrowserEnv()) {
|
|
31897
32039
|
loadBrowserEnv(container);
|
|
@@ -31988,6 +32130,7 @@
|
|
|
31988
32130
|
exports.ContainerModule = ContainerModule;
|
|
31989
32131
|
exports.Context2dFactory = Context2dFactory;
|
|
31990
32132
|
exports.ContributionProvider = ContributionProvider;
|
|
32133
|
+
exports.ContributionStore = ContributionStore;
|
|
31991
32134
|
exports.CurveContext = CurveContext;
|
|
31992
32135
|
exports.CustomEvent = CustomEvent;
|
|
31993
32136
|
exports.CustomPath2D = CustomPath2D;
|
|
@@ -32277,9 +32420,11 @@
|
|
|
32277
32420
|
exports.createArc = createArc;
|
|
32278
32421
|
exports.createArc3d = createArc3d;
|
|
32279
32422
|
exports.createArea = createArea;
|
|
32423
|
+
exports.createCanvasEventTransformer = createCanvasEventTransformer;
|
|
32280
32424
|
exports.createCircle = createCircle;
|
|
32281
32425
|
exports.createColor = createColor;
|
|
32282
32426
|
exports.createConicalGradient = createConicalGradient;
|
|
32427
|
+
exports.createEventTransformer = createEventTransformer;
|
|
32283
32428
|
exports.createGifImage = createGifImage;
|
|
32284
32429
|
exports.createGlyph = createGlyph;
|
|
32285
32430
|
exports.createGroup = createGroup;
|
|
@@ -32438,6 +32583,7 @@
|
|
|
32438
32583
|
exports.lottieCanvasPickModule = lottieCanvasPickModule;
|
|
32439
32584
|
exports.lottieModule = lottieModule;
|
|
32440
32585
|
exports.lynxEnvModule = lynxEnvModule;
|
|
32586
|
+
exports.mapToCanvasPointForCanvas = mapToCanvasPointForCanvas;
|
|
32441
32587
|
exports.mat3Tomat4 = mat3Tomat4;
|
|
32442
32588
|
exports.mat4Allocate = mat4Allocate;
|
|
32443
32589
|
exports.matrixAllocate = matrixAllocate;
|
|
@@ -32497,6 +32643,7 @@
|
|
|
32497
32643
|
exports.registerFlexLayoutPlugin = registerFlexLayoutPlugin;
|
|
32498
32644
|
exports.registerGifGraphic = registerGifGraphic;
|
|
32499
32645
|
exports.registerGifImage = registerGifImage;
|
|
32646
|
+
exports.registerGlobalEventTransformer = registerGlobalEventTransformer;
|
|
32500
32647
|
exports.registerGlyph = registerGlyph;
|
|
32501
32648
|
exports.registerGlyphGraphic = registerGlyphGraphic;
|
|
32502
32649
|
exports.registerGroup = registerGroup;
|
|
@@ -32529,6 +32676,7 @@
|
|
|
32529
32676
|
exports.registerText = registerText;
|
|
32530
32677
|
exports.registerTextGraphic = registerTextGraphic;
|
|
32531
32678
|
exports.registerViewTransform3dPlugin = registerViewTransform3dPlugin;
|
|
32679
|
+
exports.registerWindowEventTransformer = registerWindowEventTransformer;
|
|
32532
32680
|
exports.registerWrapText = registerWrapText;
|
|
32533
32681
|
exports.registerWrapTextGraphic = registerWrapTextGraphic;
|
|
32534
32682
|
exports.renderCommandList = renderCommandList;
|
|
@@ -32579,6 +32727,7 @@
|
|
|
32579
32727
|
exports.textModule = textModule;
|
|
32580
32728
|
exports.transformKeys = transformKeys;
|
|
32581
32729
|
exports.transformMat4 = transformMat4;
|
|
32730
|
+
exports.transformPointForCanvas = transformPointForCanvas;
|
|
32582
32731
|
exports.transformUtil = transformUtil;
|
|
32583
32732
|
exports.translate = translate;
|
|
32584
32733
|
exports.ttEnvModule = ttEnvModule;
|