@visactor/vrender 0.18.2 → 0.18.4
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.js +259 -222
- 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 +5 -5
package/dist/index.js
CHANGED
|
@@ -6287,7 +6287,8 @@
|
|
|
6287
6287
|
}, {
|
|
6288
6288
|
key: "style",
|
|
6289
6289
|
get: function get() {
|
|
6290
|
-
|
|
6290
|
+
var _a;
|
|
6291
|
+
return null !== (_a = this._handler.getStyle()) && void 0 !== _a ? _a : {};
|
|
6291
6292
|
},
|
|
6292
6293
|
set: function set(style) {
|
|
6293
6294
|
this._handler.setStyle(style);
|
|
@@ -6295,9 +6296,20 @@
|
|
|
6295
6296
|
}, {
|
|
6296
6297
|
key: "create",
|
|
6297
6298
|
value: function create(params) {
|
|
6299
|
+
var _a, _b;
|
|
6298
6300
|
this._handler.createWindow(params);
|
|
6299
6301
|
var windowWH = this._handler.getWH();
|
|
6300
|
-
this._width = windowWH.width, this._height = windowWH.height,
|
|
6302
|
+
this._width = windowWH.width, this._height = windowWH.height, params.viewBox ? this.setViewBox(params.viewBox) : !1 !== params.canvasControled ? this.setViewBox({
|
|
6303
|
+
x1: 0,
|
|
6304
|
+
y1: 0,
|
|
6305
|
+
x2: this._width,
|
|
6306
|
+
y2: this._height
|
|
6307
|
+
}) : this.setViewBox({
|
|
6308
|
+
x1: 0,
|
|
6309
|
+
y1: 0,
|
|
6310
|
+
x2: null !== (_a = params.width) && void 0 !== _a ? _a : this._width,
|
|
6311
|
+
y2: null !== (_b = params.height) && void 0 !== _b ? _b : this._height
|
|
6312
|
+
}), this.title = this._handler.getTitle(), this.resizable = !0;
|
|
6301
6313
|
}
|
|
6302
6314
|
}, {
|
|
6303
6315
|
key: "setWindowHandler",
|
|
@@ -6366,8 +6378,47 @@
|
|
|
6366
6378
|
}
|
|
6367
6379
|
}, {
|
|
6368
6380
|
key: "clearViewBox",
|
|
6369
|
-
value: function clearViewBox(
|
|
6370
|
-
this._handler.clearViewBox(
|
|
6381
|
+
value: function clearViewBox(color) {
|
|
6382
|
+
this._handler.clearViewBox(color);
|
|
6383
|
+
}
|
|
6384
|
+
}, {
|
|
6385
|
+
key: "setViewBox",
|
|
6386
|
+
value: function setViewBox(viewBox) {
|
|
6387
|
+
this._handler.setViewBox(viewBox);
|
|
6388
|
+
}
|
|
6389
|
+
}, {
|
|
6390
|
+
key: "setViewBoxTransform",
|
|
6391
|
+
value: function setViewBoxTransform(a, b, c, d, e, f) {
|
|
6392
|
+
this._handler.setViewBoxTransform(a, b, c, d, e, f);
|
|
6393
|
+
}
|
|
6394
|
+
}, {
|
|
6395
|
+
key: "getViewBox",
|
|
6396
|
+
value: function getViewBox() {
|
|
6397
|
+
return this._handler.getViewBox();
|
|
6398
|
+
}
|
|
6399
|
+
}, {
|
|
6400
|
+
key: "getViewBoxTransform",
|
|
6401
|
+
value: function getViewBoxTransform() {
|
|
6402
|
+
return this._handler.getViewBoxTransform();
|
|
6403
|
+
}
|
|
6404
|
+
}, {
|
|
6405
|
+
key: "pointTransform",
|
|
6406
|
+
value: function pointTransform(x, y) {
|
|
6407
|
+
var vb = this._handler.getViewBox(),
|
|
6408
|
+
nextP = {
|
|
6409
|
+
x: x,
|
|
6410
|
+
y: y
|
|
6411
|
+
};
|
|
6412
|
+
return this._handler.getViewBoxTransform().transformPoint({
|
|
6413
|
+
x: x,
|
|
6414
|
+
y: y
|
|
6415
|
+
}, nextP), nextP.x -= vb.x1, nextP.y -= vb.y1, nextP;
|
|
6416
|
+
}
|
|
6417
|
+
}, {
|
|
6418
|
+
key: "hasSubView",
|
|
6419
|
+
value: function hasSubView() {
|
|
6420
|
+
var viewBox = this._handler.getViewBox();
|
|
6421
|
+
return !(0 === viewBox.x1 && 0 === viewBox.y1 && this.width === viewBox.width() && this.height === viewBox.height());
|
|
6371
6422
|
}
|
|
6372
6423
|
}, {
|
|
6373
6424
|
key: "isVisible",
|
|
@@ -6485,8 +6536,16 @@
|
|
|
6485
6536
|
var window = container.get(VWindow),
|
|
6486
6537
|
bounds = graphic.AABBBounds,
|
|
6487
6538
|
width = bounds.width(),
|
|
6488
|
-
height = bounds.height()
|
|
6539
|
+
height = bounds.height(),
|
|
6540
|
+
x1 = -bounds.x1,
|
|
6541
|
+
y1 = -bounds.y1;
|
|
6489
6542
|
window.create({
|
|
6543
|
+
viewBox: {
|
|
6544
|
+
x1: x1,
|
|
6545
|
+
y1: y1,
|
|
6546
|
+
x2: bounds.x2,
|
|
6547
|
+
y2: bounds.y2
|
|
6548
|
+
},
|
|
6490
6549
|
width: width,
|
|
6491
6550
|
height: height,
|
|
6492
6551
|
canvas: canvas,
|
|
@@ -6495,14 +6554,10 @@
|
|
|
6495
6554
|
offscreen: !0,
|
|
6496
6555
|
title: ""
|
|
6497
6556
|
});
|
|
6498
|
-
var
|
|
6499
|
-
y = -bounds.y1,
|
|
6500
|
-
disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
|
|
6557
|
+
var disableCheckGraphicWidthOutRange = stage.params.optimize.disableCheckGraphicWidthOutRange;
|
|
6501
6558
|
stage.params.optimize.disableCheckGraphicWidthOutRange = !0, stage.defaultLayer.getNativeHandler().drawTo(window, [graphic], {
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
width: width,
|
|
6505
|
-
height: height,
|
|
6559
|
+
transMatrix: window.getViewBoxTransform(),
|
|
6560
|
+
viewBox: window.getViewBox(),
|
|
6506
6561
|
stage: stage,
|
|
6507
6562
|
layer: stage.defaultLayer,
|
|
6508
6563
|
renderService: stage.renderService,
|
|
@@ -7667,7 +7722,7 @@
|
|
|
7667
7722
|
var mappers = this.mappingTable[e.type];
|
|
7668
7723
|
var target;
|
|
7669
7724
|
var cacheKey = "".concat(e.canvasX, "-").concat(e.canvasY);
|
|
7670
|
-
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.
|
|
7725
|
+
if ((null === (_a = this._prePointTargetCache) || void 0 === _a ? void 0 : _a[cacheKey]) && (null === (_c = null === (_b = this._prePointTargetCache) || void 0 === _b ? void 0 : _b[cacheKey]) || void 0 === _c ? void 0 : _c.stage) && (null === (_e = null === (_d = this._prePointTargetCache) || void 0 === _d ? void 0 : _d[cacheKey]) || void 0 === _e ? void 0 : _e.stage.renderCount) === (null === (_f = this._prePointTargetCache) || void 0 === _f ? void 0 : _f.stageRenderCount) ? target = this._prePointTargetCache[cacheKey] : (target = this.pickTarget(e.viewX, e.viewY, e), e.pickParams || (this._prePointTargetCache = _defineProperty(_defineProperty({}, cacheKey, target), "stageRenderCount", null !== (_g = null == target ? void 0 : target.stage.renderCount) && void 0 !== _g ? _g : -1))), mappers) for (var i = 0, j = mappers.length; i < j; i++) mappers[i].fn(e, target);else Logger.getInstance().warn("[EventManager]: Event mapping not defined for ".concat(e.type));
|
|
7671
7726
|
}
|
|
7672
7727
|
}, {
|
|
7673
7728
|
key: "propagate",
|
|
@@ -7709,14 +7764,16 @@
|
|
|
7709
7764
|
}, {
|
|
7710
7765
|
key: "createPointerEvent",
|
|
7711
7766
|
value: function createPointerEvent(from, type, target) {
|
|
7767
|
+
var _a, _b;
|
|
7712
7768
|
var event = this.allocateEvent(FederatedPointerEvent);
|
|
7713
|
-
return this.copyPointerData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(event.global.x, event.global.y, event), "string" == typeof type && (event.type = type), event;
|
|
7769
|
+
return this.copyPointerData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(null !== (_a = event.viewX) && void 0 !== _a ? _a : event.global.x, null !== (_b = event.viewY) && void 0 !== _b ? _b : event.global.y, event), "string" == typeof type && (event.type = type), event;
|
|
7714
7770
|
}
|
|
7715
7771
|
}, {
|
|
7716
7772
|
key: "createWheelEvent",
|
|
7717
7773
|
value: function createWheelEvent(from, target) {
|
|
7774
|
+
var _a, _b;
|
|
7718
7775
|
var event = this.allocateEvent(FederatedWheelEvent);
|
|
7719
|
-
return this.copyWheelData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(event.global.x, event.global.y, event), event;
|
|
7776
|
+
return this.copyWheelData(from, event), this.copyMouseData(from, event), this.copyData(from, event), event.nativeEvent = from.nativeEvent, event.originalEvent = from, event.target = target || this.pickTarget(null !== (_a = event.viewX) && void 0 !== _a ? _a : event.global.x, null !== (_b = event.viewY) && void 0 !== _b ? _b : event.global.y, event), event;
|
|
7720
7777
|
}
|
|
7721
7778
|
}, {
|
|
7722
7779
|
key: "clonePointerEvent",
|
|
@@ -7846,7 +7903,7 @@
|
|
|
7846
7903
|
_this.setCursor(_this.manager.cursor, _this.manager.cursorTarget);
|
|
7847
7904
|
}, this.onPointerUp = function (nativeEvent) {
|
|
7848
7905
|
if (_this.supportsTouchEvents && "touch" === nativeEvent.pointerType) return;
|
|
7849
|
-
var outside = _this.
|
|
7906
|
+
var outside = _this.isEventOutsideOfTargetViewPort(nativeEvent) ? "outside" : "",
|
|
7850
7907
|
normalizedEvents = _this.normalizeToPointerData(nativeEvent);
|
|
7851
7908
|
for (var i = 0, j = normalizedEvents.length; i < j; i++) {
|
|
7852
7909
|
var event = _this.bootstrapEvent(_this.rootPointerEvent, normalizedEvents[i]);
|
|
@@ -7869,7 +7926,6 @@
|
|
|
7869
7926
|
resolution = params.resolution,
|
|
7870
7927
|
rootNode = params.rootNode,
|
|
7871
7928
|
global = params.global,
|
|
7872
|
-
viewport = params.viewport,
|
|
7873
7929
|
_params$autoPreventDe = params.autoPreventDefault,
|
|
7874
7930
|
autoPreventDefault = _params$autoPreventDe === void 0 ? !1 : _params$autoPreventDe,
|
|
7875
7931
|
clickInterval = params.clickInterval,
|
|
@@ -7879,7 +7935,7 @@
|
|
|
7879
7935
|
supportsPointerEvents = _params$supportsPoint === void 0 ? global.supportsPointerEvents : _params$supportsPoint;
|
|
7880
7936
|
this.manager = new EventManager(rootNode, {
|
|
7881
7937
|
clickInterval: clickInterval
|
|
7882
|
-
}), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.
|
|
7938
|
+
}), this.globalObj = global, this.supportsPointerEvents = supportsPointerEvents, this.supportsTouchEvents = supportsTouchEvents, this.supportsMouseEvents = global.supportsMouseEvents, this.applyStyles = global.applyStyles, this.autoPreventDefault = autoPreventDefault, this.eventsAdded = !1, this.rootPointerEvent = new FederatedPointerEvent(), this.rootWheelEvent = new FederatedWheelEvent(), this.cursorStyles = {
|
|
7883
7939
|
"default": "inherit",
|
|
7884
7940
|
pointer: "pointer"
|
|
7885
7941
|
}, this.resolution = resolution, this.setTargetElement(targetElement);
|
|
@@ -7927,13 +7983,7 @@
|
|
|
7927
7983
|
}, {
|
|
7928
7984
|
key: "mapToViewportPoint",
|
|
7929
7985
|
value: function mapToViewportPoint(event) {
|
|
7930
|
-
|
|
7931
|
-
x = event.x,
|
|
7932
|
-
y = event.y;
|
|
7933
|
-
return {
|
|
7934
|
-
x: x - viewport.x,
|
|
7935
|
-
y: y - viewport.y
|
|
7936
|
-
};
|
|
7986
|
+
return this.domElement.pointTransform ? this.domElement.pointTransform(event.x, event.y) : event;
|
|
7937
7987
|
}
|
|
7938
7988
|
}, {
|
|
7939
7989
|
key: "mapToCanvasPoint",
|
|
@@ -7994,6 +8044,19 @@
|
|
|
7994
8044
|
value: function transferMouseData(event, nativeEvent) {
|
|
7995
8045
|
event.isTrusted = nativeEvent.isTrusted, event.srcElement = nativeEvent.srcElement, event.timeStamp = clock.now(), event.type = nativeEvent.type, event.altKey = nativeEvent.altKey, event.button = nativeEvent.button, event.buttons = nativeEvent.buttons, event.client.x = nativeEvent.clientX, event.client.y = nativeEvent.clientY, event.ctrlKey = nativeEvent.ctrlKey, event.shiftKey = nativeEvent.shiftKey, event.metaKey = nativeEvent.metaKey, event.movement.x = nativeEvent.movementX, event.movement.y = nativeEvent.movementY, event.page.x = nativeEvent.pageX, event.page.y = nativeEvent.pageY, event.relatedTarget = null;
|
|
7996
8046
|
}
|
|
8047
|
+
}, {
|
|
8048
|
+
key: "isEventOutsideOfTargetViewPort",
|
|
8049
|
+
value: function isEventOutsideOfTargetViewPort(nativeEvent) {
|
|
8050
|
+
if (this.isEventOutsideOfTargetElement(nativeEvent)) return !0;
|
|
8051
|
+
if (this.domElement.getViewBox) {
|
|
8052
|
+
var p = this.mapToViewportPoint(this.mapToCanvasPoint(nativeEvent)),
|
|
8053
|
+
b = this.domElement.getViewBox(),
|
|
8054
|
+
w = b.width(),
|
|
8055
|
+
h = b.height();
|
|
8056
|
+
return !(p.x < w && p.y < h && p.x > 0 && p.y > 0);
|
|
8057
|
+
}
|
|
8058
|
+
return !1;
|
|
8059
|
+
}
|
|
7997
8060
|
}, {
|
|
7998
8061
|
key: "isEventOutsideOfTargetElement",
|
|
7999
8062
|
value: function isEventOutsideOfTargetElement(nativeEvent) {
|
|
@@ -13083,15 +13146,12 @@
|
|
|
13083
13146
|
value: function render(params, userParams) {
|
|
13084
13147
|
var _this4 = this;
|
|
13085
13148
|
var _a;
|
|
13086
|
-
var stage = this.stage;
|
|
13087
13149
|
this.layerHandler.render([this], {
|
|
13088
13150
|
renderService: params.renderService,
|
|
13089
|
-
x: stage.x,
|
|
13090
|
-
y: stage.y,
|
|
13091
|
-
width: this.viewWidth,
|
|
13092
|
-
height: this.viewHeight,
|
|
13093
13151
|
stage: this.stage,
|
|
13094
13152
|
layer: this,
|
|
13153
|
+
viewBox: params.viewBox,
|
|
13154
|
+
transMatrix: params.transMatrix,
|
|
13095
13155
|
background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
|
|
13096
13156
|
updateBounds: params.updateBounds
|
|
13097
13157
|
}, userParams), this.afterDrawCbs.forEach(function (c) {
|
|
@@ -13131,48 +13191,28 @@
|
|
|
13131
13191
|
}, {
|
|
13132
13192
|
key: "prepare",
|
|
13133
13193
|
value: function prepare(dirtyBounds, params) {}
|
|
13134
|
-
}, {
|
|
13135
|
-
key: "combineTo",
|
|
13136
|
-
value: function combineTo(target, params) {
|
|
13137
|
-
var _this5 = this;
|
|
13138
|
-
var _a, _b, _c;
|
|
13139
|
-
this.offscreen && (this.layerHandler.drawTo(target, [this], Object.assign({
|
|
13140
|
-
background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
|
|
13141
|
-
renderService: params.renderService,
|
|
13142
|
-
x: null !== (_b = params.x) && void 0 !== _b ? _b : this.stage.x,
|
|
13143
|
-
y: null !== (_c = params.y) && void 0 !== _c ? _c : this.stage.y,
|
|
13144
|
-
width: this.viewWidth,
|
|
13145
|
-
height: this.viewHeight,
|
|
13146
|
-
stage: this.stage,
|
|
13147
|
-
layer: this
|
|
13148
|
-
}, params)), this.afterDrawCbs.forEach(function (c) {
|
|
13149
|
-
return c(_this5);
|
|
13150
|
-
}));
|
|
13151
|
-
}
|
|
13152
13194
|
}, {
|
|
13153
13195
|
key: "release",
|
|
13154
13196
|
value: function release() {
|
|
13155
|
-
var
|
|
13197
|
+
var _this5 = this;
|
|
13156
13198
|
_get(_getPrototypeOf(Layer.prototype), "release", this).call(this), this.layerHandler.release(), this.subLayers && this.subLayers.forEach(function (l) {
|
|
13157
|
-
application.layerService.releaseLayer(
|
|
13199
|
+
application.layerService.releaseLayer(_this5.stage, l.layer);
|
|
13158
13200
|
});
|
|
13159
13201
|
}
|
|
13160
13202
|
}, {
|
|
13161
13203
|
key: "drawTo",
|
|
13162
13204
|
value: function drawTo(target, params) {
|
|
13163
|
-
var
|
|
13164
|
-
var _a
|
|
13205
|
+
var _this6 = this;
|
|
13206
|
+
var _a;
|
|
13165
13207
|
this.layerHandler.drawTo(target, [this], Object.assign({
|
|
13166
13208
|
background: null !== (_a = params.background) && void 0 !== _a ? _a : this.background,
|
|
13167
13209
|
renderService: params.renderService,
|
|
13168
|
-
|
|
13169
|
-
|
|
13170
|
-
width: this.viewWidth,
|
|
13171
|
-
height: this.viewHeight,
|
|
13210
|
+
viewBox: params.viewBox,
|
|
13211
|
+
transMatrix: params.transMatrix,
|
|
13172
13212
|
stage: this.stage,
|
|
13173
13213
|
layer: this
|
|
13174
13214
|
}, params)), this.afterDrawCbs.forEach(function (c) {
|
|
13175
|
-
return c(
|
|
13215
|
+
return c(_this6);
|
|
13176
13216
|
});
|
|
13177
13217
|
}
|
|
13178
13218
|
}]);
|
|
@@ -22126,10 +22166,10 @@
|
|
|
22126
22166
|
value: function render(group, params) {
|
|
22127
22167
|
var _a;
|
|
22128
22168
|
params.renderService.render(group, Object.assign(Object.assign({
|
|
22129
|
-
context: this.context
|
|
22169
|
+
context: this.context,
|
|
22170
|
+
viewBox: params.stage.window.getViewBox(),
|
|
22171
|
+
transMatrix: params.stage.window.getViewBoxTransform()
|
|
22130
22172
|
}, params), {
|
|
22131
|
-
x: 0,
|
|
22132
|
-
y: 0,
|
|
22133
22173
|
clear: null !== (_a = params.background) && void 0 !== _a ? _a : "#ffffff"
|
|
22134
22174
|
}));
|
|
22135
22175
|
}
|
|
@@ -22151,14 +22191,11 @@
|
|
|
22151
22191
|
value: function drawTo(target, group, params) {
|
|
22152
22192
|
var context = target.getContext(),
|
|
22153
22193
|
targetDpr = target.dpr,
|
|
22154
|
-
|
|
22155
|
-
x =
|
|
22156
|
-
|
|
22157
|
-
|
|
22158
|
-
|
|
22159
|
-
width = _params$width === void 0 ? this.layer.viewWidth : _params$width,
|
|
22160
|
-
_params$height = params.height,
|
|
22161
|
-
height = _params$height === void 0 ? this.layer.viewHeight : _params$height;
|
|
22194
|
+
viewBox = params.viewBox,
|
|
22195
|
+
x = viewBox.x1,
|
|
22196
|
+
y = viewBox.y1,
|
|
22197
|
+
width = viewBox.width(),
|
|
22198
|
+
height = viewBox.height();
|
|
22162
22199
|
context.nativeContext.save(), context.nativeContext.setTransform(targetDpr, 0, 0, targetDpr, 0, 0), params.clear && context.clearRect(x, y, width, height), context.drawImage(this.canvas.nativeCanvas, 0, 0, this.canvas.width, this.canvas.height, x, y, width, height), context.nativeContext.restore();
|
|
22163
22200
|
}
|
|
22164
22201
|
}, {
|
|
@@ -22339,33 +22376,21 @@
|
|
|
22339
22376
|
this.prepareForDraw(renderService, drawContext), drawContext.drawContribution = this, this.currentRenderMap = this.styleRenderMap.get(drawContext.renderStyle) || this.defaultRenderMap, this.currentRenderService = renderService;
|
|
22340
22377
|
var context = drawContext.context,
|
|
22341
22378
|
stage = drawContext.stage,
|
|
22342
|
-
|
|
22343
|
-
|
|
22344
|
-
_drawContext$y = drawContext.y,
|
|
22345
|
-
y = _drawContext$y === void 0 ? 0 : _drawContext$y,
|
|
22346
|
-
width = drawContext.width,
|
|
22347
|
-
height = drawContext.height;
|
|
22379
|
+
viewBox = drawContext.viewBox,
|
|
22380
|
+
transMatrix = drawContext.transMatrix;
|
|
22348
22381
|
if (!context) return;
|
|
22349
|
-
|
|
22350
|
-
if (context.nativeContext && context.nativeContext.getTransform) {
|
|
22351
|
-
var t = context.nativeContext.getTransform();
|
|
22352
|
-
context.setTransformFromMatrix(t, !0, 1);
|
|
22353
|
-
}
|
|
22354
|
-
} else context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
|
|
22355
|
-
var dirtyBounds = this.dirtyBounds.setValue(0, 0, width, height);
|
|
22382
|
+
var dirtyBounds = this.dirtyBounds.setValue(0, 0, viewBox.width(), viewBox.height());
|
|
22356
22383
|
if (stage.dirtyBounds && !stage.dirtyBounds.empty()) {
|
|
22357
22384
|
var b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
|
|
22358
22385
|
dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
|
|
22359
22386
|
}
|
|
22360
22387
|
var d = context.dpr % 1;
|
|
22361
|
-
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds)
|
|
22362
|
-
var drawInArea = dirtyBounds.width() * context.dpr < context.canvas.width || dirtyBounds.height() * context.dpr < context.canvas.height;
|
|
22363
|
-
context.save(), context.translate(x, y, !0), drawInArea && (context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip()), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
|
|
22388
|
+
(d || .5 !== d) && (dirtyBounds.x1 = Math.floor(dirtyBounds.x1 * context.dpr) / context.dpr, dirtyBounds.y1 = Math.floor(dirtyBounds.y1 * context.dpr) / context.dpr, dirtyBounds.x2 = Math.ceil(dirtyBounds.x2 * context.dpr) / context.dpr, dirtyBounds.y2 = Math.ceil(dirtyBounds.y2 * context.dpr) / context.dpr), this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.setClearMatrix(transMatrix.a, transMatrix.b, transMatrix.c, transMatrix.d, transMatrix.e, transMatrix.f), context.clearMatrix(), context.setTransformForCurrent(!0), context.translate(viewBox.x1, viewBox.y1, !0), context.beginPath(), context.rect(dirtyBounds.x1, dirtyBounds.y1, dirtyBounds.width(), dirtyBounds.height()), context.clip(), stage.camera && (this.dirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0), this.backupDirtyBounds.setValue(-1 / 0, -1 / 0, 1 / 0, 1 / 0)), this.clearScreen(renderService, context, drawContext), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
|
|
22364
22389
|
var _a, _b;
|
|
22365
22390
|
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
22366
22391
|
}).forEach(function (group) {
|
|
22367
22392
|
group.isContainer ? _this2.renderGroup(group, drawContext, matrixAllocate.allocate(1, 0, 0, 1, 0, 0)) : _this2.renderItem(group, drawContext);
|
|
22368
|
-
}), context.restore(), context.
|
|
22393
|
+
}), context.restore(), context.draw(), context.setClearMatrix(1, 0, 0, 1, 0, 0), context.inuse = !1;
|
|
22369
22394
|
}
|
|
22370
22395
|
}, {
|
|
22371
22396
|
key: "doRegister",
|
|
@@ -22504,28 +22529,24 @@
|
|
|
22504
22529
|
key: "clearScreen",
|
|
22505
22530
|
value: function clearScreen(renderService, context, drawContext) {
|
|
22506
22531
|
var _a, _b;
|
|
22507
|
-
var clear = drawContext.clear
|
|
22532
|
+
var clear = drawContext.clear,
|
|
22533
|
+
viewBox = drawContext.viewBox,
|
|
22534
|
+
width = viewBox.width(),
|
|
22535
|
+
height = viewBox.height();
|
|
22508
22536
|
if (clear) {
|
|
22509
|
-
|
|
22510
|
-
_drawContext$width = drawContext.width,
|
|
22511
|
-
width = _drawContext$width === void 0 ? canvas.width : _drawContext$width,
|
|
22512
|
-
_drawContext$height = drawContext.height,
|
|
22513
|
-
height = _drawContext$height === void 0 ? canvas.height : _drawContext$height,
|
|
22514
|
-
x = 0,
|
|
22515
|
-
y = 0;
|
|
22516
|
-
context.clearRect(x, y, width, height);
|
|
22537
|
+
context.clearRect(0, 0, width, height);
|
|
22517
22538
|
var stage = null === (_a = renderService.drawParams) || void 0 === _a ? void 0 : _a.stage;
|
|
22518
22539
|
if (stage && (context.globalAlpha = null !== (_b = stage.attribute.opacity) && void 0 !== _b ? _b : 1), stage && stage.backgroundImg && stage.resources) {
|
|
22519
22540
|
var res = stage.resources.get(clear);
|
|
22520
|
-
res && "success" === res.state && res.data && context.drawImage(res.data,
|
|
22541
|
+
res && "success" === res.state && res.data && context.drawImage(res.data, 0, 0, width, height);
|
|
22521
22542
|
} else context.fillStyle = createColor(context, clear, {
|
|
22522
22543
|
AABBBounds: {
|
|
22523
|
-
x1:
|
|
22524
|
-
y1:
|
|
22525
|
-
x2:
|
|
22526
|
-
y2:
|
|
22544
|
+
x1: 0,
|
|
22545
|
+
y1: 0,
|
|
22546
|
+
x2: 0 + width,
|
|
22547
|
+
y2: 0 + height
|
|
22527
22548
|
}
|
|
22528
|
-
}, 0, 0), context.fillRect(
|
|
22549
|
+
}, 0, 0), context.fillRect(0, 0, width, height);
|
|
22529
22550
|
}
|
|
22530
22551
|
}
|
|
22531
22552
|
}, {
|
|
@@ -22833,7 +22854,7 @@
|
|
|
22833
22854
|
value: function draw(renderService, drawContext) {
|
|
22834
22855
|
return __awaiter$1(this, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
22835
22856
|
var _this2 = this;
|
|
22836
|
-
var skipDraw, context,
|
|
22857
|
+
var skipDraw, context, viewBox;
|
|
22837
22858
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
22838
22859
|
while (1) switch (_context.prev = _context.next) {
|
|
22839
22860
|
case 0:
|
|
@@ -22855,23 +22876,15 @@
|
|
|
22855
22876
|
return _context.abrupt("return");
|
|
22856
22877
|
case 8:
|
|
22857
22878
|
this.currentRenderService = renderService;
|
|
22858
|
-
context = drawContext.context,
|
|
22859
|
-
|
|
22860
|
-
|
|
22861
|
-
|
|
22862
|
-
|
|
22863
|
-
|
|
22864
|
-
|
|
22865
|
-
|
|
22866
|
-
|
|
22867
|
-
var _a, _b;
|
|
22868
|
-
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
22869
|
-
}).forEach(function (group) {
|
|
22870
|
-
_this2.renderGroup(group, drawContext);
|
|
22871
|
-
}), this.hooks.completeDraw.tap("top-draw", function () {
|
|
22872
|
-
context.restore(), context.restore(), context.draw(), drawContext.keepMatrix || (context.inuse = !1), _this2.rendering = !1;
|
|
22873
|
-
});
|
|
22874
|
-
}
|
|
22879
|
+
context = drawContext.context, viewBox = drawContext.viewBox;
|
|
22880
|
+
context && (context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0), context.save(), drawContext.restartIncremental && this.clearScreen(this.currentRenderService, context, drawContext), context.translate(viewBox.x1, viewBox.y1, !0), context.save(), renderService.renderTreeRoots.sort(function (a, b) {
|
|
22881
|
+
var _a, _b;
|
|
22882
|
+
return (null !== (_a = a.attribute.zIndex) && void 0 !== _a ? _a : DefaultAttribute.zIndex) - (null !== (_b = b.attribute.zIndex) && void 0 !== _b ? _b : DefaultAttribute.zIndex);
|
|
22883
|
+
}).forEach(function (group) {
|
|
22884
|
+
_this2.renderGroup(group, drawContext);
|
|
22885
|
+
}), this.hooks.completeDraw.tap("top-draw", function () {
|
|
22886
|
+
context.restore(), context.restore(), context.draw(), context.inuse = !1, _this2.rendering = !1;
|
|
22887
|
+
}));
|
|
22875
22888
|
case 11:
|
|
22876
22889
|
case "end":
|
|
22877
22890
|
return _context.stop();
|
|
@@ -23277,12 +23290,10 @@
|
|
|
23277
23290
|
if (!layer || !group.layer.subLayers) return;
|
|
23278
23291
|
var subLayer = group.layer.subLayers.get(group._uid);
|
|
23279
23292
|
subLayer && subLayer.drawContribution && subLayer.drawContribution.draw(stage.renderService, Object.assign({
|
|
23280
|
-
x: stage.x,
|
|
23281
|
-
y: stage.y,
|
|
23282
|
-
width: layer.viewWidth,
|
|
23283
|
-
height: layer.viewHeight,
|
|
23284
23293
|
stage: stage,
|
|
23285
23294
|
layer: layer,
|
|
23295
|
+
viewBox: stage.window.getViewBox(),
|
|
23296
|
+
transMatrix: stage.window.getViewBoxTransform(),
|
|
23286
23297
|
clear: "transparent",
|
|
23287
23298
|
renderService: stage.renderService,
|
|
23288
23299
|
updateBounds: !1,
|
|
@@ -23934,7 +23945,13 @@
|
|
|
23934
23945
|
_classCallCheck(this, Stage);
|
|
23935
23946
|
var _a;
|
|
23936
23947
|
_this = _super.call(this, {}), _this._onVisibleChange = function (visible) {
|
|
23937
|
-
|
|
23948
|
+
if (!(_this._skipRender < 0)) if (visible) {
|
|
23949
|
+
if (_this.dirtyBounds) {
|
|
23950
|
+
var b = _this.window.getViewBox();
|
|
23951
|
+
_this.dirtyBounds.setValue(b.x1, b.y1, b.width(), b.height());
|
|
23952
|
+
}
|
|
23953
|
+
_this._skipRender > 1 && _this.renderNextFrame(), _this._skipRender = 0;
|
|
23954
|
+
} else _this._skipRender = 1;
|
|
23938
23955
|
}, _this.beforeRender = function (stage) {
|
|
23939
23956
|
_this._beforeRender && _this._beforeRender(stage);
|
|
23940
23957
|
}, _this.afterRender = function (stage) {
|
|
@@ -23947,12 +23964,13 @@
|
|
|
23947
23964
|
}, _this.global = application.global, !_this.global.env && isBrowserEnv() && _this.global.setEnv("browser"), _this.window = container.get(VWindow), _this.renderService = container.get(RenderService), _this.pluginService = container.get(PluginService), _this.layerService = container.get(LayerService), _this.pluginService.active(_assertThisInitialized(_this), params), _this.window.create({
|
|
23948
23965
|
width: params.width,
|
|
23949
23966
|
height: params.height,
|
|
23967
|
+
viewBox: params.viewBox,
|
|
23950
23968
|
container: params.container,
|
|
23951
23969
|
dpr: params.dpr || _this.global.devicePixelRatio,
|
|
23952
23970
|
canvasControled: !1 !== params.canvasControled,
|
|
23953
23971
|
title: params.title || "",
|
|
23954
23972
|
canvas: params.canvas
|
|
23955
|
-
}), _this.
|
|
23973
|
+
}), _this.state = "normal", _this.renderCount = 0, _this.tryInitEventSystem(), _this._background = null !== (_a = params.background) && void 0 !== _a ? _a : DefaultConfig$1.BACKGROUND, _this.appendChild(_this.layerService.createLayer(_assertThisInitialized(_this), {
|
|
23956
23974
|
main: !0
|
|
23957
23975
|
})), _this.nextFrameRenderLayerSet = new Set(), _this.willNextFrameRender = !1, _this.stage = _assertThisInitialized(_this), _this.renderStyle = params.renderStyle, params.autoRender && _this.enableAutoRender(), !1 === params.disableDirtyBounds && _this.enableDirtyBounds(), params.enableHtmlAttribute && _this.enableHtmlAttribute(params.enableHtmlAttribute), params.enableLayout && _this.enableLayout(), _this.hooks.beforeRender.tap("constructor", _this.beforeRender), _this.hooks.afterRender.tap("constructor", _this.afterRender), _this._beforeRender = params.beforeRender, _this._afterRender = params.afterRender, _this.ticker = params.ticker || defaultTicker, _this.supportInteractiveLayer = !1 !== params.interactiveLayer, _this.timeline = new DefaultTimeline(), _this.ticker.addTimeline(_this.timeline), _this.timeline.pause(), params.optimize || (params.optimize = {}), _this.optmize(params.optimize), params.background && isString$1(_this._background) && _this._background.includes("/") && _this.setAttributes({
|
|
23958
23976
|
background: _this._background
|
|
@@ -23962,26 +23980,28 @@
|
|
|
23962
23980
|
_createClass(Stage, [{
|
|
23963
23981
|
key: "viewBox",
|
|
23964
23982
|
get: function get() {
|
|
23965
|
-
return this.
|
|
23983
|
+
return this.window.getViewBox();
|
|
23966
23984
|
},
|
|
23967
23985
|
set: function set(b) {
|
|
23968
|
-
this.
|
|
23986
|
+
this.window.setViewBox(b);
|
|
23969
23987
|
}
|
|
23970
23988
|
}, {
|
|
23971
23989
|
key: "x",
|
|
23972
23990
|
get: function get() {
|
|
23973
|
-
return this.
|
|
23991
|
+
return this.window.getViewBox().x1;
|
|
23974
23992
|
},
|
|
23975
23993
|
set: function set(x) {
|
|
23976
|
-
|
|
23994
|
+
var b = this.window.getViewBox();
|
|
23995
|
+
b.translate(x - b.x1, 0), this.window.setViewBox(b);
|
|
23977
23996
|
}
|
|
23978
23997
|
}, {
|
|
23979
23998
|
key: "y",
|
|
23980
23999
|
get: function get() {
|
|
23981
|
-
return this.
|
|
24000
|
+
return this.window.getViewBox().y1;
|
|
23982
24001
|
},
|
|
23983
24002
|
set: function set(y) {
|
|
23984
|
-
|
|
24003
|
+
var b = this.window.getViewBox();
|
|
24004
|
+
b.translate(0, y - b.y1), this.window.setViewBox(b);
|
|
23985
24005
|
}
|
|
23986
24006
|
}, {
|
|
23987
24007
|
key: "width",
|
|
@@ -23994,7 +24014,7 @@
|
|
|
23994
24014
|
}, {
|
|
23995
24015
|
key: "viewWidth",
|
|
23996
24016
|
get: function get() {
|
|
23997
|
-
return this.
|
|
24017
|
+
return this.window.getViewBox().width();
|
|
23998
24018
|
},
|
|
23999
24019
|
set: function set(w) {
|
|
24000
24020
|
this.resizeView(w, this.viewHeight);
|
|
@@ -24002,7 +24022,7 @@
|
|
|
24002
24022
|
}, {
|
|
24003
24023
|
key: "viewHeight",
|
|
24004
24024
|
get: function get() {
|
|
24005
|
-
return this.
|
|
24025
|
+
return this.window.getViewBox().height();
|
|
24006
24026
|
},
|
|
24007
24027
|
set: function set(h) {
|
|
24008
24028
|
this.resizeView(this.viewWidth, h);
|
|
@@ -24042,6 +24062,16 @@
|
|
|
24042
24062
|
get: function get() {
|
|
24043
24063
|
return this._eventSystem;
|
|
24044
24064
|
}
|
|
24065
|
+
}, {
|
|
24066
|
+
key: "pauseRender",
|
|
24067
|
+
value: function pauseRender() {
|
|
24068
|
+
this._skipRender = -1;
|
|
24069
|
+
}
|
|
24070
|
+
}, {
|
|
24071
|
+
key: "resumeRender",
|
|
24072
|
+
value: function resumeRender() {
|
|
24073
|
+
this._skipRender = 0;
|
|
24074
|
+
}
|
|
24045
24075
|
}, {
|
|
24046
24076
|
key: "tryInitEventSystem",
|
|
24047
24077
|
value: function tryInitEventSystem() {
|
|
@@ -24051,22 +24081,7 @@
|
|
|
24051
24081
|
rootNode: this,
|
|
24052
24082
|
global: this.global,
|
|
24053
24083
|
supportsPointerEvents: this.params.supportsPointerEvents,
|
|
24054
|
-
supportsTouchEvents: this.params.supportsTouchEvents
|
|
24055
|
-
viewport: {
|
|
24056
|
-
viewBox: this._viewBox,
|
|
24057
|
-
get x() {
|
|
24058
|
-
return this.viewBox.x1;
|
|
24059
|
-
},
|
|
24060
|
-
get y() {
|
|
24061
|
-
return this.viewBox.y1;
|
|
24062
|
-
},
|
|
24063
|
-
get width() {
|
|
24064
|
-
return this.viewBox.width();
|
|
24065
|
-
},
|
|
24066
|
-
get height() {
|
|
24067
|
-
return this.viewBox.height();
|
|
24068
|
-
}
|
|
24069
|
-
}
|
|
24084
|
+
supportsTouchEvents: this.params.supportsTouchEvents
|
|
24070
24085
|
}, this.params.event)));
|
|
24071
24086
|
}
|
|
24072
24087
|
}, {
|
|
@@ -24266,7 +24281,7 @@
|
|
|
24266
24281
|
}, {
|
|
24267
24282
|
key: "tryUpdateAABBBounds",
|
|
24268
24283
|
value: function tryUpdateAABBBounds() {
|
|
24269
|
-
var viewBox = this.
|
|
24284
|
+
var viewBox = this.window.getViewBox();
|
|
24270
24285
|
return this._AABBBounds.setValue(viewBox.x1, viewBox.y1, viewBox.x2, viewBox.y2), this._AABBBounds;
|
|
24271
24286
|
}
|
|
24272
24287
|
}, {
|
|
@@ -24306,14 +24321,14 @@
|
|
|
24306
24321
|
}, {
|
|
24307
24322
|
key: "clearViewBox",
|
|
24308
24323
|
value: function clearViewBox(color) {
|
|
24309
|
-
this.window.clearViewBox(
|
|
24324
|
+
this.window.clearViewBox(color);
|
|
24310
24325
|
}
|
|
24311
24326
|
}, {
|
|
24312
24327
|
key: "render",
|
|
24313
24328
|
value: function render(layers, params) {
|
|
24314
24329
|
this.ticker.start(), this.timeline.resume();
|
|
24315
24330
|
var state = this.state;
|
|
24316
|
-
this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this.renderLayerList(this.children
|
|
24331
|
+
this.state = "rendering", this.layerService.prepareStageLayer(this), this._skipRender || (this.lastRenderparams = params, this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(this.children), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
24317
24332
|
}
|
|
24318
24333
|
}, {
|
|
24319
24334
|
key: "combineLayersToWindow",
|
|
@@ -24333,7 +24348,7 @@
|
|
|
24333
24348
|
value: function _doRenderInThisFrame() {
|
|
24334
24349
|
this.timeline.resume(), this.ticker.start();
|
|
24335
24350
|
var state = this.state;
|
|
24336
|
-
this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.
|
|
24351
|
+
this.state = "rendering", this.layerService.prepareStageLayer(this), this.nextFrameRenderLayerSet.size && !this._skipRender && (this.hooks.beforeRender.call(this), this._skipRender || (this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()), this.lastRenderparams || {}), this.combineLayersToWindow(), this.nextFrameRenderLayerSet.clear()), this.hooks.afterRender.call(this)), this.state = state, this._skipRender && this._skipRender++;
|
|
24337
24352
|
}
|
|
24338
24353
|
}, {
|
|
24339
24354
|
key: "renderLayerList",
|
|
@@ -24348,14 +24363,17 @@
|
|
|
24348
24363
|
layer.renderCount > _this10.renderCount || (layer.renderCount = _this10.renderCount + 1, layer.render({
|
|
24349
24364
|
renderService: _this10.renderService,
|
|
24350
24365
|
background: layer === _this10.defaultLayer ? _this10.background : void 0,
|
|
24351
|
-
updateBounds: !(!_this10.dirtyBounds || _this10.dirtyBounds.empty())
|
|
24366
|
+
updateBounds: !(!_this10.dirtyBounds || _this10.dirtyBounds.empty()),
|
|
24367
|
+
viewBox: _this10.window.getViewBox(),
|
|
24368
|
+
transMatrix: _this10.window.getViewBoxTransform()
|
|
24352
24369
|
}, Object.assign({
|
|
24353
|
-
renderStyle: _this10.renderStyle
|
|
24354
|
-
keepMatrix: _this10.params.renderKeepMatrix
|
|
24370
|
+
renderStyle: _this10.renderStyle
|
|
24355
24371
|
}, params)));
|
|
24356
24372
|
}), this.interactiveLayer && !layerList.includes(this.interactiveLayer) && this.interactiveLayer.render({
|
|
24357
24373
|
renderService: this.renderService,
|
|
24358
|
-
updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty())
|
|
24374
|
+
updateBounds: !(!this.dirtyBounds || this.dirtyBounds.empty()),
|
|
24375
|
+
viewBox: this.window.getViewBox(),
|
|
24376
|
+
transMatrix: this.window.getViewBoxTransform()
|
|
24359
24377
|
}, Object.assign({
|
|
24360
24378
|
renderStyle: this.renderStyle
|
|
24361
24379
|
}, params));
|
|
@@ -24370,9 +24388,9 @@
|
|
|
24370
24388
|
key: "resize",
|
|
24371
24389
|
value: function resize(w, h) {
|
|
24372
24390
|
var rerender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : !0;
|
|
24373
|
-
this.window.resize(w, h), this.forEachChildren(function (c) {
|
|
24391
|
+
this.window.hasSubView() || this.viewBox.setValue(this.viewBox.x1, this.viewBox.y1, this.viewBox.x1 + w, this.viewBox.y1 + h), this.window.resize(w, h), this.forEachChildren(function (c) {
|
|
24374
24392
|
c.resize(w, h);
|
|
24375
|
-
}), this.
|
|
24393
|
+
}), this.camera && this.option3d && this.set3dOptions(this.option3d), rerender && this.render();
|
|
24376
24394
|
}
|
|
24377
24395
|
}, {
|
|
24378
24396
|
key: "resizeView",
|
|
@@ -24455,50 +24473,44 @@
|
|
|
24455
24473
|
}
|
|
24456
24474
|
}, {
|
|
24457
24475
|
key: "renderTo",
|
|
24458
|
-
value: function renderTo(window
|
|
24476
|
+
value: function renderTo(window) {
|
|
24459
24477
|
var _this12 = this;
|
|
24460
24478
|
this.forEachChildren(function (layer, i) {
|
|
24461
|
-
layer.drawTo(window,
|
|
24479
|
+
layer.drawTo(window, {
|
|
24462
24480
|
renderService: _this12.renderService,
|
|
24481
|
+
viewBox: window.getViewBox(),
|
|
24482
|
+
transMatrix: window.getViewBoxTransform(),
|
|
24463
24483
|
background: layer === _this12.defaultLayer ? _this12.background : void 0,
|
|
24464
24484
|
clear: 0 === i,
|
|
24465
24485
|
updateBounds: !(!_this12.dirtyBounds || _this12.dirtyBounds.empty())
|
|
24466
|
-
})
|
|
24486
|
+
});
|
|
24467
24487
|
});
|
|
24468
24488
|
}
|
|
24469
24489
|
}, {
|
|
24470
24490
|
key: "renderToNewWindow",
|
|
24471
24491
|
value: function renderToNewWindow() {
|
|
24472
|
-
var fullImage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
24473
24492
|
var viewBox = arguments.length > 1 ? arguments[1] : undefined;
|
|
24474
|
-
var window = container.get(VWindow)
|
|
24475
|
-
|
|
24476
|
-
|
|
24477
|
-
|
|
24493
|
+
var window = container.get(VWindow),
|
|
24494
|
+
x1 = viewBox ? -viewBox.x1 : 0,
|
|
24495
|
+
y1 = viewBox ? -viewBox.y1 : 0,
|
|
24496
|
+
x2 = viewBox ? viewBox.x2 : this.viewWidth,
|
|
24497
|
+
y2 = viewBox ? viewBox.y2 : this.viewHeight,
|
|
24498
|
+
width = viewBox ? viewBox.width() : this.viewWidth,
|
|
24499
|
+
height = viewBox ? viewBox.height() : this.viewHeight;
|
|
24500
|
+
return window.create({
|
|
24501
|
+
viewBox: {
|
|
24502
|
+
x1: x1,
|
|
24503
|
+
y1: y1,
|
|
24504
|
+
x2: x2,
|
|
24505
|
+
y2: y2
|
|
24506
|
+
},
|
|
24507
|
+
width: width,
|
|
24508
|
+
height: height,
|
|
24478
24509
|
dpr: this.window.dpr,
|
|
24479
24510
|
canvasControled: !0,
|
|
24480
24511
|
offscreen: !0,
|
|
24481
24512
|
title: ""
|
|
24482
|
-
});
|
|
24483
|
-
var width = viewBox ? viewBox.width() : Math.min(this.viewWidth, this.window.width - this.x),
|
|
24484
|
-
height = viewBox ? viewBox.height() : Math.min(this.viewHeight, this.window.height - this.y);
|
|
24485
|
-
window.create({
|
|
24486
|
-
width: width,
|
|
24487
|
-
height: height,
|
|
24488
|
-
dpr: this.window.dpr,
|
|
24489
|
-
canvasControled: !0,
|
|
24490
|
-
offscreen: !0,
|
|
24491
|
-
title: ""
|
|
24492
|
-
});
|
|
24493
|
-
}
|
|
24494
|
-
var x = viewBox ? -viewBox.x1 : 0,
|
|
24495
|
-
y = viewBox ? -viewBox.y1 : 0;
|
|
24496
|
-
return this.renderTo(window, {
|
|
24497
|
-
x: x,
|
|
24498
|
-
y: y,
|
|
24499
|
-
width: viewBox ? viewBox.x2 : window.width,
|
|
24500
|
-
height: viewBox ? viewBox.y2 : window.height
|
|
24501
|
-
}), window;
|
|
24513
|
+
}), this.renderTo(window), window;
|
|
24502
24514
|
}
|
|
24503
24515
|
}, {
|
|
24504
24516
|
key: "toCanvas",
|
|
@@ -24538,7 +24550,7 @@
|
|
|
24538
24550
|
__metadata$S = undefined && undefined.__metadata || function (k, v) {
|
|
24539
24551
|
if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
24540
24552
|
};
|
|
24541
|
-
var initMatrix
|
|
24553
|
+
var initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
|
|
24542
24554
|
globalPoint = {
|
|
24543
24555
|
x: 0,
|
|
24544
24556
|
y: 0
|
|
@@ -24546,7 +24558,7 @@
|
|
|
24546
24558
|
exports.EmptyContext2d = /*#__PURE__*/function () {
|
|
24547
24559
|
function EmptyContext2d(canvas, dpr) {
|
|
24548
24560
|
_classCallCheck(this, EmptyContext2d);
|
|
24549
|
-
this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.path = new CustomPath2D();
|
|
24561
|
+
this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this.path = new CustomPath2D(), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
24550
24562
|
}
|
|
24551
24563
|
_createClass(EmptyContext2d, [{
|
|
24552
24564
|
key: "nativeContext",
|
|
@@ -24859,7 +24871,12 @@
|
|
|
24859
24871
|
value: function clearMatrix() {
|
|
24860
24872
|
var setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
24861
24873
|
var dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
|
|
24862
|
-
this.setTransformFromMatrix(initMatrix
|
|
24874
|
+
this.setTransformFromMatrix(initMatrix, setTransform, dpr);
|
|
24875
|
+
}
|
|
24876
|
+
}, {
|
|
24877
|
+
key: "setClearMatrix",
|
|
24878
|
+
value: function setClearMatrix(a, b, c, d, e, f) {
|
|
24879
|
+
this._clearMatrix.setValue(a, b, c, d, e, f);
|
|
24863
24880
|
}
|
|
24864
24881
|
}, {
|
|
24865
24882
|
key: "onlyTranslate",
|
|
@@ -25174,7 +25191,7 @@
|
|
|
25174
25191
|
exports.BaseWindowHandlerContribution = /*#__PURE__*/function () {
|
|
25175
25192
|
function BaseWindowHandlerContribution() {
|
|
25176
25193
|
_classCallCheck(this, BaseWindowHandlerContribution);
|
|
25177
|
-
this._uid = Generator.GenAutoIncrementId();
|
|
25194
|
+
this._uid = Generator.GenAutoIncrementId(), this.viewBox = new AABBBounds(), this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
25178
25195
|
}
|
|
25179
25196
|
_createClass(BaseWindowHandlerContribution, [{
|
|
25180
25197
|
key: "onChange",
|
|
@@ -25207,6 +25224,26 @@
|
|
|
25207
25224
|
left: 0
|
|
25208
25225
|
};
|
|
25209
25226
|
}
|
|
25227
|
+
}, {
|
|
25228
|
+
key: "setViewBox",
|
|
25229
|
+
value: function setViewBox(vb) {
|
|
25230
|
+
this.viewBox.setValue(vb.x1, vb.y1, vb.x2, vb.y2);
|
|
25231
|
+
}
|
|
25232
|
+
}, {
|
|
25233
|
+
key: "getViewBox",
|
|
25234
|
+
value: function getViewBox() {
|
|
25235
|
+
return this.viewBox;
|
|
25236
|
+
}
|
|
25237
|
+
}, {
|
|
25238
|
+
key: "setViewBoxTransform",
|
|
25239
|
+
value: function setViewBoxTransform(a, b, c, d, e, f) {
|
|
25240
|
+
this.modelMatrix.setValue(a, b, c, d, e, f);
|
|
25241
|
+
}
|
|
25242
|
+
}, {
|
|
25243
|
+
key: "getViewBoxTransform",
|
|
25244
|
+
value: function getViewBoxTransform() {
|
|
25245
|
+
return this.modelMatrix;
|
|
25246
|
+
}
|
|
25210
25247
|
}]);
|
|
25211
25248
|
return BaseWindowHandlerContribution;
|
|
25212
25249
|
}();
|
|
@@ -25247,23 +25284,14 @@
|
|
|
25247
25284
|
group: null
|
|
25248
25285
|
};
|
|
25249
25286
|
params.pickerService = this;
|
|
25250
|
-
var
|
|
25251
|
-
|
|
25252
|
-
if (
|
|
25253
|
-
|
|
25254
|
-
|
|
25255
|
-
}
|
|
25256
|
-
if (this.pickContext) if (params.keepMatrix) {
|
|
25257
|
-
if (this.pickContext.nativeContext && this.pickContext.nativeContext.getTransform) {
|
|
25258
|
-
var t = this.pickContext.nativeContext.getTransform();
|
|
25259
|
-
this.pickContext.setTransformFromMatrix(t, !0, 1);
|
|
25260
|
-
}
|
|
25261
|
-
} else this.pickContext.inuse = !0, this.pickContext.clearMatrix(!0, 1);
|
|
25262
|
-
params.pickContext = this.pickContext;
|
|
25263
|
-
var parentMatrix = new Matrix(1, 0, 0, 1, offsetX, offsetY);
|
|
25287
|
+
var w = params.bounds.width(),
|
|
25288
|
+
h = params.bounds.height();
|
|
25289
|
+
if (!new AABBBounds().setValue(0, 0, w, h).containsPoint(point)) return result;
|
|
25290
|
+
this.pickContext && (this.pickContext.inuse = !0), params.pickContext = this.pickContext, this.pickContext && this.pickContext.clearMatrix(!0, 1);
|
|
25291
|
+
var parentMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
25264
25292
|
var group;
|
|
25265
25293
|
for (var i = graphics.length - 1; i >= 0 && (result = graphics[i].isContainer ? this.pickGroup(graphics[i], point, parentMatrix, params) : this.pickItem(graphics[i], point, parentMatrix, params), !result.graphic); i--) group || (group = result.group);
|
|
25266
|
-
if (result.graphic || (result.group = group), this.pickContext &&
|
|
25294
|
+
if (result.graphic || (result.group = group), this.pickContext && (this.pickContext.inuse = !1), result.graphic) {
|
|
25267
25295
|
var g = result.graphic;
|
|
25268
25296
|
for (; g.parent;) g = g.parent;
|
|
25269
25297
|
g.shadowHost && (result.params = {
|
|
@@ -29589,7 +29617,6 @@
|
|
|
29589
29617
|
if ("object" == (typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
29590
29618
|
};
|
|
29591
29619
|
var outP = [0, 0, 0],
|
|
29592
|
-
initMatrix = new Matrix(1, 0, 0, 1, 0, 0),
|
|
29593
29620
|
addArcToBezierPath = function addArcToBezierPath(bezierPath, startAngle, endAngle, cx, cy, rx, ry, clockwise) {
|
|
29594
29621
|
if (clockwise) for (; endAngle > startAngle;) endAngle -= pi2;else for (; endAngle < startAngle;) endAngle += pi2;
|
|
29595
29622
|
var step = pi / 3 * (endAngle > startAngle ? 1 : -1);
|
|
@@ -29625,7 +29652,7 @@
|
|
|
29625
29652
|
}), this._clearShadowStyle = !1, this._clearFilterStyle = !1, this._clearGlobalCompositeOperationStyle = !1;
|
|
29626
29653
|
var context = canvas.nativeCanvas.getContext("2d");
|
|
29627
29654
|
if (!context) throw new Error("发生错误,获取2d上下文失败");
|
|
29628
|
-
this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
29655
|
+
this.nativeContext = context, this.canvas = canvas, this.matrix = new Matrix(1, 0, 0, 1, 0, 0), this.stack = [], this.dpr = dpr, this.applyedMatrix = new Matrix(1, 0, 0, 1, 0, 0), this._clearMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
29629
29656
|
}
|
|
29630
29657
|
_createClass(BrowserContext2d, [{
|
|
29631
29658
|
key: "fillStyle",
|
|
@@ -30261,7 +30288,12 @@
|
|
|
30261
30288
|
value: function clearMatrix() {
|
|
30262
30289
|
var setTransform = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;
|
|
30263
30290
|
var dpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.dpr;
|
|
30264
|
-
this.setTransformFromMatrix(
|
|
30291
|
+
this.setTransformFromMatrix(this._clearMatrix, setTransform, dpr);
|
|
30292
|
+
}
|
|
30293
|
+
}, {
|
|
30294
|
+
key: "setClearMatrix",
|
|
30295
|
+
value: function setClearMatrix(a, b, c, d, e, f) {
|
|
30296
|
+
this._clearMatrix.setValue(a, b, c, d, e, f);
|
|
30265
30297
|
}
|
|
30266
30298
|
}, {
|
|
30267
30299
|
key: "onlyTranslate",
|
|
@@ -30545,7 +30577,7 @@
|
|
|
30545
30577
|
function BrowserWindowHandlerContribution_1() {
|
|
30546
30578
|
var _this;
|
|
30547
30579
|
_classCallCheck(this, BrowserWindowHandlerContribution_1);
|
|
30548
|
-
_this = _super.call(this), _this.type = "browser", _this._canvasIsIntersecting = !0, _this.global = application.global;
|
|
30580
|
+
_this = _super.call(this), _this.type = "browser", _this._canvasIsIntersecting = !0, _this.global = application.global, _this.viewBox = new AABBBounds(), _this.modelMatrix = new Matrix(1, 0, 0, 1, 0, 0);
|
|
30549
30581
|
return _this;
|
|
30550
30582
|
}
|
|
30551
30583
|
_createClass(BrowserWindowHandlerContribution_1, [{
|
|
@@ -30556,7 +30588,7 @@
|
|
|
30556
30588
|
}, {
|
|
30557
30589
|
key: "getTitle",
|
|
30558
30590
|
value: function getTitle() {
|
|
30559
|
-
return this.canvas.id.toString();
|
|
30591
|
+
return this.canvas.id && this.canvas.id.toString();
|
|
30560
30592
|
}
|
|
30561
30593
|
}, {
|
|
30562
30594
|
key: "getWH",
|
|
@@ -30726,8 +30758,9 @@
|
|
|
30726
30758
|
}
|
|
30727
30759
|
}, {
|
|
30728
30760
|
key: "clearViewBox",
|
|
30729
|
-
value: function clearViewBox(
|
|
30730
|
-
var
|
|
30761
|
+
value: function clearViewBox(color) {
|
|
30762
|
+
var vb = this.viewBox,
|
|
30763
|
+
context = this.getContext(),
|
|
30731
30764
|
dpr = this.getDpr();
|
|
30732
30765
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
30733
30766
|
}
|
|
@@ -31331,8 +31364,9 @@
|
|
|
31331
31364
|
}
|
|
31332
31365
|
}, {
|
|
31333
31366
|
key: "clearViewBox",
|
|
31334
|
-
value: function clearViewBox(
|
|
31335
|
-
var
|
|
31367
|
+
value: function clearViewBox(color) {
|
|
31368
|
+
var vb = this.viewBox,
|
|
31369
|
+
context = this.getContext(),
|
|
31336
31370
|
dpr = this.getDpr();
|
|
31337
31371
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
31338
31372
|
}
|
|
@@ -31979,8 +32013,9 @@
|
|
|
31979
32013
|
}
|
|
31980
32014
|
}, {
|
|
31981
32015
|
key: "clearViewBox",
|
|
31982
|
-
value: function clearViewBox(
|
|
31983
|
-
var
|
|
32016
|
+
value: function clearViewBox(color) {
|
|
32017
|
+
var vb = this.viewBox,
|
|
32018
|
+
context = this.getContext(),
|
|
31984
32019
|
dpr = this.getDpr();
|
|
31985
32020
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
31986
32021
|
}
|
|
@@ -32380,7 +32415,7 @@
|
|
|
32380
32415
|
}
|
|
32381
32416
|
}, {
|
|
32382
32417
|
key: "clearViewBox",
|
|
32383
|
-
value: function clearViewBox(
|
|
32418
|
+
value: function clearViewBox(color) {}
|
|
32384
32419
|
}]);
|
|
32385
32420
|
return NodeWindowHandlerContribution;
|
|
32386
32421
|
}(exports.BaseWindowHandlerContribution);
|
|
@@ -32910,8 +32945,9 @@
|
|
|
32910
32945
|
}
|
|
32911
32946
|
}, {
|
|
32912
32947
|
key: "clearViewBox",
|
|
32913
|
-
value: function clearViewBox(
|
|
32914
|
-
var
|
|
32948
|
+
value: function clearViewBox(color) {
|
|
32949
|
+
var vb = this.viewBox,
|
|
32950
|
+
context = this.getContext(),
|
|
32915
32951
|
dpr = this.getDpr();
|
|
32916
32952
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
32917
32953
|
}
|
|
@@ -33342,8 +33378,9 @@
|
|
|
33342
33378
|
}
|
|
33343
33379
|
}, {
|
|
33344
33380
|
key: "clearViewBox",
|
|
33345
|
-
value: function clearViewBox(
|
|
33346
|
-
var
|
|
33381
|
+
value: function clearViewBox(color) {
|
|
33382
|
+
var vb = this.viewBox,
|
|
33383
|
+
context = this.getContext(),
|
|
33347
33384
|
dpr = this.getDpr();
|
|
33348
33385
|
context.nativeContext.save(), context.nativeContext.setTransform(dpr, 0, 0, dpr, 0, 0), context.clearRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1), color && (context.fillStyle = color, context.fillRect(vb.x1, vb.y1, vb.x2 - vb.x1, vb.y2 - vb.y1)), context.nativeContext.restore();
|
|
33349
33386
|
}
|
|
@@ -35184,7 +35221,7 @@
|
|
|
35184
35221
|
|
|
35185
35222
|
var roughModule = _roughModule;
|
|
35186
35223
|
|
|
35187
|
-
const version = "0.18.
|
|
35224
|
+
const version = "0.18.4";
|
|
35188
35225
|
preLoadAllModule();
|
|
35189
35226
|
if (isBrowserEnv()) {
|
|
35190
35227
|
loadBrowserEnv(container);
|