@visactor/vrender 0.16.17 → 0.16.18-alpha.0

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 CHANGED
@@ -1,3 +1,3 @@
1
- export declare const version = "0.16.17";
1
+ export declare const version = "0.16.18-alpha.0";
2
2
  export * from '@visactor/vrender-core';
3
3
  export * from '@visactor/vrender-kits';
package/cjs/index.js CHANGED
@@ -21,5 +21,5 @@ Object.defineProperty(exports, "__esModule", {
21
21
 
22
22
  const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits");
23
23
 
24
- exports.version = "0.16.17", (0, vrender_kits_1.loadAllModule)(vrender_core_1.container),
24
+ exports.version = "0.16.18-alpha.0", (0, vrender_kits_1.loadAllModule)(vrender_core_1.container),
25
25
  __exportStar(require("@visactor/vrender-core"), exports), __exportStar(require("@visactor/vrender-kits"), exports);
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.17\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yDAAmD;AACnD,yDAAuD;AAG1C,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,IAAA,4BAAa,EAAC,wBAAS,CAAC,CAAC;AAEzB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import { container } from '@visactor/vrender-core';\nimport { loadAllModule } from '@visactor/vrender-kits';\n\n// 导出版本号\nexport const version = \"0.16.18-alpha.0\";\n\nloadAllModule(container);\n\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/index.js CHANGED
@@ -6304,7 +6304,7 @@
6304
6304
  textureColor: "black",
6305
6305
  textureSize: 10,
6306
6306
  texturePadding: 2,
6307
- backgroundMode: 0,
6307
+ backgroundMode: "no-repeat",
6308
6308
  blur: 0,
6309
6309
  cursor: null,
6310
6310
  html: null
@@ -8030,7 +8030,19 @@
8030
8030
  var FederatedEvent = /*#__PURE__*/function () {
8031
8031
  function FederatedEvent(manager) {
8032
8032
  _classCallCheck(this, FederatedEvent);
8033
- this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = new Point(), this.page = new Point(), this.canvas = new Point(), this.viewport = new Point(), this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
8033
+ this.bubbles = !0, this.cancelBubble = !0, this.cancelable = !1, this.composed = !1, this.defaultPrevented = !1, this.eventPhase = FederatedEvent.prototype.NONE, this.propagationStopped = !1, this.propagationImmediatelyStopped = !1, this.layer = {
8034
+ x: 0,
8035
+ y: 0
8036
+ }, this.page = {
8037
+ x: 0,
8038
+ y: 0
8039
+ }, this.canvas = {
8040
+ x: 0,
8041
+ y: 0
8042
+ }, this.viewport = {
8043
+ x: 0,
8044
+ y: 0
8045
+ }, this.NONE = 0, this.CAPTURING_PHASE = 1, this.AT_TARGET = 2, this.BUBBLING_PHASE = 3, this.manager = manager;
8034
8046
  }
8035
8047
  _createClass(FederatedEvent, [{
8036
8048
  key: "layerX",
@@ -8123,7 +8135,22 @@
8123
8135
  function FederatedMouseEvent() {
8124
8136
  var _this;
8125
8137
  _classCallCheck(this, FederatedMouseEvent);
8126
- _this = _super.apply(this, arguments), _this.client = new Point(), _this.movement = new Point(), _this.offset = new Point(), _this.global = new Point(), _this.screen = new Point();
8138
+ _this = _super.apply(this, arguments), _this.client = {
8139
+ x: 0,
8140
+ y: 0
8141
+ }, _this.movement = {
8142
+ x: 0,
8143
+ y: 0
8144
+ }, _this.offset = {
8145
+ x: 0,
8146
+ y: 0
8147
+ }, _this.global = {
8148
+ x: 0,
8149
+ y: 0
8150
+ }, _this.screen = {
8151
+ x: 0,
8152
+ y: 0
8153
+ };
8127
8154
  return _this;
8128
8155
  }
8129
8156
  _createClass(FederatedMouseEvent, [{
@@ -8474,12 +8501,14 @@
8474
8501
  }, {
8475
8502
  key: "copyMouseData",
8476
8503
  value: function copyMouseData(from, to) {
8477
- from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent && (to.altKey = from.altKey, to.button = from.button, to.buttons = from.buttons, to.client.copyFrom(from.client), to.ctrlKey = from.ctrlKey, to.shiftKey = from.shiftKey, to.metaKey = from.metaKey, to.movement.copyFrom(from.movement), to.canvas.copyFrom(from.canvas), to.screen.copyFrom(from.screen), to.global.copyFrom(from.global), to.offset.copyFrom(from.offset), to.viewport.copyFrom(from.viewport));
8504
+ from instanceof FederatedMouseEvent && to instanceof FederatedMouseEvent && (to.altKey = from.altKey, to.button = from.button, to.buttons = from.buttons, to.ctrlKey = from.ctrlKey, to.shiftKey = from.shiftKey, to.metaKey = from.metaKey, ["client", "movement", "canvas", "screen", "global", "offset", "viewport"].forEach(function (key) {
8505
+ to[key].x = from[key].x, to[key].y = from[key].y;
8506
+ }));
8478
8507
  }
8479
8508
  }, {
8480
8509
  key: "copyData",
8481
8510
  value: function copyData(from, to) {
8482
- to.isTrusted = from.isTrusted, to.srcElement = from.srcElement, to.timeStamp = clock.now(), to.type = from.type, to.detail = from.detail, to.view = from.view, to.which = from.which, to.layer.copyFrom(from.layer), to.page.copyFrom(from.page), to.pickParams = from.pickParams;
8511
+ to.isTrusted = from.isTrusted, to.srcElement = from.srcElement, to.timeStamp = clock.now(), to.type = from.type, to.detail = from.detail, to.view = from.view, to.which = from.which, to.layer.x = from.layer.x, to.layer.y = from.layer.y, to.page.x = from.page.x, to.page.y = from.page.y, to.pickParams = from.pickParams;
8483
8512
  }
8484
8513
  }, {
8485
8514
  key: "trackingData",
@@ -8700,7 +8729,7 @@
8700
8729
  var _this$mapToCanvasPoin = this.mapToCanvasPoint(nativeEvent),
8701
8730
  canvasX = _this$mapToCanvasPoin.x,
8702
8731
  canvasY = _this$mapToCanvasPoin.y;
8703
- event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.copyFrom(event.canvas), event.offset.copyFrom(event.canvas);
8732
+ event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.x = canvasX, event.global.y = canvasY, event.offset.x = canvasX, event.offset.y = canvasY;
8704
8733
  var _this$mapToViewportPo = this.mapToViewportPoint(event),
8705
8734
  viewX = _this$mapToViewportPo.x,
8706
8735
  viewY = _this$mapToViewportPo.y;
@@ -8713,7 +8742,7 @@
8713
8742
  var _this$mapToCanvasPoin2 = this.mapToCanvasPoint(nativeEvent),
8714
8743
  canvasX = _this$mapToCanvasPoin2.x,
8715
8744
  canvasY = _this$mapToCanvasPoin2.y;
8716
- event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.copyFrom(event.canvas), event.offset.copyFrom(event.canvas);
8745
+ event.canvas.x = canvasX, event.canvas.y = canvasY, event.global.x = canvasX, event.global.y = canvasY, event.offset.x = canvasX, event.offset.y = canvasY;
8717
8746
  var _this$mapToViewportPo2 = this.mapToViewportPoint(event),
8718
8747
  viewX = _this$mapToViewportPo2.x,
8719
8748
  viewY = _this$mapToViewportPo2.y;
@@ -20963,7 +20992,10 @@
20963
20992
  _createClass(DefaultBaseBackgroundRenderContribution, [{
20964
20993
  key: "drawShape",
20965
20994
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
20966
- var background = graphic.attribute.background;
20995
+ var _graphic$attribute = graphic.attribute,
20996
+ background = _graphic$attribute.background,
20997
+ _graphic$attribute$ba = _graphic$attribute.backgroundMode,
20998
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
20967
20999
  if (background) if (graphic.backgroundImg && graphic.resources) {
20968
21000
  var res = graphic.resources.get(background);
20969
21001
  if ("success" !== res.state || !res.data) return;
@@ -20978,9 +21010,17 @@
20978
21010
  }
20979
21011
  context.clip();
20980
21012
  var b = graphic.AABBBounds;
20981
- context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.drawImage(res.data, b.x1, b.y1, b.width(), b.height()), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
21013
+ context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
20982
21014
  } else context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
20983
21015
  }
21016
+ }, {
21017
+ key: "doDrawImage",
21018
+ value: function doDrawImage(context, data, b, backgroundMode) {
21019
+ if ("no-repeat" === backgroundMode) context.drawImage(data, b.x1, b.y1, b.width(), b.height());else {
21020
+ var pattern = context.createPattern(data, backgroundMode);
21021
+ context.fillStyle = pattern, context.translate(b.x1, b.y1), context.fillRect(0, 0, b.width(), b.height()), context.translate(-b.x1, -b.y1);
21022
+ }
21023
+ }
20984
21024
  }]);
20985
21025
  return DefaultBaseBackgroundRenderContribution;
20986
21026
  }();
@@ -21101,15 +21141,15 @@
21101
21141
  key: "drawShape",
21102
21142
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
21103
21143
  this.textureMap || this.initTextureMap(context, graphic.stage);
21104
- var _graphic$attribute = graphic.attribute,
21105
- _graphic$attribute$te = _graphic$attribute.texture,
21106
- texture = _graphic$attribute$te === void 0 ? graphicAttribute.texture : _graphic$attribute$te,
21107
- _graphic$attribute$te2 = _graphic$attribute.textureColor,
21108
- textureColor = _graphic$attribute$te2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute$te2,
21109
- _graphic$attribute$te3 = _graphic$attribute.textureSize,
21110
- textureSize = _graphic$attribute$te3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute$te3,
21111
- _graphic$attribute$te4 = _graphic$attribute.texturePadding,
21112
- texturePadding = _graphic$attribute$te4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute$te4;
21144
+ var _graphic$attribute2 = graphic.attribute,
21145
+ _graphic$attribute2$t = _graphic$attribute2.texture,
21146
+ texture = _graphic$attribute2$t === void 0 ? graphicAttribute.texture : _graphic$attribute2$t,
21147
+ _graphic$attribute2$t2 = _graphic$attribute2.textureColor,
21148
+ textureColor = _graphic$attribute2$t2 === void 0 ? graphicAttribute.textureColor : _graphic$attribute2$t2,
21149
+ _graphic$attribute2$t3 = _graphic$attribute2.textureSize,
21150
+ textureSize = _graphic$attribute2$t3 === void 0 ? graphicAttribute.textureSize : _graphic$attribute2$t3,
21151
+ _graphic$attribute2$t4 = _graphic$attribute2.texturePadding,
21152
+ texturePadding = _graphic$attribute2$t4 === void 0 ? graphicAttribute.texturePadding : _graphic$attribute2$t4;
21113
21153
  if (!texture) return;
21114
21154
  var pattern = this.textureMap.get(texture);
21115
21155
  if (!pattern) switch (texture) {
@@ -21359,13 +21399,16 @@
21359
21399
  _createClass(DefaultGroupBackgroundRenderContribution, [{
21360
21400
  key: "drawShape",
21361
21401
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
21362
- var background = graphic.attribute.background;
21402
+ var _graphic$attribute = graphic.attribute,
21403
+ background = _graphic$attribute.background,
21404
+ _graphic$attribute$ba = _graphic$attribute.backgroundMode,
21405
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
21363
21406
  if (background) if (graphic.backgroundImg && graphic.resources) {
21364
21407
  var res = graphic.resources.get(background);
21365
21408
  if ("success" !== res.state || !res.data) return;
21366
21409
  context.highPerformanceSave(), context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0);
21367
21410
  var b = graphic.AABBBounds;
21368
- context.drawImage(res.data, b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore(), context.setTransformForCurrent();
21411
+ this.doDrawImage(context, res.data, b, backgroundMode), context.highPerformanceRestore(), context.setTransformForCurrent();
21369
21412
  } else context.highPerformanceSave(), context.fillStyle = background, context.fill(), context.highPerformanceRestore();
21370
21413
  }
21371
21414
  }]);
@@ -21393,9 +21436,9 @@
21393
21436
  key: "drawShape",
21394
21437
  value: function drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
21395
21438
  var _graphic$attribute = graphic.attribute,
21396
- background = _graphic$attribute.background;
21397
- _graphic$attribute.width;
21398
- _graphic$attribute.height;
21439
+ background = _graphic$attribute.background,
21440
+ _graphic$attribute$ba = _graphic$attribute.backgroundMode,
21441
+ backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba;
21399
21442
  if (background) if (graphic.backgroundImg) {
21400
21443
  var res = graphic.resources.get(background);
21401
21444
  if ("success" !== res.state || !res.data) return;
@@ -21409,7 +21452,7 @@
21409
21452
  context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.translate(scrollX, scrollY);
21410
21453
  }
21411
21454
  var b = graphic.AABBBounds;
21412
- context.drawImage(res.data, b.x1, b.y1, b.width(), b.height()), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
21455
+ this.doDrawImage(context, res.data, b, backgroundMode), context.restore(), graphic.transMatrix.onlyTranslate() || context.setTransformForCurrent();
21413
21456
  } else if (isObject$1(background)) {
21414
21457
  var stroke = background.stroke,
21415
21458
  fill = background.fill,
@@ -21426,9 +21469,9 @@
21426
21469
  var _getActualPosition = getActualPosition(graphic),
21427
21470
  _x = _getActualPosition.x,
21428
21471
  _y = _getActualPosition.y,
21429
- _width = _getActualPosition.width,
21430
- _height = _getActualPosition.height;
21431
- cornerRadius ? createRectPath(context, _x - expandX, _y - expandY, _width + 2 * expandX, _height + 2 * expandY, cornerRadius) : context.rect(_x - expandX, _y - expandY, _width + 2 * expandX, _height + 2 * expandY), context.globalAlpha = 1, fill && (context.fillStyle = fill, context.fill()), stroke && lineWidth > 0 && (context.lineWidth = lineWidth, context.strokeStyle = stroke, context.stroke());
21472
+ width = _getActualPosition.width,
21473
+ height = _getActualPosition.height;
21474
+ cornerRadius ? createRectPath(context, _x - expandX, _y - expandY, width + 2 * expandX, height + 2 * expandY, cornerRadius) : context.rect(_x - expandX, _y - expandY, width + 2 * expandX, height + 2 * expandY), context.globalAlpha = 1, fill && (context.fillStyle = fill, context.fill()), stroke && lineWidth > 0 && (context.lineWidth = lineWidth, context.strokeStyle = stroke, context.stroke());
21432
21475
  } else {
21433
21476
  context.beginPath();
21434
21477
  var _b = graphic.AABBBounds;
@@ -22759,7 +22802,8 @@
22759
22802
  var b = getRectIntersect(dirtyBounds, stage.dirtyBounds, !1);
22760
22803
  dirtyBounds.x1 = Math.floor(b.x1), dirtyBounds.y1 = Math.floor(b.y1), dirtyBounds.x2 = Math.ceil(b.x2), dirtyBounds.y2 = Math.ceil(b.y2);
22761
22804
  }
22762
- this.backupDirtyBounds.copy(dirtyBounds), context.inuse = !0, context.clearMatrix(), context.setTransformForCurrent(!0);
22805
+ var d = context.dpr % 1;
22806
+ (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.clearMatrix(), context.setTransformForCurrent(!0);
22763
22807
  var drawInArea = dirtyBounds.width() * context.dpr !== context.canvas.width || dirtyBounds.height() * context.dpr !== context.canvas.height;
22764
22808
  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) {
22765
22809
  var _a, _b;
@@ -29216,7 +29260,7 @@
29216
29260
  var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
29217
29261
  _classCallCheck(this, Gesture);
29218
29262
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
29219
- _this = _super.call(this), _this.cachedEvents = [], _this.startPoints = [], _this.processEvent = {}, _this.throttleTimer = 0, _this.emitThrottles = [], _this.onStart = function (ev) {
29263
+ _this = _super.call(this), _this.cachedEvents = [], _this.startPoints = [], _this.processEvent = {}, _this.throttleTimer = 0, _this.emitThrottles = [], _this.lastTapTarget = null, _this.onStart = function (ev) {
29220
29264
  _this.reset(), _this.startTime = clock.now();
29221
29265
  var _assertThisInitialize = _assertThisInitialized(_this),
29222
29266
  cachedEvents = _assertThisInitialize.cachedEvents,
@@ -29300,7 +29344,7 @@
29300
29344
  velocity > _this.config.swipe.velocity && distance > _this.config.swipe.threshold && (endEvent.velocity = velocity, endEvent.direction = calcDirection(prevMovePoint, lastMovePoint), _this.triggerEvent("swipe", endEvent));
29301
29345
  }
29302
29346
  }
29303
- now - _this.lastTapTime < _this.config.tap.interval ? _this.tapCount++ : _this.tapCount = 1, _this.lastTapTime = now, 1 === _this.tapCount ? _this.triggerEvent("tap", endEvent) : 2 === _this.tapCount && (_this.triggerEvent("doubletap", endEvent), _this.tapCount = 0);
29347
+ now - _this.lastTapTime < _this.config.tap.interval && ev.target === _this.lastTapTarget ? _this.tapCount++ : _this.tapCount = 1, _this.lastTapTime = now, _this.lastTapTarget = ev.target, 1 === _this.tapCount ? _this.triggerEvent("tap", endEvent) : 2 === _this.tapCount && (_this.triggerEvent("doubletap", endEvent), _this.tapCount = 0);
29304
29348
  }
29305
29349
  for (var i = 0, len = cachedEvents.length; i < len; i++) if (cachedEvents[i].pointerId === endEvent.pointerId) {
29306
29350
  cachedEvents.splice(i, 1), startPoints.splice(i, 1);
@@ -34686,7 +34730,7 @@
34686
34730
 
34687
34731
  var roughModule = _roughModule;
34688
34732
 
34689
- const version = "0.16.17";
34733
+ const version = "0.16.18-alpha.0";
34690
34734
  loadAllModule(container);
34691
34735
 
34692
34736
  exports.ACustomAnimate = ACustomAnimate;