@visactor/vrender-components 0.22.7-alpha.3 → 0.22.7-alpha.5
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/crosshair/base.js +1 -2
- package/cjs/crosshair/type.js +2 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/poptip/contribution.js +4 -2
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/poptip/poptip.d.ts +5 -0
- package/cjs/poptip/poptip.js +87 -18
- package/cjs/poptip/poptip.js.map +1 -1
- package/cjs/poptip/type.d.ts +4 -1
- package/cjs/poptip/type.js.map +1 -1
- package/cjs/scrollbar/scrollbar.d.ts +0 -1
- package/cjs/scrollbar/scrollbar.js +10 -17
- package/cjs/scrollbar/scrollbar.js.map +1 -1
- package/cjs/slider/slider.d.ts +0 -1
- package/cjs/slider/slider.js +22 -30
- package/cjs/slider/slider.js.map +1 -1
- package/cjs/switch/switch.js +2 -2
- package/cjs/switch/switch.js.map +1 -1
- package/dist/index.es.js +189 -83
- package/es/crosshair/base.js +1 -2
- package/es/crosshair/type.js +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/poptip/contribution.js +4 -2
- package/es/poptip/contribution.js.map +1 -1
- package/es/poptip/poptip.d.ts +5 -0
- package/es/poptip/poptip.js +85 -19
- package/es/poptip/poptip.js.map +1 -1
- package/es/poptip/type.d.ts +4 -1
- package/es/poptip/type.js.map +1 -1
- package/es/scrollbar/scrollbar.d.ts +0 -1
- package/es/scrollbar/scrollbar.js +9 -18
- package/es/scrollbar/scrollbar.js.map +1 -1
- package/es/slider/slider.d.ts +0 -1
- package/es/slider/slider.js +21 -31
- package/es/slider/slider.js.map +1 -1
- package/es/switch/switch.js +2 -2
- package/es/switch/switch.js.map +1 -1
- package/package.json +4 -4
- package/cjs/util/event.d.ts +0 -1
- package/cjs/util/event.js +0 -14
- package/cjs/util/event.js.map +0 -1
- package/es/util/event.d.ts +0 -1
- package/es/util/event.js +0 -6
- package/es/util/event.js.map +0 -1
package/cjs/switch/switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/switch/switch.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,uCAAiD;AAGjD,yDAA4D;AAE5D,yCAAiD;AACjD,kCAA0C;AAE1C,IAAA,8BAAmB,GAAE,CAAC;AACtB,MAAa,MAAO,SAAQ,wBAA6C;IAmCvE,YAAY,UAA4B,EAAE,OAA0B;QAClE,KAAK,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,EAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,EAAE,EAAE,MAAM,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC,CAAC;QAqHrF,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE;gBAC3B,OAAO;aACR;iBAAM,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;gBACjC,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;aACrC;iBAAM;gBACL,IAAI,CAAC,YAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;aACpC;YAED,IAAI,CAAC,cAAc,CAAC,qBAAqB,EAAE;gBACzC,SAAS,EAAE,qBAAqB;gBAChC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO;aAChC,CAAC,CAAC;YAEH,IAAI,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;QAC/B,CAAC,CAAC;QAnIA,IAAI,CAAC,WAAW,EAAE,CAAC;QAEnB,IAAI,CAAC,uBAAuB,GAAG,CAAC,GAAQ,EAAE,UAAe,EAAE,GAA6B,EAAE,EAAE;YAC1F,IAAI,aAAa,IAAI,GAAG,EAAE;gBACxB,IAA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EAAE,MAAM,CAAC,CAAC;QACrF,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,EAAE,CAAC;IAChB,CAAC;;AA/KH,wBAgLC;AA/KQ,wBAAiB,GAA8B;IACpD,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,aAAa;IAC5B,MAAM,EAAE;QACN,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,kBAAkB;QACjC,WAAW,EAAE,SAAS;QACtB,oBAAoB,EAAE,kBAAkB;QACxC,kBAAkB,EAAE,kBAAkB;QACtC,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,yBAAyB,EAAE,CAAC;CAC7B,CAAC","file":"switch.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { SwitchAttributes } from './type';\nimport type { ICircle } from '@visactor/vrender-core';\nimport { Circle, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadSwitchComponent } from './register';\nimport { measureTextSize } from '../util';\n\nloadSwitchComponent();\nexport class Switch extends AbstractComponent<Required<SwitchAttributes>> {\n static defaultAttributes: Partial<SwitchAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n circle: {\n radius: 8,\n fill: '#FFF',\n pickable: false\n },\n box: {\n width: 40,\n height: 24,\n cornerRadius: 12,\n uncheckedFill: 'rgb(201,205,212)',\n checkedFill: '#165DFF',\n disableUncheckedFill: 'rgb(242,243,245)',\n disableCheckedFill: 'rgb(148,191,255)',\n pickable: false\n },\n text: {\n textAlign: 'left',\n textBaseline: 'top',\n pickable: false\n },\n spaceBetweenTextAndCircle: 6\n };\n _box: Rect;\n _circle: ICircle;\n _text: Text;\n\n name: 'switch';\n\n constructor(attributes: SwitchAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Switch.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n if (this.attribute.disabled && this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill\n });\n } else if (this.attribute.disabled && !this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableUncheckedFill\n });\n } else if (this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill\n });\n } else {\n this._box.setAttributes({\n fill: this.attribute.box.uncheckedFill\n });\n }\n this.appendChild(this._box);\n }\n\n renderCircle() {\n this._circle = new Circle(merge({}, this.attribute.circle));\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new Text(merge({}, this.attribute.text ?? {}));\n if (this.attribute.checked && this.attribute.text?.checkedText) {\n this._text.setAttributes({\n text: this.attribute.text.checkedText\n });\n } else if (this.attribute.text?.uncheckedText) {\n this._text.setAttributes({\n text: this.attribute.text.uncheckedText\n });\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const space = this.attribute.spaceBetweenTextAndCircle;\n const radius = this.attribute.circle.radius;\n\n const boxHeight = this.attribute.box.height;\n const circleHeight = radius * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, circleHeight, textHeight);\n const circleY = maxHeight / 2 - circleHeight / 2 + radius;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const circleWidth = radius * 2;\n // const textWidth = this._text.AABBBounds.width();\n const textWidth = measureTextSize(\n (this.attribute.text?.checkedText?.length ?? 0) > (this.attribute.text?.uncheckedText?.length ?? 0)\n ? this.attribute.text?.checkedText ?? ''\n : this.attribute.text?.uncheckedText ?? '',\n this._text.attribute\n ).width;\n const maxWidth = Math.max(boxWidth, circleWidth + textWidth + space * 3); // [circle[space]text[space][space]]\n const circleX = boxHeight / 2 - circleWidth / 2 + radius;\n const textX = circleX + radius + space;\n\n this._box.setAttributes({\n width: maxWidth,\n height: maxHeight\n });\n\n // set circle position\n this._circle.setAttributes({\n y: circleY,\n x: this.attribute.checked ? circleX : maxWidth - circleX\n });\n\n // set text position\n this._text.setAttributes({\n x: this.attribute.checked ? textX : maxWidth - textX - textWidth,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n } else {\n this.setAttribute('checked', true);\n }\n\n this._dispatchEvent('switch_state_change', {\n eventType: 'switch_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: SwitchAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Switch.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/switch/switch.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;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B;IACpD,WAAW,EAAE,IAAI;IACjB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,MAAM,EAAE,SAAS;IACjB,aAAa,EAAE,aAAa;IAC5B,MAAM,EAAE;QACN,MAAM,EAAE,CAAC;QACT,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,KAAK;KAChB;IACD,GAAG,EAAE;QACH,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,YAAY,EAAE,EAAE;QAChB,aAAa,EAAE,kBAAkB;QACjC,WAAW,EAAE,SAAS;QACtB,oBAAoB,EAAE,kBAAkB;QACxC,kBAAkB,EAAE,kBAAkB;QACtC,QAAQ,EAAE,KAAK;KAChB;IACD,IAAI,EAAE;QACJ,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;QACnB,QAAQ,EAAE,KAAK;KAChB;IACD,yBAAyB,EAAE,CAAC;CAC7B,CAAC","file":"switch.js","sourcesContent":["import { merge } from '@visactor/vutils';\nimport { AbstractComponent } from '../core/base';\nimport type { SwitchAttributes } from './type';\nimport type { ICircle } from '@visactor/vrender-core';\nimport { Circle, Rect, Text } from '@visactor/vrender-core';\nimport type { ComponentOptions } from '../interface';\nimport { loadSwitchComponent } from './register';\nimport { measureTextSize } from '../util';\n\nloadSwitchComponent();\nexport class Switch extends AbstractComponent<Required<SwitchAttributes>> {\n static defaultAttributes: Partial<SwitchAttributes> = {\n interactive: true,\n disabled: false,\n checked: false,\n cursor: 'pointer',\n disableCursor: 'not-allowed',\n circle: {\n radius: 8,\n fill: '#FFF',\n pickable: false\n },\n box: {\n width: 40,\n height: 24,\n cornerRadius: 12,\n uncheckedFill: 'rgb(201,205,212)',\n checkedFill: '#165DFF',\n disableUncheckedFill: 'rgb(242,243,245)',\n disableCheckedFill: 'rgb(148,191,255)',\n pickable: false\n },\n text: {\n textAlign: 'left',\n textBaseline: 'top',\n pickable: false\n },\n spaceBetweenTextAndCircle: 6\n };\n _box: Rect;\n _circle: ICircle;\n _text: Text;\n\n name: 'switch';\n\n constructor(attributes: SwitchAttributes, options?: ComponentOptions) {\n super(options?.skipDefault ? attributes : merge({}, Switch.defaultAttributes, attributes));\n this.renderGroup();\n\n this.onBeforeAttributeUpdate = (val: any, attributes: any, key: null | string | string[]) => {\n if ('interactive' in val) {\n this.setAttribute('pickable', val.interactive);\n }\n if ('disabled' in val) {\n this.setAttribute('cursor', val.disable ? this.attribute.disableCursor : this.attribute.cursor);\n }\n return undefined;\n };\n\n this.addEventListener('pointerup', this._handlePointerUp);\n }\n\n render() {\n this.removeAllChild(true);\n\n this.renderBox();\n this.renderCircle();\n this.renderText();\n this.layout();\n }\n\n renderBox() {\n this._box = new Rect(merge({}, this.attribute.box));\n if (this.attribute.disabled && this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableCheckedFill\n });\n } else if (this.attribute.disabled && !this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.disableUncheckedFill\n });\n } else if (this.attribute.checked) {\n this._box.setAttributes({\n fill: this.attribute.box.checkedFill\n });\n } else {\n this._box.setAttributes({\n fill: this.attribute.box.uncheckedFill\n });\n }\n this.appendChild(this._box);\n }\n\n renderCircle() {\n this._circle = new Circle(merge({}, this.attribute.circle));\n this.appendChild(this._circle);\n }\n\n renderText() {\n this._text = new Text(merge({}, this.attribute.text ?? {}));\n if (this.attribute.checked && this.attribute.text?.checkedText) {\n this._text.setAttributes({\n text: this.attribute.text.checkedText\n });\n } else if (this.attribute.text?.uncheckedText) {\n this._text.setAttributes({\n text: this.attribute.text.uncheckedText\n });\n }\n this.appendChild(this._text);\n }\n\n renderGroup() {\n if (!this.attribute.interactive) {\n this.setAttribute('pickable', false);\n }\n if (this.attribute.disabled) {\n this.setAttribute('cursor', this.attribute.disableCursor);\n }\n }\n\n layout() {\n const space = this.attribute.spaceBetweenTextAndCircle;\n const radius = this.attribute.circle.radius;\n\n const boxHeight = this.attribute.box.height;\n const circleHeight = radius * 2;\n const textHeight = this._text.AABBBounds.height();\n const maxHeight = Math.max(boxHeight, circleHeight, textHeight);\n const circleY = maxHeight / 2 - circleHeight / 2 + radius;\n const textY = maxHeight / 2 - textHeight / 2;\n\n const boxWidth = this.attribute.box.width;\n const circleWidth = radius * 2;\n // const textWidth = this._text.AABBBounds.width();\n const textWidth = measureTextSize(\n (this.attribute.text?.checkedText?.length ?? 0) > (this.attribute.text?.uncheckedText?.length ?? 0)\n ? this.attribute.text?.checkedText ?? ''\n : this.attribute.text?.uncheckedText ?? '',\n this._text.attribute\n ).width;\n const maxWidth = Math.max(boxWidth, circleWidth + textWidth + space * 3); // [circle[space]text[space][space]]\n const circleX = boxHeight / 2 - circleWidth / 2 + radius;\n const textX = circleX + radius + space;\n\n this._box.setAttributes({\n width: maxWidth,\n height: maxHeight\n });\n\n // set circle position\n this._circle.setAttributes({\n y: circleY,\n x: !this.attribute.checked ? circleX : maxWidth - circleX\n });\n\n // set text position\n this._text.setAttributes({\n x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,\n y: textY\n });\n }\n\n private _handlePointerUp = () => {\n if (this.attribute.disabled) {\n return;\n } else if (this.attribute.checked) {\n this.setAttribute('checked', false);\n } else {\n this.setAttribute('checked', true);\n }\n\n this._dispatchEvent('switch_state_change', {\n eventType: 'switch_state_change',\n checked: this.attribute.checked\n });\n\n this.stage.renderNextFrame();\n };\n\n initAttributes(params: SwitchAttributes, options?: ComponentOptions) {\n params = options?.skipDefault ? params : merge({}, Switch.defaultAttributes, params);\n super.initAttributes(params);\n this.renderGroup();\n this.render();\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -2835,6 +2835,7 @@ function applyStrokeStyle(ctx, character) {
|
|
|
2835
2835
|
ctx.globalAlpha = strokeOpacity * opacity, ctx.lineWidth = character && "number" == typeof character.lineWidth ? character.lineWidth : 1, ctx.strokeStyle = strokeStyle, setTextStyle(ctx, character);
|
|
2836
2836
|
}
|
|
2837
2837
|
function getStrByWithCanvas(desc, width, character, guessIndex, needTestLetter) {
|
|
2838
|
+
if (desc.length <= 1) return 0;
|
|
2838
2839
|
if (!width || width <= 0) return 0;
|
|
2839
2840
|
const textMeasure = application.graphicUtil.textMeasure;
|
|
2840
2841
|
let index = guessIndex,
|
|
@@ -2868,6 +2869,13 @@ function testLetter2(string, index) {
|
|
|
2868
2869
|
}
|
|
2869
2870
|
function measureTextCanvas(text, character) {
|
|
2870
2871
|
let mode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "actual";
|
|
2872
|
+
var _a;
|
|
2873
|
+
if ("" === text) return {
|
|
2874
|
+
ascent: 0,
|
|
2875
|
+
height: 0,
|
|
2876
|
+
descent: 0,
|
|
2877
|
+
width: 0
|
|
2878
|
+
};
|
|
2871
2879
|
const measurement = application.graphicUtil.textMeasure.measureText(text, character),
|
|
2872
2880
|
result = {
|
|
2873
2881
|
ascent: 0,
|
|
@@ -2877,7 +2885,9 @@ function measureTextCanvas(text, character) {
|
|
|
2877
2885
|
},
|
|
2878
2886
|
ascent = "actual" === mode ? measurement.actualBoundingBoxAscent : measurement.fontBoundingBoxAscent,
|
|
2879
2887
|
descent = "actual" === mode ? measurement.actualBoundingBoxDescent : measurement.fontBoundingBoxDescent;
|
|
2880
|
-
|
|
2888
|
+
"number" != typeof ascent || "number" != typeof descent ? (result.width = Math.floor(measurement.width), result.height = character.fontSize || 0, result.ascent = result.height, result.descent = 0) : (result.width = Math.floor(measurement.width), result.height = Math.floor(ascent + descent), result.ascent = Math.floor(ascent), result.descent = result.height - result.ascent);
|
|
2889
|
+
const space = null !== (_a = character.space) && void 0 !== _a ? _a : 0;
|
|
2890
|
+
return result.width += space, result;
|
|
2881
2891
|
}
|
|
2882
2892
|
|
|
2883
2893
|
var __decorate$O = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
|
@@ -4162,7 +4172,7 @@ class FederatedEvent {
|
|
|
4162
4172
|
}
|
|
4163
4173
|
_composedDetailPath(params) {
|
|
4164
4174
|
if (params && params.graphic) {
|
|
4165
|
-
const g =
|
|
4175
|
+
const g = params.graphic;
|
|
4166
4176
|
if (g.stage) {
|
|
4167
4177
|
const path = g.stage.eventSystem.manager.propagationPath(g);
|
|
4168
4178
|
this.detailPath.push(path), this._composedDetailPath(params.params);
|
|
@@ -8830,6 +8840,7 @@ function getFixedLRTB(left, right, top, bottom) {
|
|
|
8830
8840
|
}
|
|
8831
8841
|
class Paragraph {
|
|
8832
8842
|
constructor(text, newLine, character, ascentDescentMode) {
|
|
8843
|
+
var _a, _b;
|
|
8833
8844
|
this.fontSize = character.fontSize || 16, this.textBaseline = character.textBaseline || "alphabetic", this.ascentDescentMode = ascentDescentMode;
|
|
8834
8845
|
const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
|
|
8835
8846
|
this.lineHeight = "number" == typeof lineHeight ? lineHeight > this.fontSize ? lineHeight : this.fontSize : Math.floor(1.2 * this.fontSize), this.height = this.lineHeight;
|
|
@@ -8842,7 +8853,7 @@ class Paragraph {
|
|
|
8842
8853
|
let halfDetaHeight = 0,
|
|
8843
8854
|
deltaAscent = 0,
|
|
8844
8855
|
deltaDescent = 0;
|
|
8845
|
-
this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
|
|
8856
|
+
this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, this.space = character.space, this.dx = null !== (_a = character.dx) && void 0 !== _a ? _a : 0, this.dy = null !== (_b = character.dy) && void 0 !== _b ? _b : 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
|
|
8846
8857
|
}
|
|
8847
8858
|
updateWidth() {
|
|
8848
8859
|
const {
|
|
@@ -8861,11 +8872,11 @@ class Paragraph {
|
|
|
8861
8872
|
if ("hide" === this.ellipsis) return;
|
|
8862
8873
|
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
8863
8874
|
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
8864
|
-
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8875
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
|
|
8865
8876
|
const {
|
|
8866
8877
|
width: width
|
|
8867
8878
|
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8868
|
-
|
|
8879
|
+
left -= this.ellipsisWidth - width;
|
|
8869
8880
|
}
|
|
8870
8881
|
}
|
|
8871
8882
|
}
|
|
@@ -8876,20 +8887,21 @@ class Paragraph {
|
|
|
8876
8887
|
});
|
|
8877
8888
|
}
|
|
8878
8889
|
draw(ctx, top, ascent, deltaLeft, isLineFirst, textAlign, lineHeight) {
|
|
8890
|
+
var _a;
|
|
8879
8891
|
let baseline = top + ascent,
|
|
8880
8892
|
text = this.text,
|
|
8881
|
-
left = this.left + deltaLeft;
|
|
8893
|
+
left = this.left + deltaLeft + (null !== (_a = this.space) && void 0 !== _a ? _a : 0) / 2;
|
|
8882
8894
|
baseline += this.top;
|
|
8883
8895
|
let direction = this.direction;
|
|
8884
8896
|
if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
|
|
8885
8897
|
if ("hide" === this.ellipsis) return;
|
|
8886
8898
|
if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
|
|
8887
8899
|
const index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
|
|
8888
|
-
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
|
|
8900
|
+
if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) if ("vertical" === direction) ;else {
|
|
8889
8901
|
const {
|
|
8890
8902
|
width: width
|
|
8891
8903
|
} = measureTextCanvas(this.text.slice(index), this.character, this.ascentDescentMode);
|
|
8892
|
-
|
|
8904
|
+
left -= this.ellipsisWidth - width;
|
|
8893
8905
|
}
|
|
8894
8906
|
}
|
|
8895
8907
|
}
|
|
@@ -8904,7 +8916,7 @@ class Paragraph {
|
|
|
8904
8916
|
const {
|
|
8905
8917
|
lineWidth = 1
|
|
8906
8918
|
} = this.character;
|
|
8907
|
-
if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline), this.character.fill && ctx.fillText(text, left, baseline), this.character.fill) if (this.character.lineThrough || this.character.underline) {
|
|
8919
|
+
if (this.character.stroke && lineWidth && ctx.strokeText(text, left, baseline + this.dy), this.character.fill && ctx.fillText(text, left, baseline + this.dy), this.character.fill) if (this.character.lineThrough || this.character.underline) {
|
|
8908
8920
|
if (this.character.underline) {
|
|
8909
8921
|
const top = 1 + baseline,
|
|
8910
8922
|
lrtb = getFixedLRTB(left, left + (this.widthOrigin || this.width), top, top + (this.character.fontSize ? Math.max(1, Math.floor(this.character.fontSize / 10)) : 1));
|
|
@@ -14909,13 +14921,6 @@ const SCROLLBAR_START_EVENT = 'scrollDown';
|
|
|
14909
14921
|
const SCROLLBAR_EVENT = 'scrollDrag';
|
|
14910
14922
|
const SCROLLBAR_END_EVENT = 'scrollUp';
|
|
14911
14923
|
|
|
14912
|
-
function getEndTriggersOfDrag() {
|
|
14913
|
-
if (vglobal.env === 'browser') {
|
|
14914
|
-
return ['pointerup', 'pointerleave'];
|
|
14915
|
-
}
|
|
14916
|
-
return ['pointerup', 'pointerleave', 'pointerupoutside'];
|
|
14917
|
-
}
|
|
14918
|
-
|
|
14919
14924
|
const delayMap$2 = {
|
|
14920
14925
|
debounce: debounce,
|
|
14921
14926
|
throttle: throttle
|
|
@@ -14949,7 +14954,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
14949
14954
|
}
|
|
14950
14955
|
};
|
|
14951
14956
|
this._onSliderPointerDown = (e) => {
|
|
14952
|
-
this._clearDragEvents();
|
|
14953
14957
|
const { stopSliderDownPropagation = true } = this.attribute;
|
|
14954
14958
|
if (stopSliderDownPropagation) {
|
|
14955
14959
|
e.stopPropagation();
|
|
@@ -14961,12 +14965,15 @@ class ScrollBar extends AbstractComponent {
|
|
|
14961
14965
|
pos: this._prePos,
|
|
14962
14966
|
event: e
|
|
14963
14967
|
});
|
|
14964
|
-
|
|
14965
|
-
|
|
14966
|
-
|
|
14967
|
-
|
|
14968
|
-
|
|
14969
|
-
|
|
14968
|
+
if (vglobal.env === 'browser') {
|
|
14969
|
+
vglobal.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14970
|
+
vglobal.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14971
|
+
}
|
|
14972
|
+
else {
|
|
14973
|
+
this.stage.addEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
14974
|
+
this.stage.addEventListener('pointerup', this._onSliderPointerUp);
|
|
14975
|
+
this.stage.addEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
14976
|
+
}
|
|
14970
14977
|
};
|
|
14971
14978
|
this._computeScrollValue = (e) => {
|
|
14972
14979
|
const { direction } = this.attribute;
|
|
@@ -15010,7 +15017,15 @@ class ScrollBar extends AbstractComponent {
|
|
|
15010
15017
|
pre: preRange,
|
|
15011
15018
|
value: clampRange(range, limitRange[0], limitRange[1])
|
|
15012
15019
|
});
|
|
15013
|
-
|
|
15020
|
+
if (vglobal.env === 'browser') {
|
|
15021
|
+
vglobal.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15022
|
+
vglobal.removeEventListener('pointerup', this._onSliderPointerUp);
|
|
15023
|
+
}
|
|
15024
|
+
else {
|
|
15025
|
+
this.stage.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15026
|
+
this.stage.removeEventListener('pointerup', this._onSliderPointerUp);
|
|
15027
|
+
this.stage.removeEventListener('pointerupoutside', this._onSliderPointerUp);
|
|
15028
|
+
}
|
|
15014
15029
|
};
|
|
15015
15030
|
}
|
|
15016
15031
|
setScrollRange(range, render = true) {
|
|
@@ -15143,14 +15158,6 @@ class ScrollBar extends AbstractComponent {
|
|
|
15143
15158
|
? clampRange([x1 + min * width, x1 + max * width], x1, width - sliderSize)
|
|
15144
15159
|
: clampRange([y1 + min * height, y1 + max * height], y1, height - sliderSize);
|
|
15145
15160
|
}
|
|
15146
|
-
_clearDragEvents() {
|
|
15147
|
-
const triggers = getEndTriggersOfDrag();
|
|
15148
|
-
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
15149
|
-
obj.removeEventListener('pointermove', this._onSliderPointerMoveWithDelay, { capture: true });
|
|
15150
|
-
triggers.forEach((trigger) => {
|
|
15151
|
-
obj.removeEventListener(trigger, this._onSliderPointerUp);
|
|
15152
|
-
});
|
|
15153
|
-
}
|
|
15154
15161
|
_reset() {
|
|
15155
15162
|
this._sliderRenderBounds = null;
|
|
15156
15163
|
this._sliderLimitRange = null;
|
|
@@ -16232,7 +16239,7 @@ class PopTip extends AbstractComponent {
|
|
|
16232
16239
|
}
|
|
16233
16240
|
render() {
|
|
16234
16241
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
16235
|
-
const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, logoText, logoTextStyle = {}, triangleMode = 'default', space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0 } = this.attribute;
|
|
16242
|
+
const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = 'position', logoText, logoTextStyle = {}, triangleMode = 'default', space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute;
|
|
16236
16243
|
let { title = '', content = '' } = this.attribute;
|
|
16237
16244
|
title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title;
|
|
16238
16245
|
content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content;
|
|
@@ -16314,11 +16321,12 @@ class PopTip extends AbstractComponent {
|
|
|
16314
16321
|
poptipHeight += contentShape.AABBBounds.height();
|
|
16315
16322
|
}
|
|
16316
16323
|
}
|
|
16317
|
-
const layout = position === 'auto';
|
|
16324
|
+
const layout = position === 'auto' || isArray(position);
|
|
16325
|
+
const positionList = isArray(position) ? position : this.positionList;
|
|
16318
16326
|
let maxBBoxI;
|
|
16319
16327
|
let maxBBoxSize = -Infinity;
|
|
16320
|
-
for (let i = 0; i <
|
|
16321
|
-
const p = layout ?
|
|
16328
|
+
for (let i = 0; i < positionList.length + 1; i++) {
|
|
16329
|
+
const p = layout ? positionList[i === positionList.length ? maxBBoxI : i] : position;
|
|
16322
16330
|
let symbolType = 'arrow2Left';
|
|
16323
16331
|
let offsetX = (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 4;
|
|
16324
16332
|
let offsetY = 0;
|
|
@@ -16327,16 +16335,21 @@ class PopTip extends AbstractComponent {
|
|
|
16327
16335
|
}
|
|
16328
16336
|
else if (triangleMode === 'concise') {
|
|
16329
16337
|
symbolType = conciseSymbolMap[p];
|
|
16330
|
-
offsetX = ['tl', 'bl', 'rt', 'rb'].includes(
|
|
16338
|
+
offsetX = ['tl', 'bl', 'rt', 'rb'].includes(p)
|
|
16331
16339
|
? (isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2
|
|
16332
16340
|
: -(isArray(symbolSize) ? symbolSize[0] : symbolSize) / 2;
|
|
16333
|
-
offsetY = ['tl', 'tr', 'lb', 'rb'].includes(
|
|
16341
|
+
offsetY = ['tl', 'tr', 'lb', 'rb'].includes(p)
|
|
16334
16342
|
? -(isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2
|
|
16335
16343
|
: (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
|
|
16336
16344
|
}
|
|
16337
16345
|
const { angle, offset } = this.getAngleAndOffset(p, popTipWidth, poptipHeight, isArray(spaceSize) ? spaceSize : [spaceSize, spaceSize - lineWidth], symbolType);
|
|
16346
|
+
let anchorPoint = { x: 0, y: 0 };
|
|
16347
|
+
if (poptipAnchor === 'bounds' && positionBounds) {
|
|
16348
|
+
anchorPoint = this.calculateAnchorPoint(p, positionBounds);
|
|
16349
|
+
}
|
|
16350
|
+
let bgSymbol;
|
|
16338
16351
|
if (isBoolean(bgVisible)) {
|
|
16339
|
-
|
|
16352
|
+
bgSymbol = group.createOrUpdateChild('poptip-symbol-panel', Object.assign(Object.assign({}, backgroundStyle), { visible: bgVisible && (contentVisible || titleVisible), x: offsetX, y: offsetY, strokeBoundsBuffer: -1, boundsPadding: -2, anchor: [0, 0], symbolType, angle: angle, dx: offset[0], dy: offset[1] - ((_j = backgroundStyle.space) !== null && _j !== void 0 ? _j : 0), size: symbolSize, zIndex: 9 }), 'symbol');
|
|
16340
16353
|
if (!isEmpty(state === null || state === void 0 ? void 0 : state.panel)) {
|
|
16341
16354
|
bgSymbol.states = state.panel;
|
|
16342
16355
|
}
|
|
@@ -16352,8 +16365,8 @@ class PopTip extends AbstractComponent {
|
|
|
16352
16365
|
}
|
|
16353
16366
|
}
|
|
16354
16367
|
group.setAttributes({
|
|
16355
|
-
x: -offset[0] + dx,
|
|
16356
|
-
y: -offset[1] + dy,
|
|
16368
|
+
x: -offset[0] + dx + anchorPoint.x,
|
|
16369
|
+
y: -offset[1] + dy + anchorPoint.y,
|
|
16357
16370
|
anchor: [offsetX, offsetY]
|
|
16358
16371
|
});
|
|
16359
16372
|
if (logoSymbol) {
|
|
@@ -16375,27 +16388,97 @@ class PopTip extends AbstractComponent {
|
|
|
16375
16388
|
group.createOrUpdateChild('poptip-logo-text', Object.assign(Object.assign({}, logoTextStyle), { x: 0, y: poptipHeight / 2, visible: bgVisible && (contentVisible || titleVisible), text: logoText, textAlign: 'center', textBaseline: 'middle', zIndex: 10 }), 'text');
|
|
16376
16389
|
}
|
|
16377
16390
|
}
|
|
16378
|
-
if (
|
|
16391
|
+
if (range) {
|
|
16379
16392
|
_tBounds.setValue(0, 0, popTipWidth, poptipHeight).transformWithMatrix(group.globalTransMatrix);
|
|
16380
16393
|
const b = _tBounds;
|
|
16381
16394
|
const stageBounds = new Bounds().setValue(0, 0, range[0], range[1]);
|
|
16382
|
-
if (
|
|
16383
|
-
|
|
16395
|
+
if (layout) {
|
|
16396
|
+
if (rectInsideAnotherRect(b, stageBounds, false)) {
|
|
16397
|
+
break;
|
|
16398
|
+
}
|
|
16399
|
+
else {
|
|
16400
|
+
const bbox = getRectIntersect(b, stageBounds, false);
|
|
16401
|
+
const size = (bbox.x2 - bbox.x1) * (bbox.y2 - bbox.y1);
|
|
16402
|
+
if (size > maxBBoxSize) {
|
|
16403
|
+
maxBBoxSize = size;
|
|
16404
|
+
maxBBoxI = i;
|
|
16405
|
+
}
|
|
16406
|
+
}
|
|
16384
16407
|
}
|
|
16385
|
-
|
|
16386
|
-
const
|
|
16387
|
-
const
|
|
16388
|
-
|
|
16389
|
-
|
|
16390
|
-
|
|
16408
|
+
if (['top', 'bottom', 'left', 'right'].includes(p)) {
|
|
16409
|
+
const isVerticalPosition = p === 'top' || p === 'bottom';
|
|
16410
|
+
const isHorizontalPosition = p === 'left' || p === 'right';
|
|
16411
|
+
let mainDirectionOverlap = false;
|
|
16412
|
+
if (isVerticalPosition) {
|
|
16413
|
+
mainDirectionOverlap = (p === 'top' && b.y1 < 0) || (p === 'bottom' && b.y2 > stageBounds.y2);
|
|
16414
|
+
}
|
|
16415
|
+
else if (isHorizontalPosition) {
|
|
16416
|
+
mainDirectionOverlap = (p === 'left' && b.x1 < 0) || (p === 'right' && b.x2 > stageBounds.x2);
|
|
16417
|
+
}
|
|
16418
|
+
if (!mainDirectionOverlap) {
|
|
16419
|
+
let secondaryOffset = 0;
|
|
16420
|
+
const szNumber = (isArray(symbolSize) ? symbolSize[1] : symbolSize) / 2;
|
|
16421
|
+
if (isVerticalPosition) {
|
|
16422
|
+
if (b.x1 < 0) {
|
|
16423
|
+
secondaryOffset = -b.x1;
|
|
16424
|
+
}
|
|
16425
|
+
else if (b.x2 > stageBounds.x2) {
|
|
16426
|
+
secondaryOffset = stageBounds.x2 - b.x2;
|
|
16427
|
+
}
|
|
16428
|
+
group.setAttribute('x', group.attribute.x + secondaryOffset);
|
|
16429
|
+
bgSymbol.setAttribute('dx', min(max(bgSymbol.attribute.dx - secondaryOffset, szNumber), b.width() - szNumber));
|
|
16430
|
+
}
|
|
16431
|
+
else if (isHorizontalPosition) {
|
|
16432
|
+
if (b.y1 < 0) {
|
|
16433
|
+
secondaryOffset = -b.y1;
|
|
16434
|
+
}
|
|
16435
|
+
else if (b.y2 > stageBounds.y2) {
|
|
16436
|
+
secondaryOffset = stageBounds.y2 - b.y2;
|
|
16437
|
+
}
|
|
16438
|
+
group.setAttribute('y', group.attribute.y + secondaryOffset);
|
|
16439
|
+
bgSymbol.setAttribute('dy', min(max(bgSymbol.attribute.dy - secondaryOffset, szNumber), b.height() - szNumber));
|
|
16440
|
+
}
|
|
16441
|
+
break;
|
|
16391
16442
|
}
|
|
16392
16443
|
}
|
|
16444
|
+
if (!layout) {
|
|
16445
|
+
break;
|
|
16446
|
+
}
|
|
16393
16447
|
}
|
|
16394
16448
|
else {
|
|
16395
16449
|
break;
|
|
16396
16450
|
}
|
|
16397
16451
|
}
|
|
16398
16452
|
}
|
|
16453
|
+
calculateAnchorPoint(position, positionBounds) {
|
|
16454
|
+
if (!positionBounds) {
|
|
16455
|
+
return { x: 0, y: 0 };
|
|
16456
|
+
}
|
|
16457
|
+
const { x, y } = this.attribute;
|
|
16458
|
+
const { x1, y1, x2, y2 } = positionBounds;
|
|
16459
|
+
const width = x2 - x1;
|
|
16460
|
+
const height = y2 - y1;
|
|
16461
|
+
switch (position) {
|
|
16462
|
+
case 'top':
|
|
16463
|
+
case 'tl':
|
|
16464
|
+
case 'tr':
|
|
16465
|
+
return { x: x1 + width / 2 - x, y: y1 - y };
|
|
16466
|
+
case 'bottom':
|
|
16467
|
+
case 'bl':
|
|
16468
|
+
case 'br':
|
|
16469
|
+
return { x: x1 + width / 2 - x, y: y2 - y };
|
|
16470
|
+
case 'left':
|
|
16471
|
+
case 'lt':
|
|
16472
|
+
case 'lb':
|
|
16473
|
+
return { x: x1 - x, y: y1 + height / 2 - y };
|
|
16474
|
+
case 'right':
|
|
16475
|
+
case 'rt':
|
|
16476
|
+
case 'rb':
|
|
16477
|
+
return { x: x2 - x, y: y1 + height / 2 - y };
|
|
16478
|
+
default:
|
|
16479
|
+
return { x: 0, y: 0 };
|
|
16480
|
+
}
|
|
16481
|
+
}
|
|
16399
16482
|
getAngleAndOffset(position, width, height, size, symbolType) {
|
|
16400
16483
|
const sizeH = symbolType === 'arrow2Left' ? size[1] / 2 : size[1];
|
|
16401
16484
|
switch (position) {
|
|
@@ -16527,7 +16610,7 @@ let PopTipRenderContribution = class PopTipRenderContribution {
|
|
|
16527
16610
|
poptip.content = (_a = poptip.content) !== null && _a !== void 0 ? _a : graphic.attribute.text;
|
|
16528
16611
|
}
|
|
16529
16612
|
const matrix = graphic.globalTransMatrix;
|
|
16530
|
-
this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false }, poptip), { x: matrix.e, y: matrix.f }));
|
|
16613
|
+
this.poptipComponent.setAttributes(Object.assign(Object.assign({ visibleAll: true, pickable: false, childrenPickable: false, poptipAnchor: 'bounds' }, poptip), { x: matrix.e, y: matrix.f, positionBounds: graphic.globalAABBBounds }));
|
|
16531
16614
|
drawContext.stage.tryInitInteractiveLayer();
|
|
16532
16615
|
const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');
|
|
16533
16616
|
if (interactiveLayer) {
|
|
@@ -27222,17 +27305,23 @@ class Slider extends AbstractComponent {
|
|
|
27222
27305
|
};
|
|
27223
27306
|
this._onHandlerPointerdown = (e) => {
|
|
27224
27307
|
e.stopPropagation();
|
|
27225
|
-
this._clearAllDragEvents();
|
|
27226
27308
|
this._isChanging = true;
|
|
27227
27309
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27228
27310
|
this._currentHandler = e.target;
|
|
27229
27311
|
this._prePos = this._isHorizontal ? x : y;
|
|
27230
|
-
|
|
27231
|
-
|
|
27232
|
-
|
|
27233
|
-
|
|
27234
|
-
|
|
27235
|
-
}
|
|
27312
|
+
if (vglobal.env === 'browser') {
|
|
27313
|
+
vglobal.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27314
|
+
capture: true
|
|
27315
|
+
});
|
|
27316
|
+
vglobal.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27317
|
+
}
|
|
27318
|
+
else {
|
|
27319
|
+
this.stage.addEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27320
|
+
capture: true
|
|
27321
|
+
});
|
|
27322
|
+
this.stage.addEventListener('pointerup', this._onHandlerPointerUp);
|
|
27323
|
+
this.stage.addEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27324
|
+
}
|
|
27236
27325
|
};
|
|
27237
27326
|
this._onHandlerPointerMove = (e) => {
|
|
27238
27327
|
var _a, _b;
|
|
@@ -27275,20 +27364,38 @@ class Slider extends AbstractComponent {
|
|
|
27275
27364
|
e.preventDefault();
|
|
27276
27365
|
this._isChanging = false;
|
|
27277
27366
|
this._currentHandler = null;
|
|
27278
|
-
|
|
27367
|
+
if (vglobal.env === 'browser') {
|
|
27368
|
+
vglobal.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27369
|
+
capture: true
|
|
27370
|
+
});
|
|
27371
|
+
vglobal.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27372
|
+
}
|
|
27373
|
+
else {
|
|
27374
|
+
this.stage.removeEventListener('pointermove', this._onHandlerPointerMove, {
|
|
27375
|
+
capture: true
|
|
27376
|
+
});
|
|
27377
|
+
this.stage.removeEventListener('pointerup', this._onHandlerPointerUp);
|
|
27378
|
+
this.stage.removeEventListener('pointerupoutside', this._onHandlerPointerUp);
|
|
27379
|
+
}
|
|
27279
27380
|
};
|
|
27280
27381
|
this._onTrackPointerdown = (e) => {
|
|
27281
27382
|
e.stopPropagation();
|
|
27282
|
-
this._clearAllDragEvents();
|
|
27283
27383
|
this._isChanging = true;
|
|
27284
27384
|
const { x, y } = this.stage.eventPointTransform(e);
|
|
27285
27385
|
this._prePos = this._isHorizontal ? x : y;
|
|
27286
|
-
|
|
27287
|
-
|
|
27288
|
-
|
|
27289
|
-
|
|
27290
|
-
|
|
27291
|
-
}
|
|
27386
|
+
if (vglobal.env === 'browser') {
|
|
27387
|
+
vglobal.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27388
|
+
capture: true
|
|
27389
|
+
});
|
|
27390
|
+
vglobal.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27391
|
+
}
|
|
27392
|
+
else {
|
|
27393
|
+
this.stage.addEventListener('pointermove', this._onTrackPointerMove, {
|
|
27394
|
+
capture: true
|
|
27395
|
+
});
|
|
27396
|
+
this.stage.addEventListener('pointerup', this._onTrackPointerUp);
|
|
27397
|
+
this.stage.addEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27398
|
+
}
|
|
27292
27399
|
};
|
|
27293
27400
|
this._onTrackPointerMove = (e) => {
|
|
27294
27401
|
e.stopPropagation();
|
|
@@ -27345,11 +27452,22 @@ class Slider extends AbstractComponent {
|
|
|
27345
27452
|
this._onTrackPointerUp = (e) => {
|
|
27346
27453
|
e.preventDefault();
|
|
27347
27454
|
this._isChanging = false;
|
|
27348
|
-
|
|
27455
|
+
if (vglobal.env === 'browser') {
|
|
27456
|
+
vglobal.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27457
|
+
capture: true
|
|
27458
|
+
});
|
|
27459
|
+
vglobal.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27460
|
+
}
|
|
27461
|
+
else {
|
|
27462
|
+
this.stage.removeEventListener('pointermove', this._onTrackPointerMove, {
|
|
27463
|
+
capture: true
|
|
27464
|
+
});
|
|
27465
|
+
this.stage.removeEventListener('pointerup', this._onTrackPointerUp);
|
|
27466
|
+
this.stage.removeEventListener('pointerupoutside', this._onTrackPointerUp);
|
|
27467
|
+
}
|
|
27349
27468
|
};
|
|
27350
27469
|
this._onRailPointerDown = (e) => {
|
|
27351
27470
|
e.stopPropagation();
|
|
27352
|
-
this._clearAllDragEvents();
|
|
27353
27471
|
this._isChanging = true;
|
|
27354
27472
|
const { railWidth, railHeight, min, max } = this.attribute;
|
|
27355
27473
|
if (max === min) {
|
|
@@ -27737,18 +27855,6 @@ class Slider extends AbstractComponent {
|
|
|
27737
27855
|
this._mainContainer.addEventListener('pointermove', this._onTooltipUpdate);
|
|
27738
27856
|
this._mainContainer.addEventListener('pointerleave', this._onTooltipHide);
|
|
27739
27857
|
}
|
|
27740
|
-
_clearAllDragEvents() {
|
|
27741
|
-
const triggers = getEndTriggersOfDrag();
|
|
27742
|
-
const obj = vglobal.env === 'browser' ? vglobal : this.stage;
|
|
27743
|
-
obj.removeEventListener('pointermove', this._onHandlerPointerMove, { capture: true });
|
|
27744
|
-
triggers.forEach((trigger) => {
|
|
27745
|
-
obj.removeEventListener(trigger, this._onHandlerPointerUp);
|
|
27746
|
-
});
|
|
27747
|
-
obj.removeEventListener('pointermove', this._onTrackPointerMove, { capture: true });
|
|
27748
|
-
triggers.forEach((trigger) => {
|
|
27749
|
-
obj.removeEventListener(trigger, this._onTrackPointerUp);
|
|
27750
|
-
});
|
|
27751
|
-
}
|
|
27752
27858
|
_updateTrack() {
|
|
27753
27859
|
const { inverse, railWidth, railHeight } = this.attribute;
|
|
27754
27860
|
const startHandler = this._startHandler;
|
|
@@ -31241,10 +31347,10 @@ class Switch extends AbstractComponent {
|
|
|
31241
31347
|
});
|
|
31242
31348
|
this._circle.setAttributes({
|
|
31243
31349
|
y: circleY,
|
|
31244
|
-
x: this.attribute.checked ? circleX : maxWidth - circleX
|
|
31350
|
+
x: !this.attribute.checked ? circleX : maxWidth - circleX
|
|
31245
31351
|
});
|
|
31246
31352
|
this._text.setAttributes({
|
|
31247
|
-
x: this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
31353
|
+
x: !this.attribute.checked ? textX : maxWidth - textX - textWidth,
|
|
31248
31354
|
y: textY
|
|
31249
31355
|
});
|
|
31250
31356
|
}
|
|
@@ -31482,6 +31588,6 @@ StoryLabelItem.defaultAttributes = {
|
|
|
31482
31588
|
theme: 'default'
|
|
31483
31589
|
};
|
|
31484
31590
|
|
|
31485
|
-
const version = "0.22.7-alpha.
|
|
31591
|
+
const version = "0.22.7-alpha.5";
|
|
31486
31592
|
|
|
31487
31593
|
export { AXIS_ELEMENT_NAME, AbstractComponent, ArcInfo, ArcLabel, ArcSegment, AxisStateValue, BasePlayer, Brush, CheckBox, CircleAxis, CircleAxisGrid, CircleCrosshair, ColorContinuousLegend, ContinuousPlayer, DEFAULT_ITEM_SPACE_COL, DEFAULT_ITEM_SPACE_ROW, DEFAULT_LABEL_SPACE, DEFAULT_PAGER_SPACE, DEFAULT_SHAPE_SIZE, DEFAULT_SHAPE_SPACE, DEFAULT_STATES$1 as DEFAULT_STATES, DEFAULT_TITLE_SPACE, DEFAULT_VALUE_SPACE, DataLabel, DataZoom, DataZoomActiveTag, DirectionEnum, DiscreteLegend, DiscretePlayer, EmptyTip, GroupTransition, IMarkAreaLabelPosition, IMarkCommonArcLabelPosition, IMarkLineLabelPosition, IMarkPointItemPosition, IOperateType, Indicator, LEGEND_ELEMENT_NAME, LabelBase, LegendEvent, LegendStateValue, LineAxis, LineAxisGrid, LineCrosshair, LineLabel, LinkPath, MarkArcArea, MarkArcLine, MarkArea, MarkLine, MarkPoint, Pager, PlayerEventEnum, PolygonCrosshair, PolygonSectorCrosshair, PopTip, Radio, RectCrosshair, RectLabel, SLIDER_ELEMENT_NAME, ScrollBar, SectorCrosshair, Segment, SizeContinuousLegend, Slider, StoryLabelItem, Switch, SymbolLabel, Tag, Timeline, Title, Tooltip, TopZIndex, VTag, WeatherBox, alignTextInLine, angle, angleLabelOrientAttribute, angleTo, cartesianTicks, clampRadian, computeOffsetForlimit, continuousTicks, contrastAccessibilityChecker, convertDomainToTickData, createTextGraphicByType, deltaXYToAngle, fuzzyEqualNumber, getAxisBreakSymbolAttrs, getCircleLabelPosition, getCirclePoints, getCircleVerticalVector, getElMap, getHorizontalPath, getMarksByName, getNoneGroupMarksByName, getPolarAngleLabelPosition, getPolygonPath, getSizeHandlerPath, getTextAlignAttrOfVerticalDir, getTextType, getVerticalCoord, getVerticalPath, hasOverlap, htmlAttributeTransform, initTextMeasure, isInRange, isPostiveXAxis, isRichText, isVisible, labelSmartInvert, length, limitShapeInBounds, linearDiscreteTicks, loadPoptip, loadScrollbar, measureTextSize, normalize, polarAngleAxisDiscreteTicks, polarTicks, reactAttributeTransform, registerArcDataLabel, registerLineDataLabel, registerMarkArcAreaAnimate, registerMarkArcLineAnimate, registerMarkAreaAnimate, registerMarkLineAnimate, registerMarkPointAnimate, registerRectDataLabel, registerSymbolDataLabel, removeRepeatPoint, richTextAttributeTransform, scale, scrollbarModule, setPoptipTheme, smartInvertStrategy, tan2AngleToAngle, textIntersect, ticks, traverseGroup, version };
|
package/es/crosshair/base.js
CHANGED
package/es/crosshair/type.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { };
|
|
1
|
+
export { };
|
|
2
|
+
//# sourceMappingURL=type.js.map
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.7-alpha.
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.22.7-alpha.5\";\n\nexport * from './core/base';\nexport * from './core/type';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\nexport * from './axis/grid';\nexport * from './segment';\nexport * from './data-zoom';\nexport * from './marker';\nexport * from './pager';\nexport * from './legend';\nexport * from './title';\nexport * from './indicator';\nexport * from './slider';\nexport * from './link-path';\nexport * from './player';\nexport * from './brush';\nexport * from './tooltip';\nexport * from './timeline';\nexport * from './interface';\nexport * from './jsx';\nexport * from './checkbox';\nexport * from './radio';\nexport * from './empty-tip';\nexport * from './weather';\nexport * from './util';\nexport * from './switch';\nexport * from './label-item';\n"]}
|
|
@@ -34,10 +34,12 @@ let PopTipRenderContribution = class {
|
|
|
34
34
|
this.poptipComponent.setAttributes(Object.assign(Object.assign({
|
|
35
35
|
visibleAll: !0,
|
|
36
36
|
pickable: !1,
|
|
37
|
-
childrenPickable: !1
|
|
37
|
+
childrenPickable: !1,
|
|
38
|
+
poptipAnchor: "bounds"
|
|
38
39
|
}, poptip), {
|
|
39
40
|
x: matrix.e,
|
|
40
|
-
y: matrix.f
|
|
41
|
+
y: matrix.f,
|
|
42
|
+
positionBounds: graphic.globalAABBBounds
|
|
41
43
|
})), drawContext.stage.tryInitInteractiveLayer();
|
|
42
44
|
const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
|
|
43
45
|
interactiveLayer && interactiveLayer.add(this.poptipComponent);
|