@visactor/vrender 1.0.42 → 1.0.43-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/dist/index.js CHANGED
@@ -44973,6 +44973,16 @@
44973
44973
  strokeBoundsBuffer: 0
44974
44974
  }
44975
44975
  };
44976
+ const LAYOUT_LEVEL = {
44977
+ background: 0,
44978
+ preview: 1,
44979
+ dragMask: 2,
44980
+ selectedBackground: 3,
44981
+ selectedPreview: 4,
44982
+ handler: 5,
44983
+ handlerText: 5,
44984
+ handlerMask: 999
44985
+ };
44976
44986
 
44977
44987
  const isTextOverflow = (componentBoundsLike, textBounds, layout, isHorizontal) => {
44978
44988
  if (!textBounds) return !1;
@@ -45104,12 +45114,14 @@
45104
45114
  x: position.x + start * width,
45105
45115
  y: position.y,
45106
45116
  width: (end - start) * width,
45107
- height: height
45117
+ height: height,
45118
+ zIndex: LAYOUT_LEVEL.dragMask
45108
45119
  }, dragMaskStyle), "rect") : this._dragMask = this._getContainer().createOrUpdateChild("dragMask", Object.assign({
45109
45120
  x: position.x,
45110
45121
  y: position.y + start * height,
45111
45122
  width: width,
45112
- height: (end - start) * height
45123
+ height: (end - start) * height,
45124
+ zIndex: LAYOUT_LEVEL.dragMask
45113
45125
  }, dragMaskStyle), "rect"), {
45114
45126
  start: start,
45115
45127
  end: end
@@ -45133,7 +45145,8 @@
45133
45145
  y: position.y,
45134
45146
  width: width,
45135
45147
  height: height,
45136
- cursor: brushSelect ? "crosshair" : "auto"
45148
+ cursor: brushSelect ? "crosshair" : "auto",
45149
+ zIndex: LAYOUT_LEVEL.background
45137
45150
  }, backgroundStyle), {
45138
45151
  pickable: !zoomLock && (null === (_a = backgroundStyle.pickable) || void 0 === _a || _a)
45139
45152
  }), "rect");
@@ -45166,7 +45179,8 @@
45166
45179
  x: position.x + start * width,
45167
45180
  y: position.y - middleHandlerBackgroundSize,
45168
45181
  width: (end - start) * width,
45169
- height: middleHandlerBackgroundSize
45182
+ height: middleHandlerBackgroundSize,
45183
+ zIndex: LAYOUT_LEVEL.handler
45170
45184
  }, null === (_d = middleHandlerStyle.background) || void 0 === _d ? void 0 : _d.style), {
45171
45185
  pickable: !zoomLock && (null === (_g = null === (_f = null === (_e = middleHandlerStyle.background) || void 0 === _e ? void 0 : _e.style) || void 0 === _f ? void 0 : _f.pickable) || void 0 === _g || _g)
45172
45186
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
@@ -45174,24 +45188,29 @@
45174
45188
  y: position.y - middleHandlerBackgroundSize / 2,
45175
45189
  strokeBoundsBuffer: 0,
45176
45190
  angle: 0,
45177
- symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square"
45191
+ symbolType: null !== (_j = null === (_h = middleHandlerStyle.icon) || void 0 === _h ? void 0 : _h.symbolType) && void 0 !== _j ? _j : "square",
45192
+ zIndex: LAYOUT_LEVEL.handler
45178
45193
  }, middleHandlerStyle.icon), {
45179
45194
  pickable: !zoomLock && (null === (_k = middleHandlerStyle.icon.pickable) || void 0 === _k || _k)
45180
45195
  }), "symbol");
45181
45196
  }
45182
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
45197
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
45183
45198
  x: position.x + start * width,
45184
45199
  y: position.y + height / 2,
45185
45200
  size: height,
45186
45201
  symbolType: null !== (_l = startHandlerStyle.symbolType) && void 0 !== _l ? _l : "square"
45187
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), startHandlerStyle), {
45202
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
45203
+ zIndex: LAYOUT_LEVEL.handler
45204
+ }), startHandlerStyle), {
45188
45205
  pickable: !zoomLock && (null === (_m = startHandlerStyle.pickable) || void 0 === _m || _m)
45189
- }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
45206
+ }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign(Object.assign({
45190
45207
  x: position.x + end * width,
45191
45208
  y: position.y + height / 2,
45192
45209
  size: height,
45193
45210
  symbolType: null !== (_o = endHandlerStyle.symbolType) && void 0 !== _o ? _o : "square"
45194
- }, DEFAULT_HANDLER_ATTR_MAP.horizontal), endHandlerStyle), {
45211
+ }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
45212
+ zIndex: LAYOUT_LEVEL.handler
45213
+ }), endHandlerStyle), {
45195
45214
  pickable: !zoomLock && (null === (_p = endHandlerStyle.pickable) || void 0 === _p || _p)
45196
45215
  }), "symbol");
45197
45216
  const startHandlerWidth = Math.max(this._startHandler.AABBBounds.width(), startHandlerMinSize),
@@ -45205,7 +45224,7 @@
45205
45224
  height: startHandlerHeight,
45206
45225
  fill: "white",
45207
45226
  fillOpacity: 0,
45208
- zIndex: 999
45227
+ zIndex: LAYOUT_LEVEL.handlerMask
45209
45228
  }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
45210
45229
  pickable: !zoomLock
45211
45230
  }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
@@ -45215,7 +45234,7 @@
45215
45234
  height: endHandlerHeight,
45216
45235
  fill: "white",
45217
45236
  fillOpacity: 0,
45218
- zIndex: 999
45237
+ zIndex: LAYOUT_LEVEL.handlerMask
45219
45238
  }, DEFAULT_HANDLER_ATTR_MAP.horizontal), {
45220
45239
  pickable: !zoomLock
45221
45240
  }), "rect");
@@ -45226,7 +45245,8 @@
45226
45245
  x: "left" === orient ? position.x - middleHandlerBackgroundSize : position.x + width,
45227
45246
  y: position.y + start * height,
45228
45247
  width: middleHandlerBackgroundSize,
45229
- height: (end - start) * height
45248
+ height: (end - start) * height,
45249
+ zIndex: LAYOUT_LEVEL.handler
45230
45250
  }, null === (_r = middleHandlerStyle.background) || void 0 === _r ? void 0 : _r.style), {
45231
45251
  pickable: !zoomLock && (null === (_u = null === (_t = null === (_s = middleHandlerStyle.background) || void 0 === _s ? void 0 : _s.style) || void 0 === _t ? void 0 : _t.pickable) || void 0 === _u || _u)
45232
45252
  }), "rect"), this._middleHandlerSymbol = group.createOrUpdateChild("middleHandlerSymbol", Object.assign(Object.assign({
@@ -45234,23 +45254,27 @@
45234
45254
  y: position.y + (start + end) / 2 * height,
45235
45255
  angle: Math.PI / 180 * 90,
45236
45256
  symbolType: null !== (_w = null === (_v = middleHandlerStyle.icon) || void 0 === _v ? void 0 : _v.symbolType) && void 0 !== _w ? _w : "square",
45237
- strokeBoundsBuffer: 0
45257
+ strokeBoundsBuffer: 0,
45258
+ zIndex: LAYOUT_LEVEL.handler
45238
45259
  }, middleHandlerStyle.icon), {
45239
45260
  pickable: !zoomLock && (null === (_y = null === (_x = middleHandlerStyle.icon) || void 0 === _x ? void 0 : _x.pickable) || void 0 === _y || _y)
45240
45261
  }), "symbol");
45241
45262
  }
45242
- this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign({
45263
+ this._startHandler = group.createOrUpdateChild("startHandler", Object.assign(Object.assign(Object.assign(Object.assign({
45243
45264
  x: position.x + width / 2,
45244
45265
  y: position.y + start * height,
45245
45266
  size: width,
45246
45267
  symbolType: null !== (_z = startHandlerStyle.symbolType) && void 0 !== _z ? _z : "square"
45247
- }, DEFAULT_HANDLER_ATTR_MAP.vertical), startHandlerStyle), {
45268
+ }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
45269
+ zIndex: LAYOUT_LEVEL.handler
45270
+ }), startHandlerStyle), {
45248
45271
  pickable: !zoomLock && (null === (_0 = startHandlerStyle.pickable) || void 0 === _0 || _0)
45249
45272
  }), "symbol"), this._endHandler = group.createOrUpdateChild("endHandler", Object.assign(Object.assign(Object.assign({
45250
45273
  x: position.x + width / 2,
45251
45274
  y: position.y + end * height,
45252
45275
  size: width,
45253
- symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square"
45276
+ symbolType: null !== (_1 = endHandlerStyle.symbolType) && void 0 !== _1 ? _1 : "square",
45277
+ zIndex: LAYOUT_LEVEL.handler
45254
45278
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), endHandlerStyle), {
45255
45279
  pickable: !zoomLock && (null === (_2 = endHandlerStyle.pickable) || void 0 === _2 || _2)
45256
45280
  }), "symbol");
@@ -45265,7 +45289,7 @@
45265
45289
  height: endHandlerWidth,
45266
45290
  fill: "white",
45267
45291
  fillOpacity: 0,
45268
- zIndex: 999
45292
+ zIndex: LAYOUT_LEVEL.handlerMask
45269
45293
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
45270
45294
  pickable: !zoomLock
45271
45295
  }), "rect"), this._endHandlerMask = group.createOrUpdateChild("endHandlerMask", Object.assign(Object.assign({
@@ -45275,7 +45299,7 @@
45275
45299
  height: endHandlerWidth,
45276
45300
  fill: "white",
45277
45301
  fillOpacity: 0,
45278
- zIndex: 999
45302
+ zIndex: LAYOUT_LEVEL.handlerMask
45279
45303
  }, DEFAULT_HANDLER_ATTR_MAP.vertical), {
45280
45304
  pickable: !zoomLock
45281
45305
  }), "rect");
@@ -45304,7 +45328,8 @@
45304
45328
  y: position.y,
45305
45329
  width: (end - start) * width,
45306
45330
  height: height,
45307
- cursor: brushSelect ? "crosshair" : "move"
45331
+ cursor: brushSelect ? "crosshair" : "move",
45332
+ zIndex: LAYOUT_LEVEL.selectedBackground
45308
45333
  }, selectedBackgroundStyle), {
45309
45334
  pickable: !zoomLock && (null === (_a = selectedBackgroundChartStyle.pickable) || void 0 === _a || _a)
45310
45335
  }), "rect") : this._selectedBackground = group.createOrUpdateChild("selectedBackground", Object.assign(Object.assign({
@@ -45312,14 +45337,16 @@
45312
45337
  y: position.y + start * height,
45313
45338
  width: width,
45314
45339
  height: (end - start) * height,
45315
- cursor: brushSelect ? "crosshair" : "move"
45340
+ cursor: brushSelect ? "crosshair" : "move",
45341
+ zIndex: LAYOUT_LEVEL.selectedBackground
45316
45342
  }, selectedBackgroundStyle), {
45317
45343
  pickable: !zoomLock && (null === (_b = selectedBackgroundStyle.pickable) || void 0 === _b || _b)
45318
45344
  }), "rect");
45319
45345
  }
45320
45346
  _setPreviewAttributes(type, group) {
45321
45347
  this._previewGroup || (this._previewGroup = group.createOrUpdateChild("previewGroup", {
45322
- pickable: !1
45348
+ pickable: !1,
45349
+ zIndex: LAYOUT_LEVEL.preview
45323
45350
  }, "group")), "line" === type ? this._previewLine = this._previewGroup.createOrUpdateChild("previewLine", {}, "line") : this._previewArea = this._previewGroup.createOrUpdateChild("previewArea", {
45324
45351
  curveType: "basis"
45325
45352
  }, "area");
@@ -45338,7 +45365,8 @@
45338
45365
  }
45339
45366
  _setSelectedPreviewClipAttributes(type, group) {
45340
45367
  this._selectedPreviewGroupClip || (this._selectedPreviewGroupClip = group.createOrUpdateChild("selectedPreviewGroupClip", {
45341
- pickable: !1
45368
+ pickable: !1,
45369
+ zIndex: LAYOUT_LEVEL.selectedPreview
45342
45370
  }, "group"), this._selectedPreviewGroup = this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup", {}, "group"));
45343
45371
  const {
45344
45372
  start: start,
@@ -49173,31 +49201,7 @@
49173
49201
  return graphicCreator.symbol(style);
49174
49202
  }
49175
49203
  _renderHandlerText(value, position) {
49176
- return graphicCreator.text(this._getHandlerTextAttributes(value, position));
49177
- }
49178
- _getHandlerPosition(isStart) {
49179
- return this.attribute.range && isStart ? "start" : "end";
49180
- }
49181
- _getHandlerTextStyle(value, position) {
49182
- const {
49183
- align: align,
49184
- handlerSize = 14,
49185
- handlerText = {},
49186
- railHeight: railHeight,
49187
- railWidth: railWidth,
49188
- slidable: slidable
49189
- } = this.attribute;
49190
- return isFunction$1(handlerText.style) ? handlerText.style(value, position, {
49191
- layout: this.attribute.layout,
49192
- align: align,
49193
- railWidth: railWidth,
49194
- railHeight: railHeight,
49195
- handlerSize: handlerSize,
49196
- slidable: slidable
49197
- }) : handlerText.style;
49198
- }
49199
- _getHandlerTextAttributes(value, position) {
49200
- var _a, _b;
49204
+ var _a, _b, _c;
49201
49205
  const {
49202
49206
  align: align,
49203
49207
  handlerSize = 14,
@@ -49209,13 +49213,13 @@
49209
49213
  isHorizontal = this._isHorizontal,
49210
49214
  pos = this.calculatePosByValue(value, position),
49211
49215
  textSpace = null !== (_a = handlerText.space) && void 0 !== _a ? _a : 4,
49212
- handlerTextStyle = this._getHandlerTextStyle(value, position),
49213
49216
  textStyle = {
49214
49217
  text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_b = handlerText.precision) && void 0 !== _b ? _b : 0),
49215
- lineHeight: null == handlerTextStyle ? void 0 : handlerTextStyle.lineHeight,
49218
+ lineHeight: null === (_c = handlerText.style) || void 0 === _c ? void 0 : _c.lineHeight,
49216
49219
  cursor: !1 === slidable ? "default" : getDefaultCursor(isHorizontal)
49217
49220
  };
49218
- return isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos), Object.assign(Object.assign({}, textStyle), handlerTextStyle);
49221
+ isHorizontal ? "top" === align ? (textStyle.textBaseline = "bottom", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight - handlerSize) / 2 - textSpace) : (textStyle.textBaseline = "top", textStyle.textAlign = "center", textStyle.x = pos, textStyle.y = (railHeight + handlerSize) / 2 + textSpace) : "left" === align ? (textStyle.textBaseline = "middle", textStyle.textAlign = "end", textStyle.x = (railWidth - handlerSize) / 2 - textSpace, textStyle.y = pos) : (textStyle.textBaseline = "middle", textStyle.textAlign = "start", textStyle.x = (railWidth + handlerSize) / 2 + textSpace, textStyle.y = pos);
49222
+ return graphicCreator.text(Object.assign(Object.assign({}, textStyle), handlerText.style));
49219
49223
  }
49220
49224
  _renderTooltip() {
49221
49225
  var _a;
@@ -49343,19 +49347,31 @@
49343
49347
  }
49344
49348
  }
49345
49349
  _updateHandler(handler, position, value) {
49350
+ var _a;
49346
49351
  const isHorizontal = this._isHorizontal;
49347
49352
  handler.setAttribute(isHorizontal ? "x" : "y", position);
49348
49353
  const updateHandlerText = handler.name === exports.SLIDER_ELEMENT_NAME.startHandler ? this._startHandlerText : this._endHandlerText;
49349
49354
  if (updateHandlerText) {
49350
- const handlerPosition = this._getHandlerPosition(handler.name === exports.SLIDER_ELEMENT_NAME.startHandler);
49351
- updateHandlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49355
+ const {
49356
+ handlerText = {}
49357
+ } = this.attribute;
49358
+ updateHandlerText.setAttributes({
49359
+ text: handlerText.formatter ? handlerText.formatter(value) : value.toFixed(null !== (_a = handlerText.precision) && void 0 !== _a ? _a : 0),
49360
+ [isHorizontal ? "x" : "y"]: position
49361
+ });
49352
49362
  }
49353
49363
  handler.name === exports.SLIDER_ELEMENT_NAME.startHandler ? (this._currentValue.startValue = value, this._currentValue.startPos = position) : (this._currentValue.endValue = value, this._currentValue.endPos = position);
49354
49364
  }
49355
49365
  _updateHandlerText(handlerText, position, value) {
49366
+ var _a;
49356
49367
  const isHorizontal = this._isHorizontal,
49357
- handlerPosition = this._getHandlerPosition(handlerText.name === exports.SLIDER_ELEMENT_NAME.startHandlerText);
49358
- handlerText.setAttributes(this._getHandlerTextAttributes(value, handlerPosition));
49368
+ {
49369
+ handlerText: handlerTextAttr = {}
49370
+ } = this.attribute;
49371
+ handlerText.setAttributes({
49372
+ [isHorizontal ? "x" : "y"]: position,
49373
+ text: handlerTextAttr.formatter ? handlerTextAttr.formatter(value) : value.toFixed(null !== (_a = handlerTextAttr.precision) && void 0 !== _a ? _a : 0)
49374
+ });
49359
49375
  const updateHandler = handlerText.name === exports.SLIDER_ELEMENT_NAME.startHandlerText ? this._startHandler : this._endHandler;
49360
49376
  updateHandler && updateHandler.setAttributes({
49361
49377
  [isHorizontal ? "x" : "y"]: position
@@ -53131,7 +53147,7 @@
53131
53147
  select: !0
53132
53148
  };
53133
53149
 
53134
- const version = "1.0.42";
53150
+ const version = "1.0.43-alpha.0";
53135
53151
  preLoadAllModule();
53136
53152
  if (isBrowserEnv()) {
53137
53153
  loadBrowserEnv(container);