@visactor/vrender-core 1.0.45 → 1.0.46-alpha.1
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/canvas/empty-context.js +1 -2
- package/cjs/color-string/index.js +2 -1
- package/cjs/common/diff.js +1 -2
- package/cjs/common/event-transformer.js +2 -1
- package/cjs/common/render-area.js +1 -1
- package/cjs/common/render-command-list.js +1 -1
- package/cjs/common/render-curve.js +1 -1
- package/cjs/common/render-utils.js +1 -1
- package/cjs/common/seg-context.js +1 -1
- package/cjs/common/simplify.js +1 -2
- package/cjs/common/sort.js +1 -1
- package/cjs/common/split-path.js +1 -1
- package/cjs/common/store.js +1 -1
- package/cjs/common/text.js +1 -1
- package/cjs/common/utils.js +1 -1
- package/cjs/core/application.js +1 -1
- package/cjs/core/camera.js +1 -1
- package/cjs/core/constants.js +1 -1
- package/cjs/core/core-modules.js +1 -1
- package/cjs/core/global-module.js +2 -0
- package/cjs/core/global.js +1 -1
- package/cjs/core/graphic-utils.js +1 -1
- package/cjs/core/index.js +1 -1
- package/cjs/core/layer-service.js +2 -1
- package/cjs/core/layer.js +1 -1
- package/cjs/core/light.js +1 -1
- package/cjs/core/stage.js +1 -1
- package/cjs/core/window.js +1 -1
- package/cjs/event/constant.js +1 -1
- package/cjs/event/event-manager.js +1 -1
- package/cjs/graphic/config.js +3 -1
- package/cjs/graphic/config.js.map +1 -1
- package/cjs/graphic/graphic.js +14 -5
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/interface/graphic.d.ts +20 -3
- package/cjs/interface/graphic.js.map +1 -1
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.d.ts +4 -2
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js +56 -29
- package/cjs/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
- package/dist/index.es.js +117 -29
- package/es/canvas/empty-context.js +1 -2
- package/es/color-string/index.js +2 -1
- package/es/common/diff.js +1 -2
- package/es/common/event-transformer.js +2 -1
- package/es/common/render-area.js +1 -1
- package/es/common/render-command-list.js +1 -1
- package/es/common/render-curve.js +1 -1
- package/es/common/render-utils.js +1 -1
- package/es/common/seg-context.js +1 -1
- package/es/common/simplify.js +1 -2
- package/es/common/sort.js +1 -1
- package/es/common/split-path.js +1 -1
- package/es/common/store.js +1 -1
- package/es/common/text.js +1 -1
- package/es/common/utils.js +1 -1
- package/es/core/application.js +1 -1
- package/es/core/camera.js +1 -1
- package/es/core/constants.js +1 -1
- package/es/core/core-modules.js +1 -1
- package/es/core/global-module.js +2 -0
- package/es/core/global.js +1 -1
- package/es/core/graphic-utils.js +1 -1
- package/es/core/index.js +1 -1
- package/es/core/layer-service.js +2 -1
- package/es/core/layer.js +1 -1
- package/es/core/light.js +1 -1
- package/es/core/stage.js +1 -1
- package/es/core/window.js +1 -1
- package/es/event/constant.js +1 -1
- package/es/event/event-manager.js +1 -1
- package/es/graphic/config.js +3 -1
- package/es/graphic/config.js.map +1 -1
- package/es/graphic/graphic.js +12 -5
- package/es/graphic/graphic.js.map +1 -1
- package/es/interface/graphic.d.ts +20 -3
- package/es/interface/graphic.js.map +1 -1
- package/es/render/contributions/render/contributions/base-texture-contribution-render.d.ts +4 -2
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js +56 -29
- package/es/render/contributions/render/contributions/base-texture-contribution-render.js.map +1 -1
- package/package.json +3 -3
package/dist/index.es.js
CHANGED
|
@@ -3563,7 +3563,7 @@ const DefaultTextStyle = {
|
|
|
3563
3563
|
const DefaultPickStyle = {
|
|
3564
3564
|
pickStrokeBuffer: 0
|
|
3565
3565
|
};
|
|
3566
|
-
const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({ forceBoundsWidth: undefined, forceBoundsHeight: undefined, opacity: 1, background: null, autoAnimateTexture: false, textureRatio: 1, textureOptions:
|
|
3566
|
+
const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.assign({ forceBoundsWidth: undefined, forceBoundsHeight: undefined, opacity: 1, background: null, autoAnimateTexture: false, textureRatio: 1, textureOptions: { alignToGraphic: true }, backgroundOpacity: 1, backgroundCornerRadius: 0, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 'no-repeat', backgroundFit: true, backgroundKeepAspectRatio: false, backgroundClip: true, backgroundScale: 1, backgroundOffsetX: 0, backgroundOffsetY: 0, backgroundPosition: 'top-left', blur: 0, filter: '', cursor: null, html: null, react: null, vue: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout), DefaultPickStyle);
|
|
3567
3567
|
const DefaultConnectAttribute = {
|
|
3568
3568
|
connectedType: 'none',
|
|
3569
3569
|
connectedStyle: {},
|
|
@@ -11063,6 +11063,17 @@ const GRAPHIC_UPDATE_TAG_KEY = [
|
|
|
11063
11063
|
const tempConstantXYKey = ['x', 'y'];
|
|
11064
11064
|
const tempConstantScaleXYKey = ['scaleX', 'scaleY'];
|
|
11065
11065
|
const tempConstantAngleKey = ['angle'];
|
|
11066
|
+
const builtinTextureTypes = new Set([
|
|
11067
|
+
'circle',
|
|
11068
|
+
'diamond',
|
|
11069
|
+
'rect',
|
|
11070
|
+
'vertical-line',
|
|
11071
|
+
'horizontal-line',
|
|
11072
|
+
'bias-lr',
|
|
11073
|
+
'bias-rl',
|
|
11074
|
+
'grid',
|
|
11075
|
+
'wave'
|
|
11076
|
+
]);
|
|
11066
11077
|
const point = new Point();
|
|
11067
11078
|
const NOWORK_ANIMATE_ATTR = {
|
|
11068
11079
|
strokeSeg: 1,
|
|
@@ -11128,6 +11139,9 @@ class Graphic extends Node {
|
|
|
11128
11139
|
if (params.background) {
|
|
11129
11140
|
this.loadImage((_a = params.background.background) !== null && _a !== void 0 ? _a : params.background, true);
|
|
11130
11141
|
}
|
|
11142
|
+
if (isExternalTexture(params.texture)) {
|
|
11143
|
+
this.loadImage(params.texture, false);
|
|
11144
|
+
}
|
|
11131
11145
|
else if (params.shadowGraphic) {
|
|
11132
11146
|
this.setShadowGraphic(params.shadowGraphic);
|
|
11133
11147
|
}
|
|
@@ -11420,6 +11434,9 @@ class Graphic extends Node {
|
|
|
11420
11434
|
if (params.background) {
|
|
11421
11435
|
this.loadImage(params.background, true);
|
|
11422
11436
|
}
|
|
11437
|
+
if (isExternalTexture(params.texture)) {
|
|
11438
|
+
this.loadImage(params.texture, false);
|
|
11439
|
+
}
|
|
11423
11440
|
else if (params.shadowGraphic) {
|
|
11424
11441
|
this.setShadowGraphic(params.shadowGraphic);
|
|
11425
11442
|
}
|
|
@@ -11469,6 +11486,9 @@ class Graphic extends Node {
|
|
|
11469
11486
|
if (key === 'background') {
|
|
11470
11487
|
this.loadImage(value, true);
|
|
11471
11488
|
}
|
|
11489
|
+
else if (key === 'texture' && isExternalTexture(value)) {
|
|
11490
|
+
this.loadImage(value, false);
|
|
11491
|
+
}
|
|
11472
11492
|
else if (key === 'shadowGraphic') {
|
|
11473
11493
|
this.setShadowGraphic(value);
|
|
11474
11494
|
}
|
|
@@ -11499,6 +11519,9 @@ class Graphic extends Node {
|
|
|
11499
11519
|
if (params.background) {
|
|
11500
11520
|
this.loadImage(params.background, true);
|
|
11501
11521
|
}
|
|
11522
|
+
if (isExternalTexture(params.texture)) {
|
|
11523
|
+
this.loadImage(params.texture, false);
|
|
11524
|
+
}
|
|
11502
11525
|
else if (params.shadowGraphic) {
|
|
11503
11526
|
this.setShadowGraphic(params.shadowGraphic);
|
|
11504
11527
|
}
|
|
@@ -12186,6 +12209,18 @@ function backgroundNotImage(image) {
|
|
|
12186
12209
|
}
|
|
12187
12210
|
return false;
|
|
12188
12211
|
}
|
|
12212
|
+
function isExternalTexture(texture) {
|
|
12213
|
+
if (!texture) {
|
|
12214
|
+
return false;
|
|
12215
|
+
}
|
|
12216
|
+
if (typeof texture === 'string') {
|
|
12217
|
+
if (builtinTextureTypes.has(texture)) {
|
|
12218
|
+
return false;
|
|
12219
|
+
}
|
|
12220
|
+
return texture.startsWith('<svg') || isValidUrl(texture) || texture.includes('/') || isBase64(texture);
|
|
12221
|
+
}
|
|
12222
|
+
return isObject(texture);
|
|
12223
|
+
}
|
|
12189
12224
|
|
|
12190
12225
|
var GroupUpdateAABBBoundsMode;
|
|
12191
12226
|
(function (GroupUpdateAABBBoundsMode) {
|
|
@@ -17767,38 +17802,50 @@ class DefaultBaseTextureRenderContribution {
|
|
|
17767
17802
|
this.drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding);
|
|
17768
17803
|
}
|
|
17769
17804
|
drawTexture(texture, graphic, context, x, y, graphicAttribute, textureColor, textureSize, texturePadding) {
|
|
17770
|
-
var _a;
|
|
17805
|
+
var _a, _b, _c, _d, _e;
|
|
17771
17806
|
const { textureRatio = graphicAttribute.textureRatio, textureOptions = null } = graphic.attribute;
|
|
17772
|
-
let pattern =
|
|
17807
|
+
let pattern = null;
|
|
17808
|
+
const patternKey = this.getPatternCacheKey(texture, textureSize, texturePadding, textureColor, context.dpr);
|
|
17809
|
+
if (patternKey !== null) {
|
|
17810
|
+
pattern = this.textureMap.get(patternKey);
|
|
17811
|
+
}
|
|
17773
17812
|
if (!pattern) {
|
|
17774
|
-
|
|
17775
|
-
|
|
17776
|
-
|
|
17777
|
-
|
|
17778
|
-
|
|
17779
|
-
|
|
17780
|
-
|
|
17781
|
-
|
|
17782
|
-
|
|
17783
|
-
|
|
17784
|
-
|
|
17785
|
-
|
|
17786
|
-
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17790
|
-
|
|
17791
|
-
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
|
|
17795
|
-
|
|
17796
|
-
|
|
17797
|
-
|
|
17798
|
-
|
|
17813
|
+
if (typeof texture === 'string') {
|
|
17814
|
+
switch (texture) {
|
|
17815
|
+
case 'circle':
|
|
17816
|
+
pattern = this.createCirclePattern(textureSize, texturePadding, textureColor, context);
|
|
17817
|
+
break;
|
|
17818
|
+
case 'diamond':
|
|
17819
|
+
pattern = this.createDiamondPattern(textureSize, texturePadding, textureColor, context);
|
|
17820
|
+
break;
|
|
17821
|
+
case 'rect':
|
|
17822
|
+
pattern = this.createRectPattern(textureSize, texturePadding, textureColor, context);
|
|
17823
|
+
break;
|
|
17824
|
+
case 'vertical-line':
|
|
17825
|
+
pattern = this.createVerticalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
17826
|
+
break;
|
|
17827
|
+
case 'horizontal-line':
|
|
17828
|
+
pattern = this.createHorizontalLinePattern(textureSize, texturePadding, textureColor, context);
|
|
17829
|
+
break;
|
|
17830
|
+
case 'bias-lr':
|
|
17831
|
+
pattern = this.createBiasLRLinePattern(textureSize, texturePadding, textureColor, context);
|
|
17832
|
+
break;
|
|
17833
|
+
case 'bias-rl':
|
|
17834
|
+
pattern = this.createBiasRLLinePattern(textureSize, texturePadding, textureColor, context);
|
|
17835
|
+
break;
|
|
17836
|
+
case 'grid':
|
|
17837
|
+
pattern = this.createGridPattern(textureSize, texturePadding, textureColor, context);
|
|
17838
|
+
break;
|
|
17839
|
+
}
|
|
17840
|
+
}
|
|
17841
|
+
if (!pattern) {
|
|
17842
|
+
pattern = this.createResourcePattern(texture, graphic, context);
|
|
17843
|
+
}
|
|
17844
|
+
if (pattern && patternKey !== null) {
|
|
17845
|
+
this.textureMap.set(patternKey, pattern);
|
|
17799
17846
|
}
|
|
17800
17847
|
}
|
|
17801
|
-
if (textureOptions && textureOptions.dynamicTexture) {
|
|
17848
|
+
if (typeof texture === 'string' && textureOptions && textureOptions.dynamicTexture) {
|
|
17802
17849
|
const { gridConfig = {}, useNewCanvas } = textureOptions;
|
|
17803
17850
|
const b = graphic.AABBBounds;
|
|
17804
17851
|
x = b.x1;
|
|
@@ -17859,6 +17906,27 @@ class DefaultBaseTextureRenderContribution {
|
|
|
17859
17906
|
originalContext.restore();
|
|
17860
17907
|
}
|
|
17861
17908
|
else if (pattern) {
|
|
17909
|
+
if (pattern.setTransform) {
|
|
17910
|
+
const alignToGraphic = !!(textureOptions === null || textureOptions === void 0 ? void 0 : textureOptions.alignToGraphic);
|
|
17911
|
+
const alignOffsetX = (_b = textureOptions === null || textureOptions === void 0 ? void 0 : textureOptions.alignOffsetX) !== null && _b !== void 0 ? _b : 0;
|
|
17912
|
+
const alignOffsetY = (_c = textureOptions === null || textureOptions === void 0 ? void 0 : textureOptions.alignOffsetY) !== null && _c !== void 0 ? _c : 0;
|
|
17913
|
+
let translateX = 0;
|
|
17914
|
+
let translateY = 0;
|
|
17915
|
+
if (alignToGraphic) {
|
|
17916
|
+
const m = context.currentMatrix;
|
|
17917
|
+
const e = (_d = m === null || m === void 0 ? void 0 : m.e) !== null && _d !== void 0 ? _d : 0;
|
|
17918
|
+
const f = (_e = m === null || m === void 0 ? void 0 : m.f) !== null && _e !== void 0 ? _e : 0;
|
|
17919
|
+
const ux = e + x + alignOffsetX;
|
|
17920
|
+
const uy = f + y + alignOffsetY;
|
|
17921
|
+
translateX = ux;
|
|
17922
|
+
translateY = uy;
|
|
17923
|
+
}
|
|
17924
|
+
else if (alignOffsetX || alignOffsetY) {
|
|
17925
|
+
translateX = alignOffsetX;
|
|
17926
|
+
translateY = alignOffsetY;
|
|
17927
|
+
}
|
|
17928
|
+
pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, translateX, translateY]));
|
|
17929
|
+
}
|
|
17862
17930
|
context.highPerformanceSave();
|
|
17863
17931
|
context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute);
|
|
17864
17932
|
context.fillStyle = pattern;
|
|
@@ -17874,6 +17942,26 @@ class DefaultBaseTextureRenderContribution {
|
|
|
17874
17942
|
context.restore();
|
|
17875
17943
|
}
|
|
17876
17944
|
}
|
|
17945
|
+
getPatternCacheKey(texture, textureSize, texturePadding, textureColor, dpr) {
|
|
17946
|
+
if (typeof texture !== 'string') {
|
|
17947
|
+
return texture;
|
|
17948
|
+
}
|
|
17949
|
+
if (texture === 'wave') {
|
|
17950
|
+
return null;
|
|
17951
|
+
}
|
|
17952
|
+
return `${texture}-${textureSize}-${texturePadding}-${textureColor}-${dpr}`;
|
|
17953
|
+
}
|
|
17954
|
+
createResourcePattern(texture, graphic, context) {
|
|
17955
|
+
var _a;
|
|
17956
|
+
const resource = (_a = graphic.resources) === null || _a === void 0 ? void 0 : _a.get(texture);
|
|
17957
|
+
const data = (resource === null || resource === void 0 ? void 0 : resource.state) === 'success' ? resource.data : typeof texture === 'object' ? texture : null;
|
|
17958
|
+
if (!data) {
|
|
17959
|
+
return null;
|
|
17960
|
+
}
|
|
17961
|
+
const pattern = context.createPattern(data, 'repeat');
|
|
17962
|
+
(pattern === null || pattern === void 0 ? void 0 : pattern.setTransform) && pattern.setTransform(new DOMMatrix([1 / context.dpr, 0, 0, 1 / context.dpr, 0, 0]));
|
|
17963
|
+
return pattern;
|
|
17964
|
+
}
|
|
17877
17965
|
}
|
|
17878
17966
|
const defaultBaseTextureRenderContribution = new DefaultBaseTextureRenderContribution();
|
|
17879
17967
|
|
|
@@ -219,5 +219,4 @@ let EmptyContext2d = class {
|
|
|
219
219
|
|
|
220
220
|
EmptyContext2d = __decorate([ injectable(), __metadata("design:paramtypes", [ Object, Number ]) ], EmptyContext2d);
|
|
221
221
|
|
|
222
|
-
export { EmptyContext2d };
|
|
223
|
-
//# sourceMappingURL=empty-context.js.map
|
|
222
|
+
export { EmptyContext2d };
|
package/es/color-string/index.js
CHANGED
package/es/common/diff.js
CHANGED
package/es/common/render-area.js
CHANGED
package/es/common/seg-context.js
CHANGED
package/es/common/simplify.js
CHANGED
|
@@ -29,5 +29,4 @@ function simplifyDouglasPeucker(points, sqTolerance) {
|
|
|
29
29
|
export function flatten_simplify(points, tolerance, highestQuality) {
|
|
30
30
|
if (points.length <= 10) return points;
|
|
31
31
|
return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=simplify.js.map
|
|
32
|
+
}
|
package/es/common/sort.js
CHANGED
package/es/common/split-path.js
CHANGED
package/es/common/store.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
class StageStore {}
|
|
2
|
-
//# sourceMappingURL=store.js.map
|
|
2
|
+
//# sourceMappingURL=store.js.map
|
package/es/common/text.js
CHANGED
|
@@ -24,4 +24,4 @@ export function textAttributesToStyle(attrs) {
|
|
|
24
24
|
attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
|
|
25
25
|
attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
|
|
26
26
|
}
|
|
27
|
-
//# sourceMappingURL=text.js.map
|
|
27
|
+
//# sourceMappingURL=text.js.map
|
package/es/common/utils.js
CHANGED
package/es/core/application.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const ApplicationContribution = Symbol("ApplicationContribution");
|
|
2
|
-
//# sourceMappingURL=application.js.map
|
|
2
|
+
//# sourceMappingURL=application.js.map
|
package/es/core/camera.js
CHANGED
package/es/core/constants.js
CHANGED
|
@@ -9,4 +9,4 @@ export const StaticLayerHandlerContribution = Symbol.for("StaticLayerHandlerCont
|
|
|
9
9
|
export const DynamicLayerHandlerContribution = Symbol.for("DynamicLayerHandlerContribution");
|
|
10
10
|
|
|
11
11
|
export const VirtualLayerHandlerContribution = Symbol.for("VirtualLayerHandlerContribution");
|
|
12
|
-
//# sourceMappingURL=constants.js.map
|
|
12
|
+
//# sourceMappingURL=constants.js.map
|
package/es/core/core-modules.js
CHANGED
|
@@ -17,4 +17,4 @@ export default new ContainerModule((bind => {
|
|
|
17
17
|
bind(GraphicUtil).to(DefaultGraphicUtil).inSingletonScope(), bind(TransformUtil).to(DefaultTransformUtil).inSingletonScope(),
|
|
18
18
|
bind(LayerService).to(DefaultLayerService).inSingletonScope();
|
|
19
19
|
}));
|
|
20
|
-
//# sourceMappingURL=core-modules.js.map
|
|
20
|
+
//# sourceMappingURL=core-modules.js.map
|
package/es/core/global-module.js
CHANGED
package/es/core/global.js
CHANGED
|
@@ -238,4 +238,4 @@ let DefaultGlobal = class extends EventListenerManager {
|
|
|
238
238
|
DefaultGlobal = __decorate([ injectable(), __param(0, inject(ContributionProvider)), __param(0, named(EnvContribution)), __metadata("design:paramtypes", [ Object ]) ], DefaultGlobal);
|
|
239
239
|
|
|
240
240
|
export { DefaultGlobal };
|
|
241
|
-
//# sourceMappingURL=global.js.map
|
|
241
|
+
//# sourceMappingURL=global.js.map
|
package/es/core/graphic-utils.js
CHANGED
|
@@ -189,4 +189,4 @@ let DefaultTransformUtil = class {
|
|
|
189
189
|
DefaultTransformUtil = __decorate([ injectable(), __metadata("design:paramtypes", []) ], DefaultTransformUtil);
|
|
190
190
|
|
|
191
191
|
export { DefaultTransformUtil };
|
|
192
|
-
//# sourceMappingURL=graphic-utils.js.map
|
|
192
|
+
//# sourceMappingURL=graphic-utils.js.map
|
package/es/core/index.js
CHANGED
package/es/core/layer-service.js
CHANGED
|
@@ -82,4 +82,5 @@ let DefaultLayerService = DefaultLayerService_1 = class {
|
|
|
82
82
|
DefaultLayerService.idprefix = "visactor_layer", DefaultLayerService.prefix_count = 0,
|
|
83
83
|
DefaultLayerService = DefaultLayerService_1 = __decorate([ injectable(), __metadata("design:paramtypes", []) ], DefaultLayerService);
|
|
84
84
|
|
|
85
|
-
export { DefaultLayerService };
|
|
85
|
+
export { DefaultLayerService };
|
|
86
|
+
//# sourceMappingURL=layer-service.js.map
|
package/es/core/layer.js
CHANGED
package/es/core/light.js
CHANGED
package/es/core/stage.js
CHANGED
package/es/core/window.js
CHANGED
|
@@ -162,4 +162,4 @@ let DefaultWindow = class extends EventListenerManager {
|
|
|
162
162
|
DefaultWindow = __decorate([ injectable(), __metadata("design:paramtypes", []) ], DefaultWindow);
|
|
163
163
|
|
|
164
164
|
export { DefaultWindow };
|
|
165
|
-
//# sourceMappingURL=window.js.map
|
|
165
|
+
//# sourceMappingURL=window.js.map
|
package/es/event/constant.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const WILDCARD = "*";
|
|
2
|
-
//# sourceMappingURL=constant.js.map
|
|
2
|
+
//# sourceMappingURL=constant.js.map
|
package/es/graphic/config.js
CHANGED
|
@@ -102,7 +102,9 @@ export const DefaultStyle = Object.assign(Object.assign(Object.assign(Object.ass
|
|
|
102
102
|
background: null,
|
|
103
103
|
autoAnimateTexture: !1,
|
|
104
104
|
textureRatio: 1,
|
|
105
|
-
textureOptions:
|
|
105
|
+
textureOptions: {
|
|
106
|
+
alignToGraphic: !0
|
|
107
|
+
},
|
|
106
108
|
backgroundOpacity: 1,
|
|
107
109
|
backgroundCornerRadius: 0,
|
|
108
110
|
texture: null,
|
package/es/graphic/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graphic/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EA+BL,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;IA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,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,QAAQ,EACtB,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,EAAE,EAEN,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,cAAc,EAAE,0BAA0B,EAC1C,qBAAqB,EAAE,CAAC,EACxB,gBAAgB,EAAE,KAAK,EACvB,uBAAuB,EAAE,CAAC,EAC1B,gBAAgB,EAAE,CAAC,EACnB,OAAO,EAAE,CAAC,GACX,CAAC","file":"config.js","sourcesContent":["// 存放公共属性\nimport { Logger, Matrix, pi2 } from '@visactor/vutils';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport {\n type IArcGraphicAttribute,\n type IAreaGraphicAttribute,\n type IGraphicAttribute,\n type ICircleGraphicAttribute,\n type IFillStyle,\n type IGlyphGraphicAttribute,\n type IGroupGraphicAttribute,\n type IImageGraphicAttribute,\n type ILineGraphicAttribute,\n type IPathGraphicAttribute,\n type IPolygonGraphicAttribute,\n type IRect3dGraphicAttribute,\n type IRectGraphicAttribute,\n type IStrokeStyle,\n type IGraphicStyle,\n type ISymbolGraphicAttribute,\n type ITextAttribute,\n type ITextGraphicAttribute,\n type IRichTextGraphicAttribute,\n type ITransform,\n type RichTextWordBreak,\n type RichTextVerticalDirection,\n type RichTextGlobalAlignType,\n type RichTextGlobalBaselineType,\n type IRichTextIconGraphicAttribute,\n type IStarGraphicAttribute,\n type IConnectedStyle,\n type ILayout,\n type IDebugType,\n type IPickStyle,\n MeasureModeEnum\n} from '../interface';\n\nexport const DefaultLayout: ILayout = {\n alignSelf: 'auto'\n};\n\nexport const DefaultTransform: ITransform = {\n x: 0,\n y: 0,\n z: 0,\n dx: 0,\n dy: 0,\n dz: 0,\n scrollX: 0,\n scrollY: 0,\n scaleX: 1,\n scaleY: 1,\n scaleZ: 1,\n angle: 0,\n alpha: 0,\n beta: 0,\n scaleCenter: [0, 0],\n anchor: [0, 0],\n anchor3d: [0, 0],\n postMatrix: new Matrix()\n};\n\nexport const DefaultFillStyle: IFillStyle = {\n fillOpacity: 1,\n fill: false,\n shadowBlur: 0,\n shadowColor: 'black',\n shadowOffsetX: 0,\n shadowOffsetY: 0\n};\n\nconst commonStroke: Omit<IStrokeStyle, 'outerBorder' | 'innerBorder'> = {\n strokeOpacity: 1,\n lineDash: [],\n lineDashOffset: 0,\n lineWidth: 1,\n lineCap: 'butt',\n lineJoin: 'miter',\n miterLimit: 10,\n strokeBoundsBuffer: 2,\n stroke: false\n};\n\nexport const DefaultStrokeStyle: IStrokeStyle = {\n outerBorder: { ...commonStroke, distance: 0 },\n innerBorder: { ...commonStroke, distance: 0 },\n ...commonStroke\n};\n\nexport const DefaultTextStyle: Required<ITextAttribute> = {\n text: '',\n maxLineWidth: Infinity,\n maxWidth: Infinity,\n textAlign: 'left',\n textBaseline: 'alphabetic',\n fontSize: 16,\n // @ts-ignore\n fontFamily: `PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol`,\n fontWeight: '',\n ellipsis: '…',\n fontVariant: '',\n fontStyle: '',\n lineHeight: undefined,\n underline: 0,\n lineThrough: 0,\n scaleIn3d: false,\n direction: 'horizontal',\n wordBreak: 'break-all',\n ignoreBuf: false,\n verticalMode: 0,\n wrap: false,\n whiteSpace: 'no-wrap',\n heightLimit: Infinity,\n lineClamp: Infinity,\n suffixPosition: 'end',\n underlineDash: [],\n underlineOffset: 0,\n disableAutoClipedPoptip: undefined,\n measureMode: MeasureModeEnum.fontBounding,\n keepCenterInLine: false\n};\n\nexport const DefaultPickStyle: IPickStyle = {\n pickStrokeBuffer: 0\n};\n\nexport const DefaultStyle: IGraphicStyle = {\n forceBoundsWidth: undefined,\n forceBoundsHeight: undefined,\n opacity: 1,\n background: null,\n autoAnimateTexture: false,\n textureRatio: 1,\n textureOptions: null,\n backgroundOpacity: 1,\n backgroundCornerRadius: 0,\n texture: null,\n textureColor: 'black',\n textureSize: 10,\n texturePadding: 2,\n backgroundMode: 'no-repeat',\n backgroundFit: true,\n backgroundKeepAspectRatio: false,\n backgroundClip: true,\n backgroundScale: 1,\n backgroundOffsetX: 0,\n backgroundOffsetY: 0,\n backgroundPosition: 'top-left',\n blur: 0,\n filter: '',\n cursor: null,\n html: null,\n react: null,\n vue: null,\n ...DefaultFillStyle,\n ...DefaultStrokeStyle,\n ...DefaultLayout,\n ...DefaultPickStyle\n};\n\nexport const DefaultConnectAttribute: Required<IConnectedStyle> = {\n connectedType: 'none',\n // connectedStyle: {\n // stroke: DefaultStrokeStyle.stroke,\n // strokeOpacity: DefaultStrokeStyle.strokeOpacity,\n // lineDash: DefaultStrokeStyle.lineDash,\n // lineDashOffset: DefaultStrokeStyle.lineDashOffset,\n // lineCap: DefaultStrokeStyle.lineCap,\n // lineJoin: DefaultStrokeStyle.lineJoin,\n // lineWidth: DefaultStrokeStyle.lineWidth,\n // fill: DefaultFillStyle.fill,\n // fillOpacity: DefaultFillStyle.fillOpacity\n // },\n connectedStyle: {}, // 默认全都继承父属性\n connectedX: NaN,\n connectedY: NaN\n} as IConnectedStyle;\n\nexport const DefaultDebugAttribute: Required<IDebugType> = {\n _debug_bounds: false\n};\n\nexport const DefaultAttribute: Required<IGraphicAttribute> = {\n strokeSeg: null,\n renderable: true,\n pickable: true,\n shadowGraphic: undefined,\n childrenPickable: true,\n fillPickable: true,\n strokePickable: true,\n visible: true,\n zIndex: 0,\n layout: null,\n boundsPadding: 0,\n fillStrokeOrder: 0,\n renderStyle: 'default',\n pickMode: 'accurate',\n customPickShape: null,\n boundsMode: 'accurate',\n keepDirIn3d: true,\n shadowRootIdx: 1,\n globalZIndex: 1,\n globalCompositeOperation: '',\n overflow: 'hidden',\n shadowPickMode: 'graphic',\n keepStrokeScale: false,\n clipConfig: null,\n roughStyle: null,\n ...DefaultDebugAttribute,\n ...DefaultStyle,\n ...DefaultTransform\n};\n\nexport function addAttributeToPrototype(obj: Record<string, any>, c: any, keys: string[]) {\n keys.forEach(key => {\n c.prototype[key] = obj[key];\n });\n}\nexport function rewriteProto(obj: Record<string, any>, c: Record<string, any>) {\n Object.setPrototypeOf(obj, c);\n}\n\nexport const DefaultArcAttribute: Required<IArcGraphicAttribute> = {\n ...DefaultAttribute,\n startAngle: 0,\n endAngle: pi2,\n innerRadius: 0,\n outerRadius: 1,\n innerPadding: 0,\n outerPadding: 0,\n cornerRadius: 0,\n padRadius: 0,\n padAngle: 0,\n cap: false,\n forceShowCap: false\n};\n\nexport const DefaultAreaAttribute: Required<IAreaGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1,\n closePath: false,\n curveTension: 1\n};\n\nexport const DefaultCircleAttribute: Required<ICircleGraphicAttribute> = {\n ...DefaultAttribute,\n radius: 1,\n startAngle: 0,\n endAngle: pi2\n};\n\nexport const DefaultGroupAttribute: Required<IGroupGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n cornerRadius: 0,\n path: [],\n clip: false,\n visibleAll: true,\n display: 'relative',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n alignContent: 'flex-start',\n baseOpacity: 1,\n cornerType: 'round'\n // 默认是0,不需要主题\n // drawMode: 0\n} as any;\n\nexport const DefaultGlyphAttribute: Required<IGlyphGraphicAttribute> = {\n ...DefaultAttribute,\n path: '',\n width: 0,\n height: 0,\n cornerRadius: 0,\n clip: false\n};\n\nexport const DefaultLineAttribute: Required<ILineGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1,\n clipRangeByDimension: 'default',\n closePath: false,\n curveTension: 1\n};\n\nexport const DefaultPathAttribute: Required<IPathGraphicAttribute> = {\n ...DefaultAttribute,\n path: new CustomPath2D(),\n fillStrokeOrder: 1,\n clipRange: 1,\n customPath: () => {\n Logger.getInstance().warn('空函数');\n }\n};\n\nexport const DefaultPolygonAttribute: Required<IPolygonGraphicAttribute> = {\n ...DefaultAttribute,\n points: [],\n cornerRadius: 0,\n closePath: true\n};\n\nexport const DefaultStarAttribute: Required<IStarGraphicAttribute> = {\n ...DefaultAttribute,\n width: 100,\n height: 100,\n spikes: 5,\n thickness: 0.5\n};\n\nexport const DefaultRectAttribute: Required<IRectGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n x1: 0,\n y1: 0,\n strokeBoundsBuffer: 0,\n cornerRadius: 0,\n cornerType: 'round',\n drawStrokeWhenZeroWH: false\n};\n\nexport const DefaultRect3dAttribute: Required<IRect3dGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n x1: 0,\n y1: 0,\n cornerRadius: 0,\n length: 0,\n cornerType: 'round',\n drawStrokeWhenZeroWH: false\n};\n\nexport const DefaultSymbolAttribute: Required<ISymbolGraphicAttribute> = {\n ...DefaultAttribute,\n symbolType: 'circle',\n size: 10, // 外接**正方形**的边长\n keepDirIn3d: true,\n clipRange: 1\n};\n\nexport const DefaultTextAttribute: Required<ITextGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultTextStyle,\n strokeBoundsBuffer: 0,\n keepDirIn3d: true\n};\n\nexport const DefaultRichTextAttribute: Required<IRichTextGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultTextStyle,\n upgradeAttrs: null,\n editable: false,\n editOptions: null,\n ascentDescentMode: 'actual',\n width: 300,\n height: 300,\n ellipsis: true,\n wordBreak: 'break-word' as RichTextWordBreak,\n verticalDirection: 'top' as RichTextVerticalDirection,\n textAlign: 'left' as RichTextGlobalAlignType,\n textBaseline: 'top' as RichTextGlobalBaselineType,\n layoutDirection: 'horizontal',\n textConfig: [],\n disableAutoWrapLine: false,\n maxHeight: undefined,\n maxWidth: undefined,\n singleLine: false\n};\n\nexport const DefaultImageAttribute: Required<IImageGraphicAttribute> = {\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: undefined,\n image: '',\n width: 0,\n height: 0,\n maxWidth: 500,\n maxHeight: 500,\n imagePosition: 'top-left',\n imageScale: 1,\n imageOffsetX: 0,\n imageOffsetY: 0,\n ...DefaultAttribute,\n fill: true,\n cornerRadius: 0,\n cornerType: 'round'\n};\n\nexport const DefaultRichTextIconAttribute: Required<IRichTextIconGraphicAttribute> = {\n ...DefaultImageAttribute,\n backgroundShowMode: 'never',\n backgroundWidth: 0,\n backgroundHeight: 0,\n textAlign: 'left',\n textBaseline: 'middle',\n direction: 'horizontal',\n margin: 0,\n id: '',\n\n width: 20,\n height: 20,\n backgroundFill: 'rgba(101, 117, 168, 0.1)',\n backgroundFillOpacity: 1,\n backgroundStroke: false,\n backgroundStrokeOpacity: 1,\n backgroundRadius: 4,\n opacity: 1\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/graphic/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EA+BL,eAAe,EAChB,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,SAAS,EAAE,MAAM;CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAe;IAC1C,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,CA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,MAAM,CAAC,MAAM,4BAA4B,mCACpC,qBAAqB,KACxB,kBAAkB,EAAE,OAAO,EAC3B,eAAe,EAAE,CAAC,EAClB,gBAAgB,EAAE,CAAC,EACnB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,QAAQ,EACtB,SAAS,EAAE,YAAY,EACvB,MAAM,EAAE,CAAC,EACT,EAAE,EAAE,EAAE,EAEN,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,cAAc,EAAE,0BAA0B,EAC1C,qBAAqB,EAAE,CAAC,EACxB,gBAAgB,EAAE,KAAK,EACvB,uBAAuB,EAAE,CAAC,EAC1B,gBAAgB,EAAE,CAAC,EACnB,OAAO,EAAE,CAAC,GACX,CAAC","file":"config.js","sourcesContent":["// 存放公共属性\nimport { Logger, Matrix, pi2 } from '@visactor/vutils';\nimport { CustomPath2D } from '../common/custom-path2d';\nimport {\n type IArcGraphicAttribute,\n type IAreaGraphicAttribute,\n type IGraphicAttribute,\n type ICircleGraphicAttribute,\n type IFillStyle,\n type IGlyphGraphicAttribute,\n type IGroupGraphicAttribute,\n type IImageGraphicAttribute,\n type ILineGraphicAttribute,\n type IPathGraphicAttribute,\n type IPolygonGraphicAttribute,\n type IRect3dGraphicAttribute,\n type IRectGraphicAttribute,\n type IStrokeStyle,\n type IGraphicStyle,\n type ISymbolGraphicAttribute,\n type ITextAttribute,\n type ITextGraphicAttribute,\n type IRichTextGraphicAttribute,\n type ITransform,\n type RichTextWordBreak,\n type RichTextVerticalDirection,\n type RichTextGlobalAlignType,\n type RichTextGlobalBaselineType,\n type IRichTextIconGraphicAttribute,\n type IStarGraphicAttribute,\n type IConnectedStyle,\n type ILayout,\n type IDebugType,\n type IPickStyle,\n MeasureModeEnum\n} from '../interface';\n\nexport const DefaultLayout: ILayout = {\n alignSelf: 'auto'\n};\n\nexport const DefaultTransform: ITransform = {\n x: 0,\n y: 0,\n z: 0,\n dx: 0,\n dy: 0,\n dz: 0,\n scrollX: 0,\n scrollY: 0,\n scaleX: 1,\n scaleY: 1,\n scaleZ: 1,\n angle: 0,\n alpha: 0,\n beta: 0,\n scaleCenter: [0, 0],\n anchor: [0, 0],\n anchor3d: [0, 0],\n postMatrix: new Matrix()\n};\n\nexport const DefaultFillStyle: IFillStyle = {\n fillOpacity: 1,\n fill: false,\n shadowBlur: 0,\n shadowColor: 'black',\n shadowOffsetX: 0,\n shadowOffsetY: 0\n};\n\nconst commonStroke: Omit<IStrokeStyle, 'outerBorder' | 'innerBorder'> = {\n strokeOpacity: 1,\n lineDash: [],\n lineDashOffset: 0,\n lineWidth: 1,\n lineCap: 'butt',\n lineJoin: 'miter',\n miterLimit: 10,\n strokeBoundsBuffer: 2,\n stroke: false\n};\n\nexport const DefaultStrokeStyle: IStrokeStyle = {\n outerBorder: { ...commonStroke, distance: 0 },\n innerBorder: { ...commonStroke, distance: 0 },\n ...commonStroke\n};\n\nexport const DefaultTextStyle: Required<ITextAttribute> = {\n text: '',\n maxLineWidth: Infinity,\n maxWidth: Infinity,\n textAlign: 'left',\n textBaseline: 'alphabetic',\n fontSize: 16,\n // @ts-ignore\n fontFamily: `PingFang SC,Microsoft Yahei,system-ui,'-apple-system',segoe ui,\n Roboto,Helvetica,Arial,sans-serif, apple color emoji,segoe ui emoji,segoe ui symbol`,\n fontWeight: '',\n ellipsis: '…',\n fontVariant: '',\n fontStyle: '',\n lineHeight: undefined,\n underline: 0,\n lineThrough: 0,\n scaleIn3d: false,\n direction: 'horizontal',\n wordBreak: 'break-all',\n ignoreBuf: false,\n verticalMode: 0,\n wrap: false,\n whiteSpace: 'no-wrap',\n heightLimit: Infinity,\n lineClamp: Infinity,\n suffixPosition: 'end',\n underlineDash: [],\n underlineOffset: 0,\n disableAutoClipedPoptip: undefined,\n measureMode: MeasureModeEnum.fontBounding,\n keepCenterInLine: false\n};\n\nexport const DefaultPickStyle: IPickStyle = {\n pickStrokeBuffer: 0\n};\n\nexport const DefaultStyle: IGraphicStyle = {\n forceBoundsWidth: undefined,\n forceBoundsHeight: undefined,\n opacity: 1,\n background: null,\n autoAnimateTexture: false,\n textureRatio: 1,\n textureOptions: { alignToGraphic: true },\n backgroundOpacity: 1,\n backgroundCornerRadius: 0,\n texture: null,\n textureColor: 'black',\n textureSize: 10,\n texturePadding: 2,\n backgroundMode: 'no-repeat',\n backgroundFit: true,\n backgroundKeepAspectRatio: false,\n backgroundClip: true,\n backgroundScale: 1,\n backgroundOffsetX: 0,\n backgroundOffsetY: 0,\n backgroundPosition: 'top-left',\n blur: 0,\n filter: '',\n cursor: null,\n html: null,\n react: null,\n vue: null,\n ...DefaultFillStyle,\n ...DefaultStrokeStyle,\n ...DefaultLayout,\n ...DefaultPickStyle\n};\n\nexport const DefaultConnectAttribute: Required<IConnectedStyle> = {\n connectedType: 'none',\n // connectedStyle: {\n // stroke: DefaultStrokeStyle.stroke,\n // strokeOpacity: DefaultStrokeStyle.strokeOpacity,\n // lineDash: DefaultStrokeStyle.lineDash,\n // lineDashOffset: DefaultStrokeStyle.lineDashOffset,\n // lineCap: DefaultStrokeStyle.lineCap,\n // lineJoin: DefaultStrokeStyle.lineJoin,\n // lineWidth: DefaultStrokeStyle.lineWidth,\n // fill: DefaultFillStyle.fill,\n // fillOpacity: DefaultFillStyle.fillOpacity\n // },\n connectedStyle: {}, // 默认全都继承父属性\n connectedX: NaN,\n connectedY: NaN\n} as IConnectedStyle;\n\nexport const DefaultDebugAttribute: Required<IDebugType> = {\n _debug_bounds: false\n};\n\nexport const DefaultAttribute: Required<IGraphicAttribute> = {\n strokeSeg: null,\n renderable: true,\n pickable: true,\n shadowGraphic: undefined,\n childrenPickable: true,\n fillPickable: true,\n strokePickable: true,\n visible: true,\n zIndex: 0,\n layout: null,\n boundsPadding: 0,\n fillStrokeOrder: 0,\n renderStyle: 'default',\n pickMode: 'accurate',\n customPickShape: null,\n boundsMode: 'accurate',\n keepDirIn3d: true,\n shadowRootIdx: 1,\n globalZIndex: 1,\n globalCompositeOperation: '',\n overflow: 'hidden',\n shadowPickMode: 'graphic',\n keepStrokeScale: false,\n clipConfig: null,\n roughStyle: null,\n ...DefaultDebugAttribute,\n ...DefaultStyle,\n ...DefaultTransform\n};\n\nexport function addAttributeToPrototype(obj: Record<string, any>, c: any, keys: string[]) {\n keys.forEach(key => {\n c.prototype[key] = obj[key];\n });\n}\nexport function rewriteProto(obj: Record<string, any>, c: Record<string, any>) {\n Object.setPrototypeOf(obj, c);\n}\n\nexport const DefaultArcAttribute: Required<IArcGraphicAttribute> = {\n ...DefaultAttribute,\n startAngle: 0,\n endAngle: pi2,\n innerRadius: 0,\n outerRadius: 1,\n innerPadding: 0,\n outerPadding: 0,\n cornerRadius: 0,\n padRadius: 0,\n padAngle: 0,\n cap: false,\n forceShowCap: false\n};\n\nexport const DefaultAreaAttribute: Required<IAreaGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1,\n closePath: false,\n curveTension: 1\n};\n\nexport const DefaultCircleAttribute: Required<ICircleGraphicAttribute> = {\n ...DefaultAttribute,\n radius: 1,\n startAngle: 0,\n endAngle: pi2\n};\n\nexport const DefaultGroupAttribute: Required<IGroupGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n cornerRadius: 0,\n path: [],\n clip: false,\n visibleAll: true,\n display: 'relative',\n flexDirection: 'row',\n flexWrap: 'wrap',\n justifyContent: 'flex-start',\n alignItems: 'flex-start',\n alignContent: 'flex-start',\n baseOpacity: 1,\n cornerType: 'round'\n // 默认是0,不需要主题\n // drawMode: 0\n} as any;\n\nexport const DefaultGlyphAttribute: Required<IGlyphGraphicAttribute> = {\n ...DefaultAttribute,\n path: '',\n width: 0,\n height: 0,\n cornerRadius: 0,\n clip: false\n};\n\nexport const DefaultLineAttribute: Required<ILineGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultConnectAttribute,\n points: [],\n segments: [],\n curveType: 'linear',\n clipRange: 1,\n clipRangeByDimension: 'default',\n closePath: false,\n curveTension: 1\n};\n\nexport const DefaultPathAttribute: Required<IPathGraphicAttribute> = {\n ...DefaultAttribute,\n path: new CustomPath2D(),\n fillStrokeOrder: 1,\n clipRange: 1,\n customPath: () => {\n Logger.getInstance().warn('空函数');\n }\n};\n\nexport const DefaultPolygonAttribute: Required<IPolygonGraphicAttribute> = {\n ...DefaultAttribute,\n points: [],\n cornerRadius: 0,\n closePath: true\n};\n\nexport const DefaultStarAttribute: Required<IStarGraphicAttribute> = {\n ...DefaultAttribute,\n width: 100,\n height: 100,\n spikes: 5,\n thickness: 0.5\n};\n\nexport const DefaultRectAttribute: Required<IRectGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n x1: 0,\n y1: 0,\n strokeBoundsBuffer: 0,\n cornerRadius: 0,\n cornerType: 'round',\n drawStrokeWhenZeroWH: false\n};\n\nexport const DefaultRect3dAttribute: Required<IRect3dGraphicAttribute> = {\n ...DefaultAttribute,\n width: 0,\n height: 0,\n x1: 0,\n y1: 0,\n cornerRadius: 0,\n length: 0,\n cornerType: 'round',\n drawStrokeWhenZeroWH: false\n};\n\nexport const DefaultSymbolAttribute: Required<ISymbolGraphicAttribute> = {\n ...DefaultAttribute,\n symbolType: 'circle',\n size: 10, // 外接**正方形**的边长\n keepDirIn3d: true,\n clipRange: 1\n};\n\nexport const DefaultTextAttribute: Required<ITextGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultTextStyle,\n strokeBoundsBuffer: 0,\n keepDirIn3d: true\n};\n\nexport const DefaultRichTextAttribute: Required<IRichTextGraphicAttribute> = {\n ...DefaultAttribute,\n ...DefaultTextStyle,\n upgradeAttrs: null,\n editable: false,\n editOptions: null,\n ascentDescentMode: 'actual',\n width: 300,\n height: 300,\n ellipsis: true,\n wordBreak: 'break-word' as RichTextWordBreak,\n verticalDirection: 'top' as RichTextVerticalDirection,\n textAlign: 'left' as RichTextGlobalAlignType,\n textBaseline: 'top' as RichTextGlobalBaselineType,\n layoutDirection: 'horizontal',\n textConfig: [],\n disableAutoWrapLine: false,\n maxHeight: undefined,\n maxWidth: undefined,\n singleLine: false\n};\n\nexport const DefaultImageAttribute: Required<IImageGraphicAttribute> = {\n repeatX: 'no-repeat',\n repeatY: 'no-repeat',\n imageMode: undefined,\n image: '',\n width: 0,\n height: 0,\n maxWidth: 500,\n maxHeight: 500,\n imagePosition: 'top-left',\n imageScale: 1,\n imageOffsetX: 0,\n imageOffsetY: 0,\n ...DefaultAttribute,\n fill: true,\n cornerRadius: 0,\n cornerType: 'round'\n};\n\nexport const DefaultRichTextIconAttribute: Required<IRichTextIconGraphicAttribute> = {\n ...DefaultImageAttribute,\n backgroundShowMode: 'never',\n backgroundWidth: 0,\n backgroundHeight: 0,\n textAlign: 'left',\n textBaseline: 'middle',\n direction: 'horizontal',\n margin: 0,\n id: '',\n\n width: 20,\n height: 20,\n backgroundFill: 'rgba(101, 117, 168, 0.1)',\n backgroundFillOpacity: 1,\n backgroundStroke: false,\n backgroundStrokeOpacity: 1,\n backgroundRadius: 4,\n opacity: 1\n};\n"]}
|
package/es/graphic/graphic.js
CHANGED
|
@@ -38,7 +38,7 @@ export const PURE_STYLE_KEY = [ "stroke", "opacity", "strokeOpacity", "lineDash"
|
|
|
38
38
|
|
|
39
39
|
export const GRAPHIC_UPDATE_TAG_KEY = [ "lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible" ];
|
|
40
40
|
|
|
41
|
-
const tempConstantXYKey = [ "x", "y" ], tempConstantScaleXYKey = [ "scaleX", "scaleY" ], tempConstantAngleKey = [ "angle" ], point = new Point;
|
|
41
|
+
const tempConstantXYKey = [ "x", "y" ], tempConstantScaleXYKey = [ "scaleX", "scaleY" ], tempConstantAngleKey = [ "angle" ], builtinTextureTypes = new Set([ "circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave" ]), point = new Point;
|
|
42
42
|
|
|
43
43
|
export const NOWORK_ANIMATE_ATTR = {
|
|
44
44
|
strokeSeg: 1,
|
|
@@ -97,7 +97,8 @@ export class Graphic extends Node {
|
|
|
97
97
|
constructor(params = {}) {
|
|
98
98
|
var _a;
|
|
99
99
|
super(), this._AABBBounds = new AABBBounds, this._updateTag = UpdateTag.INIT, this.attribute = params,
|
|
100
|
-
this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background
|
|
100
|
+
this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0),
|
|
101
|
+
isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
|
|
101
102
|
}
|
|
102
103
|
getGraphicService() {
|
|
103
104
|
var _a, _b;
|
|
@@ -274,7 +275,8 @@ export class Graphic extends Node {
|
|
|
274
275
|
}));
|
|
275
276
|
}
|
|
276
277
|
setAttributes(params, forceUpdateTag = !1, context) {
|
|
277
|
-
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background
|
|
278
|
+
params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0),
|
|
279
|
+
isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic),
|
|
278
280
|
this._setAttributes(params, forceUpdateTag, context));
|
|
279
281
|
}
|
|
280
282
|
_setAttributes(params, forceUpdateTag = !1, context) {
|
|
@@ -294,7 +296,7 @@ export class Graphic extends Node {
|
|
|
294
296
|
params ? this._setAttributes(params, forceUpdateTag, context) : isNil(null === (_a = this.normalAttrs) || void 0 === _a ? void 0 : _a[key]) ? (this.attribute[key] = value,
|
|
295
297
|
this.valid = this.isValid(), this.updateShapeAndBoundsTagSetted() || !forceUpdateTag && !this.needUpdateTag(key) ? this.addUpdateBoundTag() : this.addUpdateShapeAndBoundsTag(),
|
|
296
298
|
this.addUpdatePositionTag(), this.addUpdateLayoutTag(), this.onAttributeUpdate(context)) : this.normalAttrs[key] = value,
|
|
297
|
-
"background" === key ? this.loadImage(value, !0) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
299
|
+
"background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
|
|
298
300
|
}
|
|
299
301
|
needUpdateTags(keys, k = GRAPHIC_UPDATE_TAG_KEY) {
|
|
300
302
|
for (let i = 0; i < k.length; i++) {
|
|
@@ -314,7 +316,8 @@ export class Graphic extends Node {
|
|
|
314
316
|
type: AttributeUpdateType.INIT
|
|
315
317
|
};
|
|
316
318
|
params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params,
|
|
317
|
-
this.attribute = params, params.background
|
|
319
|
+
this.attribute = params, params.background && this.loadImage(params.background, !0),
|
|
320
|
+
isExternalTexture(params.texture) ? this.loadImage(params.texture, !1) : params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic),
|
|
318
321
|
this._updateTag = UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
|
|
319
322
|
}
|
|
320
323
|
translate(x, y) {
|
|
@@ -709,5 +712,9 @@ function backgroundNotImage(image) {
|
|
|
709
712
|
return "string" == typeof image ? !(image.startsWith("<svg") || isValidUrl(image) || image.includes("/") || isBase64(image)) : !(!image.fill && !image.stroke) || !("string" != typeof image.gradient || !Array.isArray(image.stops));
|
|
710
713
|
}
|
|
711
714
|
|
|
715
|
+
function isExternalTexture(texture) {
|
|
716
|
+
return !!texture && ("string" == typeof texture ? !builtinTextureTypes.has(texture) && (texture.startsWith("<svg") || isValidUrl(texture) || texture.includes("/") || isBase64(texture)) : isObject(texture));
|
|
717
|
+
}
|
|
718
|
+
|
|
712
719
|
Graphic.userSymbolMap = {}, Graphic.mixin(EventTarget);
|
|
713
720
|
//# sourceMappingURL=graphic.js.map
|