@visactor/vrender-components 0.13.2-alpha.2 → 0.13.2
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/core/type.js +1 -2
- package/cjs/crosshair/circle.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/indicator/type.js +1 -2
- package/cjs/label/symbol.js +2 -1
- package/cjs/marker/area.js +1 -1
- package/cjs/marker/base.js +1 -2
- package/cjs/marker/config.js +1 -1
- package/cjs/marker/index.js +1 -1
- package/cjs/marker/line.js +1 -1
- package/cjs/marker/point.js +1 -1
- package/cjs/marker/type.js +1 -1
- package/cjs/pager/pager.js +2 -1
- package/cjs/pager/type.js +1 -1
- package/cjs/player/base-player.js +1 -1
- package/cjs/player/constant.js +1 -1
- package/cjs/player/continuous-player.js +1 -1
- package/cjs/player/discrete-player.js +1 -1
- package/cjs/player/index.js +1 -1
- package/cjs/player/utils.js +1 -1
- package/cjs/poptip/contribution.js +25 -9
- package/cjs/poptip/contribution.js.map +1 -1
- package/cjs/poptip/poptip-plugin.d.ts +13 -0
- package/cjs/poptip/poptip-plugin.js +39 -5
- package/cjs/poptip/poptip-plugin.js.map +1 -1
- package/cjs/poptip/register.d.ts +2 -1
- package/cjs/poptip/register.js +7 -6
- package/cjs/poptip/register.js.map +1 -1
- package/cjs/poptip/theme.d.ts +4 -0
- package/cjs/poptip/theme.js +26 -0
- package/cjs/poptip/theme.js.map +1 -0
- package/dist/index.js +117 -13
- package/dist/index.min.js +1 -1
- package/es/core/type.js +1 -2
- package/es/crosshair/circle.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/indicator/type.js +1 -2
- package/es/label/symbol.js +2 -1
- package/es/marker/area.js +1 -1
- package/es/marker/base.js +1 -2
- package/es/marker/config.js +1 -1
- package/es/marker/index.js +1 -1
- package/es/marker/line.js +1 -1
- package/es/marker/point.js +1 -1
- package/es/marker/type.js +1 -1
- package/es/pager/pager.js +2 -1
- package/es/pager/type.js +1 -1
- package/es/player/base-player.js +1 -1
- package/es/player/constant.js +1 -1
- package/es/player/continuous-player.js +1 -1
- package/es/player/discrete-player.js +1 -1
- package/es/player/index.js +1 -1
- package/es/player/utils.js +1 -1
- package/es/poptip/contribution.js +28 -8
- package/es/poptip/contribution.js.map +1 -1
- package/es/poptip/poptip-plugin.d.ts +13 -0
- package/es/poptip/poptip-plugin.js +39 -4
- package/es/poptip/poptip-plugin.js.map +1 -1
- package/es/poptip/register.d.ts +2 -1
- package/es/poptip/register.js +9 -4
- package/es/poptip/register.js.map +1 -1
- package/es/poptip/theme.d.ts +4 -0
- package/es/poptip/theme.js +22 -0
- package/es/poptip/theme.js.map +1 -0
- package/package.json +4 -4
- package/dist/vrender-components.js.js +0 -1
- package/dist/vrender-components.js.min.js +0 -1
package/cjs/core/type.js
CHANGED
package/cjs/crosshair/circle.js
CHANGED
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
17
17
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
|
-
}), exports.version = void 0, exports.version = "0.13.2
|
|
20
|
+
}), exports.version = void 0, exports.version = "0.13.2", __exportStar(require("./core/base"), exports),
|
|
21
21
|
__exportStar(require("./scrollbar"), exports), __exportStar(require("./tag"), exports),
|
|
22
22
|
__exportStar(require("./poptip"), exports), __exportStar(require("./crosshair"), exports),
|
|
23
23
|
__exportStar(require("./label"), exports), __exportStar(require("./axis"), exports),
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,QAAQ,CAAC;AAEhC,8CAA4B;AAC5B,8CAA4B;AAC5B,wCAAsB;AACtB,2CAAyB;AACzB,8CAA4B;AAC5B,0CAAwB;AACxB,yCAAuB;AACvB,4CAA0B;AAC1B,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB;AACzB,0CAAwB;AACxB,8CAA4B;AAC5B,2CAAyB;AACzB,8CAA4B;AAC5B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,8CAA4B","file":"index.js","sourcesContent":["// 导出版本号\nexport const version = \"0.13.2\";\n\nexport * from './core/base';\nexport * from './scrollbar';\nexport * from './tag';\nexport * from './poptip';\nexport * from './crosshair';\nexport * from './label';\nexport * from './axis';\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 './interface';\n"]}
|
package/cjs/indicator/type.js
CHANGED
package/cjs/label/symbol.js
CHANGED
package/cjs/marker/area.js
CHANGED
package/cjs/marker/base.js
CHANGED
package/cjs/marker/config.js
CHANGED
package/cjs/marker/index.js
CHANGED
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./type"), exports), __exportStar(require("./line"), exports),
|
|
21
21
|
__exportStar(require("./area"), exports), __exportStar(require("./point"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/marker/line.js
CHANGED
package/cjs/marker/point.js
CHANGED
package/cjs/marker/type.js
CHANGED
|
@@ -23,4 +23,4 @@ function(IMarkPointItemPosition) {
|
|
|
23
23
|
IMarkPointItemPosition.insideTop = "insideTop", IMarkPointItemPosition.insideBottom = "insideBottom",
|
|
24
24
|
IMarkPointItemPosition.insideMiddle = "insideMiddle";
|
|
25
25
|
}(IMarkPointItemPosition = exports.IMarkPointItemPosition || (exports.IMarkPointItemPosition = {}));
|
|
26
|
-
//# sourceMappingURL=type.js.map
|
|
26
|
+
//# sourceMappingURL=type.js.map
|
package/cjs/pager/pager.js
CHANGED
package/cjs/pager/type.js
CHANGED
package/cjs/player/constant.js
CHANGED
package/cjs/player/index.js
CHANGED
|
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
19
19
|
value: !0
|
|
20
20
|
}), __exportStar(require("./base-player"), exports), __exportStar(require("./type"), exports),
|
|
21
21
|
__exportStar(require("./discrete-player"), exports), __exportStar(require("./continuous-player"), exports);
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/player/utils.js
CHANGED
|
@@ -71,4 +71,4 @@ exports.isHorizontal = isHorizontal;
|
|
|
71
71
|
const forwardStep = (direction, currentIndex, min, max) => "default" === direction ? Math.min(currentIndex + 1, max) : Math.max(currentIndex - 1, min);
|
|
72
72
|
|
|
73
73
|
exports.forwardStep = forwardStep;
|
|
74
|
-
//# sourceMappingURL=utils.js.map
|
|
74
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -10,22 +10,38 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
10
10
|
value: !0
|
|
11
11
|
}), exports.PopTipRenderContribution = void 0;
|
|
12
12
|
|
|
13
|
-
const inversify_1 = require("inversify"), poptip_1 = require("./poptip");
|
|
13
|
+
const inversify_1 = require("inversify"), poptip_1 = require("./poptip"), vutils_1 = require("@visactor/vutils"), theme_1 = require("./theme");
|
|
14
|
+
|
|
15
|
+
function wrapPoptip(target, source) {
|
|
16
|
+
return (0, vutils_1.merge)(target, theme_1.theme.poptip, source), target;
|
|
17
|
+
}
|
|
14
18
|
|
|
15
19
|
let PopTipRenderContribution = class {
|
|
16
20
|
render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
|
|
17
|
-
|
|
18
|
-
|
|
21
|
+
var _a;
|
|
22
|
+
if (1 === graphic._showPoptip) {
|
|
23
|
+
const {visible: visible, visibleCb: visibleCb} = graphic.attribute.poptip || {};
|
|
19
24
|
if (!1 === visible || visibleCb && !1 === visibleCb(graphic)) return;
|
|
20
|
-
this.poptipComponent || (this.poptipComponent = new poptip_1.PopTip(graphic.attribute.poptip))
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
+
this.poptipComponent || (this.poptipComponent = new poptip_1.PopTip(graphic.attribute.poptip));
|
|
26
|
+
let poptip = graphic.attribute.poptip || {};
|
|
27
|
+
if ("text" === graphic.type && null == poptip.title && null == poptip.content) {
|
|
28
|
+
const out = {};
|
|
29
|
+
wrapPoptip(out, poptip), poptip = out, poptip.content = null !== (_a = poptip.content) && void 0 !== _a ? _a : graphic.attribute.text;
|
|
30
|
+
}
|
|
31
|
+
const matrix = graphic.globalTransMatrix;
|
|
32
|
+
this.poptipComponent.setAttributes(Object.assign(Object.assign({
|
|
33
|
+
visibleAll: !0,
|
|
34
|
+
pickable: !1,
|
|
35
|
+
childrenPickable: !1
|
|
36
|
+
}, poptip), {
|
|
37
|
+
x: matrix.e,
|
|
38
|
+
y: matrix.f
|
|
25
39
|
}));
|
|
26
40
|
const interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
|
|
27
41
|
interactiveLayer && interactiveLayer.add(this.poptipComponent);
|
|
28
|
-
}
|
|
42
|
+
} else 2 === graphic._showPoptip && (graphic._showPoptip = 0, this.poptipComponent && this.poptipComponent.setAttributes({
|
|
43
|
+
visibleAll: !1
|
|
44
|
+
}));
|
|
29
45
|
}
|
|
30
46
|
};
|
|
31
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["poptip/contribution.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAuC;AASvC,qCAAkC;
|
|
1
|
+
{"version":3,"sources":["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,MAAM,CAAC,OAAO,mCAAK,OAAO,CAAC,SAAiB,CAAC,IAAI,CAAC;aACpE;YACD,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;YACzC,IAAI,CAAC,eAAe,CAAC,aAAa,+BAChC,UAAU,EAAE,IAAI,EAChB,QAAQ,EAAE,KAAK,EACf,gBAAgB,EAAE,KAAK,IACpB,MAAM,KACT,CAAC,EAAE,MAAM,CAAC,CAAC,EACX,CAAC,EAAE,MAAM,CAAC,CAAC,IACX,CAAC;YAEH,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,sBAAsB,CAAC,CAAC;YAC5E,IAAI,gBAAgB,EAAE;gBACpB,gBAAgB,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;aAC5C;SACF;aAAM,IAAI,OAAO,CAAC,WAAW,KAAK,CAAC,EAAE;YACpC,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;YACxB,IAAI,CAAC,eAAe;gBAClB,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC;oBACjC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC;SACN;IACH,CAAC;CACF,CAAA;AAvDY,wBAAwB;IADpC,IAAA,sBAAU,GAAE;GACA,wBAAwB,CAuDpC;AAvDY,4DAAwB","file":"contribution.js","sourcesContent":["import { injectable } from 'inversify';\nimport type {\n IContext2d,\n IGraphic,\n IGraphicAttribute,\n IInteractiveSubRenderContribution,\n IThemeAttribute,\n IDrawContext\n} from '@visactor/vrender';\nimport { PopTip } from './poptip';\nimport { merge } from '@visactor/vutils';\nimport { theme } from './theme';\n\nfunction wrapPoptip(target: Record<string, any>, source: Record<string, any>) {\n merge(target, theme.poptip, source);\n return target;\n}\n\n@injectable()\nexport class PopTipRenderContribution implements IInteractiveSubRenderContribution {\n declare poptipComponent: PopTip;\n render(\n graphic: IGraphic<Partial<IGraphicAttribute>>,\n context: IContext2d,\n x: number,\n y: number,\n doFill: boolean,\n doStroke: boolean,\n fVisible: boolean,\n sVisible: boolean,\n graphicAttribute: Required<IGraphicAttribute>,\n drawContext: IDrawContext,\n fillCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n strokeCb?: (ctx: IContext2d, markAttribute: Partial<IGraphicAttribute>, themeAttribute: IThemeAttribute) => boolean,\n options?: any\n ): void {\n if (graphic._showPoptip === 1) {\n const { visible, visibleCb } = (graphic.attribute as any).poptip || {};\n if (visible === false || (visibleCb && visibleCb(graphic) === false)) {\n return;\n }\n if (!this.poptipComponent) {\n this.poptipComponent = new PopTip((graphic.attribute as any).poptip);\n }\n // 如果text图元没有配置title和content的话\n let poptip = (graphic.attribute as any).poptip || {};\n if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {\n const out = {};\n wrapPoptip(out, poptip);\n poptip = out;\n poptip.content = poptip.content ?? (graphic.attribute as any).text;\n }\n const matrix = graphic.globalTransMatrix;\n this.poptipComponent.setAttributes({\n visibleAll: true,\n pickable: false,\n childrenPickable: false,\n ...poptip,\n x: matrix.e,\n y: matrix.f\n });\n // 添加到交互层中\n const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');\n if (interactiveLayer) {\n interactiveLayer.add(this.poptipComponent);\n }\n } else if (graphic._showPoptip === 2) {\n graphic._showPoptip = 0;\n this.poptipComponent &&\n this.poptipComponent.setAttributes({\n visibleAll: false\n });\n }\n }\n}\n"]}
|
|
@@ -12,3 +12,16 @@ export declare class PopTipPlugin implements IPlugin {
|
|
|
12
12
|
setActiveGraphic(graphic: any | null, rerender?: boolean): void;
|
|
13
13
|
deactivate(context: IPluginService): void;
|
|
14
14
|
}
|
|
15
|
+
export declare class PopTipForClipedTextPlugin implements IPlugin {
|
|
16
|
+
name: 'poptipForText';
|
|
17
|
+
activeEvent: 'onRegister';
|
|
18
|
+
pluginService: IPluginService;
|
|
19
|
+
_uid: number;
|
|
20
|
+
key: string;
|
|
21
|
+
activeGraphic: IGraphic;
|
|
22
|
+
activate(context: IPluginService): void;
|
|
23
|
+
poptip: (e: FederatedPointerEvent) => void;
|
|
24
|
+
unpoptip: (e: FederatedPointerEvent) => void;
|
|
25
|
+
setActiveGraphic(graphic: any | null, rerender?: boolean): void;
|
|
26
|
+
deactivate(context: IPluginService): void;
|
|
27
|
+
}
|
|
@@ -8,7 +8,7 @@ var __decorate = this && this.__decorate || function(decorators, target, key, de
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", {
|
|
10
10
|
value: !0
|
|
11
|
-
}), exports.PopTipPlugin = void 0;
|
|
11
|
+
}), exports.PopTipForClipedTextPlugin = exports.PopTipPlugin = void 0;
|
|
12
12
|
|
|
13
13
|
const inversify_1 = require("inversify"), vrender_1 = require("@visactor/vrender");
|
|
14
14
|
|
|
@@ -17,12 +17,14 @@ let PopTipPlugin = class {
|
|
|
17
17
|
this.name = "poptip", this.activeEvent = "onRegister", this._uid = vrender_1.Generator.GenAutoIncrementId(),
|
|
18
18
|
this.key = this.name + this._uid, this.poptip = e => {
|
|
19
19
|
const graphic = e.target;
|
|
20
|
-
if (graphic.isContainer || !graphic.attribute
|
|
20
|
+
if (graphic.isContainer || !graphic.attribute) return void this.unpoptip(e);
|
|
21
|
+
if (graphic === this.activeGraphic) return;
|
|
21
22
|
const {poptip: poptip} = graphic.attribute;
|
|
22
|
-
poptip && (graphic._showPoptip =
|
|
23
|
-
this.setActiveGraphic(graphic, !0);
|
|
23
|
+
poptip && (graphic.setAttributes({}), graphic._showPoptip = 1), this.activeGraphic && (this.activeGraphic.setAttributes({}),
|
|
24
|
+
this.activeGraphic._showPoptip = 2), this.setActiveGraphic(graphic, !0);
|
|
24
25
|
}, this.unpoptip = e => {
|
|
25
|
-
this.activeGraphic && (this.activeGraphic._showPoptip =
|
|
26
|
+
this.activeGraphic && (this.activeGraphic.setAttributes({}), this.activeGraphic._showPoptip = 2,
|
|
27
|
+
this.setActiveGraphic(null, !0));
|
|
26
28
|
};
|
|
27
29
|
}
|
|
28
30
|
activate(context) {
|
|
@@ -40,4 +42,36 @@ let PopTipPlugin = class {
|
|
|
40
42
|
};
|
|
41
43
|
|
|
42
44
|
PopTipPlugin = __decorate([ (0, inversify_1.injectable)() ], PopTipPlugin), exports.PopTipPlugin = PopTipPlugin;
|
|
45
|
+
|
|
46
|
+
let PopTipForClipedTextPlugin = class {
|
|
47
|
+
constructor() {
|
|
48
|
+
this.name = "poptipForText", this.activeEvent = "onRegister", this._uid = vrender_1.Generator.GenAutoIncrementId(),
|
|
49
|
+
this.key = this.name + this._uid, this.poptip = e => {
|
|
50
|
+
const graphic = e.target;
|
|
51
|
+
if ("text" !== graphic.type || !graphic.cliped || graphic.isContainer || !graphic.attribute) return void this.unpoptip(e);
|
|
52
|
+
if (graphic === this.activeGraphic) return;
|
|
53
|
+
const {poptip: poptip = {}} = graphic.attribute;
|
|
54
|
+
poptip && (graphic.setAttributes({}), graphic._showPoptip = 1), this.activeGraphic && (this.activeGraphic.setAttributes({}),
|
|
55
|
+
this.activeGraphic._showPoptip = 2), this.setActiveGraphic(graphic, !0);
|
|
56
|
+
}, this.unpoptip = e => {
|
|
57
|
+
this.activeGraphic && (this.activeGraphic.setAttributes({}), this.activeGraphic._showPoptip = 2,
|
|
58
|
+
this.setActiveGraphic(null, !0));
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
activate(context) {
|
|
62
|
+
this.pluginService = context;
|
|
63
|
+
const {stage: stage} = this.pluginService;
|
|
64
|
+
stage.addEventListener("pointerover", this.poptip);
|
|
65
|
+
}
|
|
66
|
+
setActiveGraphic(graphic, rerender) {
|
|
67
|
+
this.activeGraphic = graphic, this.pluginService.stage.renderNextFrame();
|
|
68
|
+
}
|
|
69
|
+
deactivate(context) {
|
|
70
|
+
const {stage: stage} = this.pluginService;
|
|
71
|
+
stage.removeEventListener("pointerover", this.poptip);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
PopTipForClipedTextPlugin = __decorate([ (0, inversify_1.injectable)() ], PopTipForClipedTextPlugin),
|
|
76
|
+
exports.PopTipForClipedTextPlugin = PopTipForClipedTextPlugin;
|
|
43
77
|
//# sourceMappingURL=poptip-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["poptip/poptip-plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAuC;AAEvC,+CAA8C;
|
|
1
|
+
{"version":3,"sources":["poptip/poptip-plugin.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAuC;AAEvC,+CAA8C;AAKvC,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;QACL,SAAI,GAAa,QAAQ,CAAC;QAC1B,gBAAW,GAAiB,YAAY,CAAC;QAEzC,SAAI,GAAW,mBAAS,CAAC,kBAAkB,EAAE,CAAC;QAC9C,QAAG,GAAW,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;QASpC,WAAM,GAAG,CAAC,CAAwB,EAAE,EAAE;YACpC,MAAM,OAAO,GAAG,CAAC,CAAC,MAAa,CAAC;YAChC,IAAI,OAAO,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE;gBAC7C,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;gBACjB,OAAO;aACR;YAED,IAAI,OAAO,KAAK,IAAI,CAAC,aAAa,EAAE;gBAClC,OAAO;aACR;YACD,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,SAAS,CAAC;YACrC,IAAI,MAAM,EAAE;gBACV,OAAO,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBAC1B,OAAO,CAAC,WAAW,GAAG,CAAC,CAAC;aACzB;YAED,IAAI,IAAI,CAAC,aAAa,EAAE;gBACtB,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;gBACrC,IAAI,CAAC,aAAa,CAAC,WAAW,GAAG,CAAC,CAAC;aACpC;YAED,IAAI,CAAC,gB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a,CAAC;QAErC,KAAK,CAAC,gBAAgB,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;IAkCD,gBAAgB,CAAC,OAAmB,EAAE,QAAkB;QACtD,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;QAE7B,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC;IAC7C,CAAC;IAED,UAAU,CAAC,OAAuB;QAChC,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,aAAa,CAAC;QACrC,KAAK,CAAC,mBAAmB,CAAC,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AAzDY,yBAAyB;IADrC,IAAA,sBAAU,GAAE;GACA,yBAAyB,CAyDrC;AAzDY,8DAAyB","file":"poptip-plugin.js","sourcesContent":["import { injectable } from 'inversify';\nimport type { FederatedPointerEvent, IGraphic, IPlugin, IPluginService } from '@visactor/vrender';\nimport { Generator } from '@visactor/vrender';\n\n// _showPoptip: 0-没有,1-添加,2-删除\n\n@injectable()\nexport class PopTipPlugin implements IPlugin {\n name: 'poptip' = 'poptip';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n activeGraphic: IGraphic;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const { stage } = this.pluginService;\n\n stage.addEventListener('pointerover', this.poptip);\n }\n poptip = (e: FederatedPointerEvent) => {\n const graphic = e.target as any;\n if (graphic.isContainer || !graphic.attribute) {\n this.unpoptip(e);\n return;\n }\n // 触发graphic重绘\n if (graphic === this.activeGraphic) {\n return;\n }\n const { poptip } = graphic.attribute;\n if (poptip) {\n graphic.setAttributes({});\n graphic._showPoptip = 1;\n }\n\n if (this.activeGraphic) {\n this.activeGraphic.setAttributes({});\n this.activeGraphic._showPoptip = 2;\n }\n // console.log(graphic)\n this.setActiveGraphic(graphic, true);\n };\n\n unpoptip = (e: FederatedPointerEvent) => {\n if (!this.activeGraphic) {\n return;\n }\n this.activeGraphic.setAttributes({});\n this.activeGraphic._showPoptip = 2;\n this.setActiveGraphic(null, true);\n };\n\n setActiveGraphic(graphic: any | null, rerender?: boolean) {\n this.activeGraphic = graphic;\n // 触发重绘\n this.pluginService.stage.renderNextFrame();\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n stage.removeEventListener('pointerover', this.poptip);\n }\n}\n\n@injectable()\nexport class PopTipForClipedTextPlugin implements IPlugin {\n name: 'poptipForText' = 'poptipForText';\n activeEvent: 'onRegister' = 'onRegister';\n pluginService: IPluginService;\n _uid: number = Generator.GenAutoIncrementId();\n key: string = this.name + this._uid;\n activeGraphic: IGraphic;\n\n activate(context: IPluginService): void {\n this.pluginService = context;\n const { stage } = this.pluginService;\n\n stage.addEventListener('pointerover', this.poptip);\n }\n poptip = (e: FederatedPointerEvent) => {\n const graphic = e.target as any;\n if (graphic.type !== 'text' || !graphic.cliped || graphic.isContainer || !graphic.attribute) {\n this.unpoptip(e);\n return;\n }\n // 触发graphic重绘\n if (graphic === this.activeGraphic) {\n return;\n }\n const { poptip = {} } = graphic.attribute;\n if (poptip) {\n graphic.setAttributes({});\n graphic._showPoptip = 1;\n }\n // 添加默认poptip\n if (this.activeGraphic) {\n this.activeGraphic.setAttributes({});\n this.activeGraphic._showPoptip = 2;\n }\n // console.log(graphic)\n this.setActiveGraphic(graphic, true);\n };\n\n unpoptip = (e: FederatedPointerEvent) => {\n if (!this.activeGraphic) {\n return;\n }\n this.activeGraphic.setAttributes({});\n this.activeGraphic._showPoptip = 2;\n this.setActiveGraphic(null, true);\n };\n\n setActiveGraphic(graphic: any | null, rerender?: boolean) {\n this.activeGraphic = graphic;\n // 触发重绘\n this.pluginService.stage.renderNextFrame();\n }\n\n deactivate(context: IPluginService): void {\n const { stage } = this.pluginService;\n stage.removeEventListener('pointerover', this.poptip);\n }\n}\n"]}
|
package/cjs/poptip/register.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { ContainerModule } from 'inversify';
|
|
2
|
+
import type { PopTipAttributes } from './type';
|
|
2
3
|
export declare const module: ContainerModule;
|
|
3
|
-
export declare function
|
|
4
|
+
export declare function loadPoptip(defaultPoptipTheme: PopTipAttributes): void;
|
package/cjs/poptip/register.js
CHANGED
|
@@ -2,16 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: !0
|
|
5
|
-
}), exports.
|
|
5
|
+
}), exports.loadPoptip = exports.module = void 0;
|
|
6
6
|
|
|
7
|
-
const vrender_1 = require("@visactor/vrender"), inversify_1 = require("inversify"), contribution_1 = require("./contribution"), poptip_plugin_1 = require("./poptip-plugin");
|
|
7
|
+
const vrender_1 = require("@visactor/vrender"), inversify_1 = require("inversify"), vutils_1 = require("@visactor/vutils"), contribution_1 = require("./contribution"), poptip_plugin_1 = require("./poptip-plugin"), theme_1 = require("./theme");
|
|
8
8
|
|
|
9
|
-
function
|
|
10
|
-
vrender_1.container.load(exports.module);
|
|
9
|
+
function loadPoptip(defaultPoptipTheme) {
|
|
10
|
+
(0, vutils_1.merge)(theme_1.theme.poptip, defaultPoptipTheme), vrender_1.container.load(exports.module);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
exports.module = new inversify_1.ContainerModule((bind => {
|
|
14
14
|
bind(contribution_1.PopTipRenderContribution).toSelf().inSingletonScope(), bind(vrender_1.InteractiveSubRenderContribution).toService(contribution_1.PopTipRenderContribution),
|
|
15
|
-
bind(poptip_plugin_1.PopTipPlugin).toSelf().inSingletonScope(), bind(vrender_1.AutoEnablePlugins).toService(poptip_plugin_1.PopTipPlugin)
|
|
16
|
-
|
|
15
|
+
bind(poptip_plugin_1.PopTipPlugin).toSelf().inSingletonScope(), bind(vrender_1.AutoEnablePlugins).toService(poptip_plugin_1.PopTipPlugin),
|
|
16
|
+
bind(poptip_plugin_1.PopTipForClipedTextPlugin).toSelf().inSingletonScope(), bind(vrender_1.AutoEnablePlugins).toService(poptip_plugin_1.PopTipForClipedTextPlugin);
|
|
17
|
+
})), exports.loadPoptip = loadPoptip;
|
|
17
18
|
//# sourceMappingURL=register.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["poptip/register.ts"],"names":[],"mappings":";;;AAAA,+CAAmG;AACnG,yCAA4C;AAC5C,iDAA0D;AAC1D,
|
|
1
|
+
{"version":3,"sources":["poptip/register.ts"],"names":[],"mappings":";;;AAAA,+CAAmG;AACnG,yCAA4C;AAC5C,6CAAyC;AACzC,iDAA0D;AAC1D,mDAA0E;AAE1E,mCAAgC;AAEnB,QAAA,MAAM,GAAG,IAAI,2BAAe,CAAC,IAAI,CAAC,EAAE;IAC/C,IAAI,CAAC,uCAAwB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC3D,IAAI,CAAC,0CAAgC,CAAC,CAAC,SAAS,CAAC,uCAAwB,CAAC,CAAC;IAE3E,IAAI,CAAC,4BAAY,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC/C,IAAI,CAAC,2BAAiB,CAAC,CAAC,SAAS,CAAC,4BAAY,CAAC,CAAC;IAEhD,IAAI,CAAC,yCAAyB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC5D,IAAI,CAAC,2BAAiB,CAAC,CAAC,SAAS,CAAC,yCAAyB,CAAC,CAAC;AAC/D,CAAC,CAAC,CAAC;AAEH,SAAgB,UAAU,CAAC,kBAAoC;IAC7D,IAAA,cAAK,EAAC,aAAK,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IACxC,mBAAS,CAAC,IAAI,CAAC,cAAM,CAAC,CAAC;AACzB,CAAC;AAHD,gCAGC","file":"register.js","sourcesContent":["import { container, InteractiveSubRenderContribution, AutoEnablePlugins } from '@visactor/vrender';\nimport { ContainerModule } from 'inversify';\nimport { merge } from '@visactor/vutils';\nimport { PopTipRenderContribution } from './contribution';\nimport { PopTipPlugin, PopTipForClipedTextPlugin } from './poptip-plugin';\nimport type { PopTipAttributes } from './type';\nimport { theme } from './theme';\n\nexport const module = new ContainerModule(bind => {\n bind(PopTipRenderContribution).toSelf().inSingletonScope();\n bind(InteractiveSubRenderContribution).toService(PopTipRenderContribution);\n\n bind(PopTipPlugin).toSelf().inSingletonScope();\n bind(AutoEnablePlugins).toService(PopTipPlugin);\n\n bind(PopTipForClipedTextPlugin).toSelf().inSingletonScope();\n bind(AutoEnablePlugins).toService(PopTipForClipedTextPlugin);\n});\n\nexport function loadPoptip(defaultPoptipTheme: PopTipAttributes) {\n merge(theme.poptip, defaultPoptipTheme);\n container.load(module);\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: !0
|
|
5
|
+
}), exports.theme = void 0, exports.theme = {
|
|
6
|
+
poptip: {
|
|
7
|
+
visible: !0,
|
|
8
|
+
position: "top",
|
|
9
|
+
titleStyle: {
|
|
10
|
+
fontSize: 16,
|
|
11
|
+
fill: "#08979c"
|
|
12
|
+
},
|
|
13
|
+
contentStyle: {
|
|
14
|
+
fontSize: 12,
|
|
15
|
+
fill: "green"
|
|
16
|
+
},
|
|
17
|
+
panel: {
|
|
18
|
+
visible: !0,
|
|
19
|
+
fill: "#e6fffb",
|
|
20
|
+
stroke: "#87e8de",
|
|
21
|
+
lineWidth: 1,
|
|
22
|
+
cornerRadius: 4
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["poptip/theme.ts"],"names":[],"mappings":";;;AAEa,QAAA,KAAK,GAAiC;IACjD,MAAM,EAAE;QACN,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,KAAK;QACf,UAAU,EAAE;YACV,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,SAAS;SAChB;QACD,YAAY,EAAE;YACZ,QAAQ,EAAE,EAAE;YACZ,IAAI,EAAE,OAAO;SACd;QACD,KAAK,EAAE;YACL,OAAO,EAAE,IAAI;YAEb,IAAI,EAAE,SAAS;YAEf,MAAM,EAAE,SAAS;YACjB,SAAS,EAAE,CAAC;YACZ,YAAY,EAAE,CAAC;SAChB;KACF;CACF,CAAC","file":"theme.js","sourcesContent":["import type { PopTipAttributes } from './type';\n\nexport const theme: { poptip: PopTipAttributes } = {\n poptip: {\n visible: true,\n position: 'top',\n titleStyle: {\n fontSize: 16,\n fill: '#08979c'\n },\n contentStyle: {\n fontSize: 12,\n fill: 'green'\n },\n panel: {\n visible: true,\n\n fill: '#e6fffb',\n\n stroke: '#87e8de',\n lineWidth: 1,\n cornerRadius: 4\n }\n }\n};\n"]}
|
package/dist/index.js
CHANGED
|
@@ -875,27 +875,70 @@
|
|
|
875
875
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
876
876
|
};
|
|
877
877
|
|
|
878
|
+
const theme = {
|
|
879
|
+
poptip: {
|
|
880
|
+
visible: true,
|
|
881
|
+
position: 'top',
|
|
882
|
+
titleStyle: {
|
|
883
|
+
fontSize: 16,
|
|
884
|
+
fill: '#08979c'
|
|
885
|
+
},
|
|
886
|
+
contentStyle: {
|
|
887
|
+
fontSize: 12,
|
|
888
|
+
fill: 'green'
|
|
889
|
+
},
|
|
890
|
+
panel: {
|
|
891
|
+
visible: true,
|
|
892
|
+
fill: '#e6fffb',
|
|
893
|
+
stroke: '#87e8de',
|
|
894
|
+
lineWidth: 1,
|
|
895
|
+
cornerRadius: 4
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
function wrapPoptip(target, source) {
|
|
901
|
+
vutils.merge(target, theme.poptip, source);
|
|
902
|
+
return target;
|
|
903
|
+
}
|
|
878
904
|
let PopTipRenderContribution = class PopTipRenderContribution {
|
|
879
905
|
render(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb, options) {
|
|
880
|
-
if (graphic._showPoptip) {
|
|
881
|
-
const { visible, visibleCb } = graphic.attribute.poptip;
|
|
906
|
+
if (graphic._showPoptip === 1) {
|
|
907
|
+
const { visible, visibleCb } = graphic.attribute.poptip || {};
|
|
882
908
|
if (visible === false || (visibleCb && visibleCb(graphic) === false)) {
|
|
883
909
|
return;
|
|
884
910
|
}
|
|
885
911
|
if (!this.poptipComponent) {
|
|
886
912
|
this.poptipComponent = new PopTip(graphic.attribute.poptip);
|
|
887
913
|
}
|
|
914
|
+
let poptip = graphic.attribute.poptip || {};
|
|
915
|
+
if (graphic.type === 'text' && poptip.title == null && poptip.content == null) {
|
|
916
|
+
const out = {};
|
|
917
|
+
wrapPoptip(out, poptip);
|
|
918
|
+
poptip = out;
|
|
919
|
+
poptip.content = poptip.content ?? graphic.attribute.text;
|
|
920
|
+
}
|
|
921
|
+
const matrix = graphic.globalTransMatrix;
|
|
888
922
|
this.poptipComponent.setAttributes({
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
923
|
+
visibleAll: true,
|
|
924
|
+
pickable: false,
|
|
925
|
+
childrenPickable: false,
|
|
926
|
+
...poptip,
|
|
927
|
+
x: matrix.e,
|
|
928
|
+
y: matrix.f
|
|
893
929
|
});
|
|
894
930
|
const interactiveLayer = drawContext.stage.getLayer('_builtin_interactive');
|
|
895
931
|
if (interactiveLayer) {
|
|
896
932
|
interactiveLayer.add(this.poptipComponent);
|
|
897
933
|
}
|
|
898
934
|
}
|
|
935
|
+
else if (graphic._showPoptip === 2) {
|
|
936
|
+
graphic._showPoptip = 0;
|
|
937
|
+
this.poptipComponent &&
|
|
938
|
+
this.poptipComponent.setAttributes({
|
|
939
|
+
visibleAll: false
|
|
940
|
+
});
|
|
941
|
+
}
|
|
899
942
|
}
|
|
900
943
|
};
|
|
901
944
|
PopTipRenderContribution = __decorate([
|
|
@@ -916,16 +959,21 @@
|
|
|
916
959
|
}
|
|
917
960
|
poptip = (e) => {
|
|
918
961
|
const graphic = e.target;
|
|
919
|
-
if (graphic.isContainer || !graphic.attribute
|
|
962
|
+
if (graphic.isContainer || !graphic.attribute) {
|
|
920
963
|
this.unpoptip(e);
|
|
921
964
|
return;
|
|
922
965
|
}
|
|
966
|
+
if (graphic === this.activeGraphic) {
|
|
967
|
+
return;
|
|
968
|
+
}
|
|
923
969
|
const { poptip } = graphic.attribute;
|
|
924
970
|
if (poptip) {
|
|
925
|
-
graphic.
|
|
971
|
+
graphic.setAttributes({});
|
|
972
|
+
graphic._showPoptip = 1;
|
|
926
973
|
}
|
|
927
974
|
if (this.activeGraphic) {
|
|
928
|
-
this.activeGraphic.
|
|
975
|
+
this.activeGraphic.setAttributes({});
|
|
976
|
+
this.activeGraphic._showPoptip = 2;
|
|
929
977
|
}
|
|
930
978
|
this.setActiveGraphic(graphic, true);
|
|
931
979
|
};
|
|
@@ -933,7 +981,8 @@
|
|
|
933
981
|
if (!this.activeGraphic) {
|
|
934
982
|
return;
|
|
935
983
|
}
|
|
936
|
-
this.activeGraphic.
|
|
984
|
+
this.activeGraphic.setAttributes({});
|
|
985
|
+
this.activeGraphic._showPoptip = 2;
|
|
937
986
|
this.setActiveGraphic(null, true);
|
|
938
987
|
};
|
|
939
988
|
setActiveGraphic(graphic, rerender) {
|
|
@@ -948,14 +997,69 @@
|
|
|
948
997
|
PopTipPlugin = __decorate([
|
|
949
998
|
injectable()
|
|
950
999
|
], PopTipPlugin);
|
|
1000
|
+
let PopTipForClipedTextPlugin = class PopTipForClipedTextPlugin {
|
|
1001
|
+
name = 'poptipForText';
|
|
1002
|
+
activeEvent = 'onRegister';
|
|
1003
|
+
pluginService;
|
|
1004
|
+
_uid = vrender.Generator.GenAutoIncrementId();
|
|
1005
|
+
key = this.name + this._uid;
|
|
1006
|
+
activeGraphic;
|
|
1007
|
+
activate(context) {
|
|
1008
|
+
this.pluginService = context;
|
|
1009
|
+
const { stage } = this.pluginService;
|
|
1010
|
+
stage.addEventListener('pointerover', this.poptip);
|
|
1011
|
+
}
|
|
1012
|
+
poptip = (e) => {
|
|
1013
|
+
const graphic = e.target;
|
|
1014
|
+
if (graphic.type !== 'text' || !graphic.cliped || graphic.isContainer || !graphic.attribute) {
|
|
1015
|
+
this.unpoptip(e);
|
|
1016
|
+
return;
|
|
1017
|
+
}
|
|
1018
|
+
if (graphic === this.activeGraphic) {
|
|
1019
|
+
return;
|
|
1020
|
+
}
|
|
1021
|
+
const { poptip = {} } = graphic.attribute;
|
|
1022
|
+
if (poptip) {
|
|
1023
|
+
graphic.setAttributes({});
|
|
1024
|
+
graphic._showPoptip = 1;
|
|
1025
|
+
}
|
|
1026
|
+
if (this.activeGraphic) {
|
|
1027
|
+
this.activeGraphic.setAttributes({});
|
|
1028
|
+
this.activeGraphic._showPoptip = 2;
|
|
1029
|
+
}
|
|
1030
|
+
this.setActiveGraphic(graphic, true);
|
|
1031
|
+
};
|
|
1032
|
+
unpoptip = (e) => {
|
|
1033
|
+
if (!this.activeGraphic) {
|
|
1034
|
+
return;
|
|
1035
|
+
}
|
|
1036
|
+
this.activeGraphic.setAttributes({});
|
|
1037
|
+
this.activeGraphic._showPoptip = 2;
|
|
1038
|
+
this.setActiveGraphic(null, true);
|
|
1039
|
+
};
|
|
1040
|
+
setActiveGraphic(graphic, rerender) {
|
|
1041
|
+
this.activeGraphic = graphic;
|
|
1042
|
+
this.pluginService.stage.renderNextFrame();
|
|
1043
|
+
}
|
|
1044
|
+
deactivate(context) {
|
|
1045
|
+
const { stage } = this.pluginService;
|
|
1046
|
+
stage.removeEventListener('pointerover', this.poptip);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
PopTipForClipedTextPlugin = __decorate([
|
|
1050
|
+
injectable()
|
|
1051
|
+
], PopTipForClipedTextPlugin);
|
|
951
1052
|
|
|
952
1053
|
const module = new ContainerModule(bind => {
|
|
953
1054
|
bind(PopTipRenderContribution).toSelf().inSingletonScope();
|
|
954
1055
|
bind(vrender.InteractiveSubRenderContribution).toService(PopTipRenderContribution);
|
|
955
1056
|
bind(PopTipPlugin).toSelf().inSingletonScope();
|
|
956
1057
|
bind(vrender.AutoEnablePlugins).toService(PopTipPlugin);
|
|
1058
|
+
bind(PopTipForClipedTextPlugin).toSelf().inSingletonScope();
|
|
1059
|
+
bind(vrender.AutoEnablePlugins).toService(PopTipForClipedTextPlugin);
|
|
957
1060
|
});
|
|
958
|
-
function
|
|
1061
|
+
function loadPoptip(defaultPoptipTheme) {
|
|
1062
|
+
vutils.merge(theme.poptip, defaultPoptipTheme);
|
|
959
1063
|
vrender.container.load(module);
|
|
960
1064
|
}
|
|
961
1065
|
|
|
@@ -9323,7 +9427,7 @@
|
|
|
9323
9427
|
}
|
|
9324
9428
|
}
|
|
9325
9429
|
|
|
9326
|
-
const version = "0.13.2
|
|
9430
|
+
const version = "0.13.2";
|
|
9327
9431
|
|
|
9328
9432
|
exports.AbstractComponent = AbstractComponent;
|
|
9329
9433
|
exports.BasePlayer = BasePlayer;
|
|
@@ -9372,10 +9476,10 @@
|
|
|
9372
9476
|
exports.Tag = Tag;
|
|
9373
9477
|
exports.Title = Title;
|
|
9374
9478
|
exports.Tooltip = Tooltip;
|
|
9375
|
-
exports.enablePoptip = enablePoptip;
|
|
9376
9479
|
exports.getHorizontalPath = getHorizontalPath;
|
|
9377
9480
|
exports.getSizeHandlerPath = getSizeHandlerPath;
|
|
9378
9481
|
exports.getVerticalPath = getVerticalPath;
|
|
9482
|
+
exports.loadPoptip = loadPoptip;
|
|
9379
9483
|
exports.module = module;
|
|
9380
9484
|
exports.version = version;
|
|
9381
9485
|
|