@visactor/vrender-core 0.19.8-beta.1 → 0.19.8-beta.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/animate/config.js +1 -2
- package/cjs/animate/custom-animate.d.ts +1 -0
- package/cjs/animate/custom-animate.js +36 -18
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/canvas/constants.js +2 -1
- package/cjs/env-check.js +1 -3
- package/cjs/env-check.js.map +1 -1
- package/cjs/graphic/glyph.js +3 -5
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.d.ts +1 -2
- package/cjs/graphic/graphic-service/graphic-service.js +2 -4
- package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
- package/cjs/graphic/graphic.d.ts +1 -1
- package/cjs/graphic/graphic.js.map +1 -1
- package/cjs/interface/graphic-service.d.ts +0 -3
- package/cjs/interface/graphic-service.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +1 -9
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +3 -15
- package/cjs/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/cjs/render/contributions/render/image-render.d.ts +1 -1
- package/cjs/render/contributions/render/image-render.js +4 -5
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/dist/index.es.js +162 -167
- package/es/animate/config.js +1 -2
- package/es/animate/custom-animate.d.ts +1 -0
- package/es/animate/custom-animate.js +36 -18
- package/es/animate/custom-animate.js.map +1 -1
- package/es/canvas/constants.js +2 -1
- package/es/env-check.js +1 -3
- package/es/env-check.js.map +1 -1
- package/es/graphic/glyph.js +3 -5
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.d.ts +1 -2
- package/es/graphic/graphic-service/graphic-service.js +3 -4
- package/es/graphic/graphic-service/graphic-service.js.map +1 -1
- package/es/graphic/graphic.d.ts +1 -1
- package/es/graphic/graphic.js.map +1 -1
- package/es/interface/graphic-service.d.ts +0 -3
- package/es/interface/graphic-service.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.d.ts +1 -9
- package/es/render/contributions/render/contributions/image-contribution-render.js +0 -14
- package/es/render/contributions/render/contributions/image-contribution-render.js.map +1 -1
- package/es/render/contributions/render/image-render.d.ts +1 -1
- package/es/render/contributions/render/image-render.js +5 -7
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/render/contributions/render/image-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAclD,yDAAoE;AAEpE,0DAA+D;AAE/D,6CAAqD;AACrD,qDAA4D;AAC5D,+CAA2C;AAC3C,mDAA2G;AAC3G,4DAAiE;AAEjE,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAGlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,wBAAkB;IAI9D,YAGqB,wBAAyE;QAE5F,KAAK,EAAE,CAAC;QAFW,6BAAwB,GAAxB,wBAAwB,CAAiD;QAL9F,eAAU,GAAW,6BAAiB,CAAC;QAQrC,IAAI,CAAC,oBAAoB,GAAG,CAAC,8CAA8B,EAAE,wDAAwC,CAAC,CAAC;QACvG,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACtC,CAAC;IAED,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY,EACZ,QAIY;QAGZ,MAAM,cAAc,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC;QAC7C,MAAM,EACJ,KAAK,GAAG,cAAc,CAAC,KAAK,EAC5B,MAAM,GAAG,cAAc,CAAC,MAAM,EAC9B,OAAO,GAAG,cAAc,CAAC,OA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AAC;QAC7C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AA9IY,wBAAwB;IADpC,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,mCAAuB,CAAC,CAAA;;GANtB,wBAAwB,CA8IpC;AA9IY,4DAAwB","file":"image-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IImage,\n IThemeAttribute,\n IGraphicRender,\n IImageRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { ImageRenderContribution } from './contributions/constants';\nimport { fillVisible, runFill } from './utils';\nimport { IMAGE_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { isArray, isString } from '@visactor/vutils';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { BaseRender } from './base-render';\nimport { defaultImageBackgroundRenderContribution, defaultImageRenderContribution } from './contributions';\nimport { ResourceLoader } from '../../../resource-loader/loader';\n\nconst repeatStr = ['', 'repeat-x', 'repeat-y', 'repeat'];\n\n@injectable()\nexport class DefaultCanvasImageRender extends BaseRender<IImage> implements IGraphicRender {\n type: 'image';\n numberType: number = IMAGE_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(ImageRenderContribution)\n protected readonly imageRenderContribitions: IContributionProvider<IImageRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution];\n this.init(imageRenderContribitions);\n }\n\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean,\n strokeCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const imageAttribute = graphicService.themeService.getCurrentTheme().imageAttribute;\n const imageAttribute = getTheme(image).image;\n const {\n width = imageAttribute.width,\n height = imageAttribute.height,\n repeatX = imageAttribute.repeatX,\n repeatY = imageAttribute.repeatY,\n x: originX = imageAttribute.x,\n y: originY = imageAttribute.y,\n cornerRadius = imageAttribute.cornerRadius,\n image: url\n } = image.attribute;\n\n const data = this.valid(image, imageAttribute, fillCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute);\n\n this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n\n // context.beginPath();\n // context.image(x, y, width, height);\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, image.attribute, imageAttribute);\n } else if (fVisible) {\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n if (res.state !== 'success') {\n return;\n }\n\n // deal with cornerRadius\n let needRestore = false;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n } else {\n context.beginPath();\n createRectPath(context, x, y, width, height, cornerRadius);\n context.save();\n context.clip();\n needRestore = true;\n }\n\n context.setCommonStyle(image, image.attribute, x, y, imageAttribute);\n let repeat = 0;\n if (repeatX === 'repeat') {\n repeat |= 0b0001;\n }\n if (repeatY === 'repeat') {\n repeat |= 0b0010;\n }\n if (repeat) {\n const pattern = context.createPattern(res.data, repeatStr[repeat]);\n context.fillStyle = pattern;\n context.translate(x, y, true);\n context.fillRect(0, 0, width, height);\n context.translate(-x, -y, true);\n } else {\n context.drawImage(res.data, x, y, width, height);\n }\n\n if (needRestore) {\n context.restore();\n }\n }\n }\n\n if (doStroke) {\n if (strokeCb) {\n strokeCb(context, image.attribute, imageAttribute);\n } else if (sVisible) {\n context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);\n context.stroke();\n }\n }\n\n this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n }\n\n draw(image: IImage, renderService: IRenderService, drawContext: IDrawContext) {\n const { image: url } = image.attribute;\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n // if (res.state !== 'success') {\n // return;\n // }\n if (res.state === 'loading' && isString(url)) {\n ResourceLoader.improveImageLoading(url);\n return;\n } else if (res.state !== 'success') {\n return;\n }\n\n const { context } = renderService.drawParams;\n if (!context) {\n return;\n }\n const imageAttribute = getTheme(image).image;\n this._draw(image, imageAttribute, false, drawContext);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/render/contributions/render/image-render.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,mEAA2E;AAE3E,iFAA6E;AAC7E,kDAAkD;AAclD,yDAAoE;AAEpE,0DAA+D;AAE/D,6CAAqD;AACrD,qDAA4D;AAC5D,+CAA2C;AAC3C,mDAA2E;AAC3E,4DAAiE;AAEjE,MAAM,SAAS,GAAG,CAAC,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;AAGlD,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,wBAAkB;IAI9D,YAGqB,wBAAyE;QAE5F,KAAK,EAAE,CAAC;QAFW,6BAAwB,GAAxB,wBAAwB,CAAiD;QAL9F,eAAU,GAAW,6BAAiB,CAAC;QAQrC,IAAI,CAAC,oBAAoB,GAAG,CAAC,wDAAwC,CAAC,CAAC;QACvE,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC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,IAAA,2BAAU,GAAE;IAMR,WAAA,IAAA,uBAAM,EAAC,4CAAoB,CAAC,CAAA;IAC5B,WAAA,IAAA,sBAAK,EAAC,mCAAuB,CAAC,CAAA;;GANtB,wBAAwB,CA8HpC;AA9HY,4DAAwB","file":"image-render.js","sourcesContent":["import { inject, injectable, named } from '../../../common/inversify-lite';\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\nimport { ContributionProvider } from '../../../common/contribution-provider';\nimport { getTheme } from '../../../graphic/theme';\nimport type {\n IGraphicAttribute,\n IContext2d,\n IMarkAttribute,\n IImage,\n IThemeAttribute,\n IGraphicRender,\n IImageRenderContribution,\n IContributionProvider,\n IDrawContext,\n IGraphicRenderDrawParams,\n IRenderService\n} from '../../../interface';\nimport { ImageRenderContribution } from './contributions/constants';\nimport { fillVisible, runFill } from './utils';\nimport { IMAGE_NUMBER_TYPE } from '../../../graphic/constants';\nimport { BaseRenderContributionTime } from '../../../common/enums';\nimport { isArray, isString } from '@visactor/vutils';\nimport { createRectPath } from '../../../common/shape/rect';\nimport { BaseRender } from './base-render';\nimport { defaultImageBackgroundRenderContribution } from './contributions';\nimport { ResourceLoader } from '../../../resource-loader/loader';\n\nconst repeatStr = ['', 'repeat-x', 'repeat-y', 'repeat'];\n\n@injectable()\nexport class DefaultCanvasImageRender extends BaseRender<IImage> implements IGraphicRender {\n type: 'image';\n numberType: number = IMAGE_NUMBER_TYPE;\n\n constructor(\n @inject(ContributionProvider)\n @named(ImageRenderContribution)\n protected readonly imageRenderContribitions: IContributionProvider<IImageRenderContribution>\n ) {\n super();\n this.builtinContributions = [defaultImageBackgroundRenderContribution];\n this.init(imageRenderContribitions);\n }\n\n drawShape(\n image: IImage,\n context: IContext2d,\n x: number,\n y: number,\n drawContext: IDrawContext,\n params?: IGraphicRenderDrawParams,\n fillCb?: (\n ctx: IContext2d,\n markAttribute: Partial<IMarkAttribute & IGraphicAttribute>,\n themeAttribute: IThemeAttribute\n ) => boolean\n ) {\n // const imageAttribute = graphicService.themeService.getCurrentTheme().imageAttribute;\n const imageAttribute = getTheme(image).image;\n const {\n width = imageAttribute.width,\n height = imageAttribute.height,\n repeatX = imageAttribute.repeatX,\n repeatY = imageAttribute.repeatY,\n cornerRadius = imageAttribute.cornerRadius,\n image: url\n } = image.attribute;\n\n const data = this.valid(image, imageAttribute, fillCb);\n if (!data) {\n return;\n }\n const { fVisible, sVisible, doFill, doStroke } = data;\n\n // shadow\n context.setShadowBlendStyle && context.setShadowBlendStyle(image, imageAttribute);\n\n this.beforeRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n\n // context.beginPath();\n // context.image(x, y, width, height);\n\n if (doFill) {\n if (fillCb) {\n fillCb(context, image.attribute, imageAttribute);\n } else if (fVisible) {\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n if (res.state !== 'success') {\n return;\n }\n\n // deal with cornerRadius\n let needRestore = false;\n if (cornerRadius === 0 || (isArray(cornerRadius) && (<number[]>cornerRadius).every(num => num === 0))) {\n // 不需要处理圆角\n } else {\n context.beginPath();\n createRectPath(context, x, y, width, height, cornerRadius);\n context.save();\n context.clip();\n needRestore = true;\n }\n\n context.setCommonStyle(image, image.attribute, x, y, imageAttribute);\n let repeat = 0;\n if (repeatX === 'repeat') {\n repeat |= 0b0001;\n }\n if (repeatY === 'repeat') {\n repeat |= 0b0010;\n }\n if (repeat) {\n const pattern = context.createPattern(res.data, repeatStr[repeat]);\n context.fillStyle = pattern;\n context.translate(x, y, true);\n context.fillRect(0, 0, width, height);\n context.translate(-x, -y, true);\n } else {\n context.drawImage(res.data, x, y, width, height);\n }\n\n if (needRestore) {\n context.restore();\n }\n }\n }\n\n this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);\n }\n\n draw(image: IImage, renderService: IRenderService, drawContext: IDrawContext) {\n const { image: url } = image.attribute;\n if (!url || !image.resources) {\n return;\n }\n const res = image.resources.get(url);\n // if (res.state !== 'success') {\n // return;\n // }\n if (res.state === 'loading' && isString(url)) {\n ResourceLoader.improveImageLoading(url);\n return;\n } else if (res.state !== 'success') {\n return;\n }\n\n const { context } = renderService.drawParams;\n if (!context) {\n return;\n }\n const imageAttribute = getTheme(image).image;\n this._draw(image, imageAttribute, false, drawContext);\n }\n}\n"]}
|
package/dist/index.es.js
CHANGED
|
@@ -8575,10 +8575,14 @@ class StreamLight extends ACustomAnimate {
|
|
|
8575
8575
|
root.add(line);
|
|
8576
8576
|
}
|
|
8577
8577
|
onStartRect() {
|
|
8578
|
-
var _a;
|
|
8578
|
+
var _a, _b, _c;
|
|
8579
8579
|
const root = this.target.attachShadow();
|
|
8580
|
-
const
|
|
8581
|
-
const
|
|
8580
|
+
const isHorizontal = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.isHorizontal) !== null && _b !== void 0 ? _b : true;
|
|
8581
|
+
const sizeAttr = isHorizontal ? 'height' : 'width';
|
|
8582
|
+
const otherSizeAttr = isHorizontal ? 'width' : 'height';
|
|
8583
|
+
const size = this.target.AABBBounds[sizeAttr]();
|
|
8584
|
+
const y = isHorizontal ? 0 : this.target.AABBBounds.y1;
|
|
8585
|
+
const rect = application.graphicService.creator.rect(Object.assign(Object.assign({ [sizeAttr]: size, fill: '#bcdeff', shadowBlur: 30, shadowColor: '#bcdeff' }, (_c = this.params) === null || _c === void 0 ? void 0 : _c.attribute), { x: 0, y, [otherSizeAttr]: 0 }));
|
|
8582
8586
|
this.rect = rect;
|
|
8583
8587
|
root.add(rect);
|
|
8584
8588
|
}
|
|
@@ -8597,25 +8601,56 @@ class StreamLight extends ACustomAnimate {
|
|
|
8597
8601
|
}
|
|
8598
8602
|
}
|
|
8599
8603
|
onUpdateRect(end, ratio, out) {
|
|
8600
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8601
|
-
const
|
|
8602
|
-
const
|
|
8603
|
-
|
|
8604
|
-
|
|
8605
|
-
|
|
8606
|
-
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
width
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8604
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
8605
|
+
const isHorizontal = (_b = (_a = this.params) === null || _a === void 0 ? void 0 : _a.isHorizontal) !== null && _b !== void 0 ? _b : true;
|
|
8606
|
+
const parentAttr = this.target.attribute;
|
|
8607
|
+
if (isHorizontal) {
|
|
8608
|
+
const parentWidth = (_d = (_c = parentAttr.width) !== null && _c !== void 0 ? _c : parentAttr.x1 - parentAttr.x) !== null && _d !== void 0 ? _d : 250;
|
|
8609
|
+
const streamLength = (_f = (_e = this.params) === null || _e === void 0 ? void 0 : _e.streamLength) !== null && _f !== void 0 ? _f : parentWidth;
|
|
8610
|
+
const maxLength = (_j = (_h = (_g = this.params) === null || _g === void 0 ? void 0 : _g.attribute) === null || _h === void 0 ? void 0 : _h.width) !== null && _j !== void 0 ? _j : 60;
|
|
8611
|
+
const startX = -maxLength;
|
|
8612
|
+
const currentX = startX + (streamLength - startX) * ratio;
|
|
8613
|
+
const x = Math.max(currentX, 0);
|
|
8614
|
+
const w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX);
|
|
8615
|
+
const width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
|
|
8616
|
+
this.rect.setAttributes({
|
|
8617
|
+
x,
|
|
8618
|
+
width
|
|
8619
|
+
}, false, {
|
|
8620
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
8621
|
+
animationState: {
|
|
8622
|
+
ratio,
|
|
8623
|
+
end
|
|
8624
|
+
}
|
|
8625
|
+
});
|
|
8626
|
+
}
|
|
8627
|
+
else {
|
|
8628
|
+
const parentHeight = (_l = (_k = parentAttr.height) !== null && _k !== void 0 ? _k : parentAttr.y1 - parentAttr.y) !== null && _l !== void 0 ? _l : 250;
|
|
8629
|
+
const streamLength = (_o = (_m = this.params) === null || _m === void 0 ? void 0 : _m.streamLength) !== null && _o !== void 0 ? _o : parentHeight;
|
|
8630
|
+
const maxLength = (_r = (_q = (_p = this.params) === null || _p === void 0 ? void 0 : _p.attribute) === null || _q === void 0 ? void 0 : _q.height) !== null && _r !== void 0 ? _r : 60;
|
|
8631
|
+
const startY = parentHeight;
|
|
8632
|
+
const currentY = startY - (streamLength + maxLength) * ratio;
|
|
8633
|
+
let y = Math.min(currentY, parentHeight);
|
|
8634
|
+
const h = Math.min(parentHeight - currentY, maxLength);
|
|
8635
|
+
let height;
|
|
8636
|
+
if (y <= 0) {
|
|
8637
|
+
height = Math.max(y + h, 0);
|
|
8638
|
+
y = 0;
|
|
8617
8639
|
}
|
|
8618
|
-
|
|
8640
|
+
else {
|
|
8641
|
+
height = h;
|
|
8642
|
+
}
|
|
8643
|
+
this.rect.setAttributes({
|
|
8644
|
+
y,
|
|
8645
|
+
height
|
|
8646
|
+
}, false, {
|
|
8647
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
8648
|
+
animationState: {
|
|
8649
|
+
ratio,
|
|
8650
|
+
end
|
|
8651
|
+
}
|
|
8652
|
+
});
|
|
8653
|
+
}
|
|
8619
8654
|
}
|
|
8620
8655
|
onUpdateLineOrArea(end, ratio, out) {
|
|
8621
8656
|
const target = this.line || this.area;
|
|
@@ -15712,7 +15747,6 @@ class Glyph extends Graphic {
|
|
|
15712
15747
|
if (!isChange) {
|
|
15713
15748
|
return;
|
|
15714
15749
|
}
|
|
15715
|
-
this.stopStateAnimates();
|
|
15716
15750
|
const stateAttrs = {};
|
|
15717
15751
|
const subAttrs = this.subGraphic.map(() => ({}));
|
|
15718
15752
|
states.forEach(stateName => {
|
|
@@ -15736,19 +15770,16 @@ class Glyph extends Graphic {
|
|
|
15736
15770
|
this.applyStateAttrs(stateAttrs, states, hasAnimation);
|
|
15737
15771
|
}
|
|
15738
15772
|
clearStates(hasAnimation) {
|
|
15739
|
-
this.
|
|
15740
|
-
|
|
15741
|
-
this.currentStates = [];
|
|
15742
|
-
this.subGraphic.forEach(graphic => {
|
|
15743
|
-
graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, true);
|
|
15744
|
-
graphic.normalAttrs = null;
|
|
15745
|
-
});
|
|
15746
|
-
this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);
|
|
15747
|
-
}
|
|
15748
|
-
else {
|
|
15749
|
-
this.currentStates = [];
|
|
15773
|
+
if (!this.hasState() || !this.normalAttrs) {
|
|
15774
|
+
return;
|
|
15750
15775
|
}
|
|
15776
|
+
this.subGraphic.forEach(graphic => {
|
|
15777
|
+
graphic.applyStateAttrs(graphic.normalAttrs, this.currentStates, hasAnimation, true);
|
|
15778
|
+
graphic.normalAttrs = null;
|
|
15779
|
+
});
|
|
15780
|
+
this.applyStateAttrs(this.normalAttrs, this.currentStates, hasAnimation, true);
|
|
15751
15781
|
this.normalAttrs = null;
|
|
15782
|
+
this.currentStates = [];
|
|
15752
15783
|
}
|
|
15753
15784
|
clone() {
|
|
15754
15785
|
const glyph = new Glyph(Object.assign({}, this.attribute));
|
|
@@ -18231,7 +18262,6 @@ let DefaultGraphicService = class DefaultGraphicService {
|
|
|
18231
18262
|
this.tempAABBBounds2 = new AABBBounds();
|
|
18232
18263
|
this._rectBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18233
18264
|
this._symbolBoundsContribitions = [new DefaultSymbolOuterBorderBoundsContribution()];
|
|
18234
|
-
this._imageBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18235
18265
|
this._circleBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18236
18266
|
this._arcBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18237
18267
|
this._pathBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
@@ -18760,12 +18790,6 @@ let DefaultGraphicService = class DefaultGraphicService {
|
|
|
18760
18790
|
const tb2 = this.tempAABBBounds2;
|
|
18761
18791
|
tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
|
|
18762
18792
|
tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
|
|
18763
|
-
this._imageBoundsContribitions.length &&
|
|
18764
|
-
this._imageBoundsContribitions.forEach(c => {
|
|
18765
|
-
c.updateBounds(attribute, imageTheme, tb1, graphic);
|
|
18766
|
-
aabbBounds.union(tb1);
|
|
18767
|
-
tb1.setValue(tb2.x1, tb2.y1, tb2.x2, tb2.y2);
|
|
18768
|
-
});
|
|
18769
18793
|
this.transformAABBBounds(attribute, aabbBounds, imageTheme, false, graphic);
|
|
18770
18794
|
return aabbBounds;
|
|
18771
18795
|
}
|
|
@@ -20097,6 +20121,99 @@ function createRectPath(path, x, y, width, height, rectCornerRadius) {
|
|
|
20097
20121
|
return path;
|
|
20098
20122
|
}
|
|
20099
20123
|
|
|
20124
|
+
class DefaultImageBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
|
|
20125
|
+
constructor() {
|
|
20126
|
+
super(...arguments);
|
|
20127
|
+
this.time = BaseRenderContributionTime.beforeFillStroke;
|
|
20128
|
+
}
|
|
20129
|
+
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20130
|
+
const { background, backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit } = graphic.attribute;
|
|
20131
|
+
if (!background) {
|
|
20132
|
+
return;
|
|
20133
|
+
}
|
|
20134
|
+
if (!graphic.backgroundImg) {
|
|
20135
|
+
if (isObject(background)) {
|
|
20136
|
+
const { stroke, fill, lineWidth = 1, cornerRadius = 0, expandX = 0, expandY = 0 } = background;
|
|
20137
|
+
if (!stroke && !fill) {
|
|
20138
|
+
return;
|
|
20139
|
+
}
|
|
20140
|
+
context.beginPath();
|
|
20141
|
+
const { x, y, width, height } = getActualPosition(graphic);
|
|
20142
|
+
if (cornerRadius) {
|
|
20143
|
+
createRectPath(context, x - expandX, y - expandY, width + expandX * 2, height + expandY * 2, cornerRadius);
|
|
20144
|
+
}
|
|
20145
|
+
else {
|
|
20146
|
+
context.rect(x - expandX, y - expandY, width + expandX * 2, height + expandY * 2);
|
|
20147
|
+
}
|
|
20148
|
+
context.globalAlpha = 1;
|
|
20149
|
+
if (fill) {
|
|
20150
|
+
context.fillStyle = fill;
|
|
20151
|
+
context.fill();
|
|
20152
|
+
}
|
|
20153
|
+
if (stroke && lineWidth > 0) {
|
|
20154
|
+
context.lineWidth = lineWidth;
|
|
20155
|
+
context.strokeStyle = stroke;
|
|
20156
|
+
context.stroke();
|
|
20157
|
+
}
|
|
20158
|
+
}
|
|
20159
|
+
else {
|
|
20160
|
+
context.beginPath();
|
|
20161
|
+
const b = graphic.AABBBounds;
|
|
20162
|
+
context.rect(x, y, b.width(), b.height());
|
|
20163
|
+
context.fillStyle = background;
|
|
20164
|
+
context.globalAlpha = 1;
|
|
20165
|
+
context.fill();
|
|
20166
|
+
}
|
|
20167
|
+
}
|
|
20168
|
+
else {
|
|
20169
|
+
const res = graphic.resources.get(background);
|
|
20170
|
+
if (res.state !== 'success' || !res.data) {
|
|
20171
|
+
return;
|
|
20172
|
+
}
|
|
20173
|
+
context.save();
|
|
20174
|
+
if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
20175
|
+
const groupAttribute = getTheme(graphic.parent).group;
|
|
20176
|
+
const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;
|
|
20177
|
+
context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
|
|
20178
|
+
context.translate(scrollX, scrollY);
|
|
20179
|
+
}
|
|
20180
|
+
const b = graphic.AABBBounds;
|
|
20181
|
+
this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);
|
|
20182
|
+
context.restore();
|
|
20183
|
+
if (!graphic.transMatrix.onlyTranslate()) {
|
|
20184
|
+
context.setTransformForCurrent();
|
|
20185
|
+
}
|
|
20186
|
+
}
|
|
20187
|
+
}
|
|
20188
|
+
}
|
|
20189
|
+
function getActualPosition(graphic) {
|
|
20190
|
+
const boundsPadding = parsePadding(graphic.attribute.boundsPadding);
|
|
20191
|
+
const bounds = graphic.AABBBounds;
|
|
20192
|
+
let x = bounds.x1;
|
|
20193
|
+
let y = bounds.y1;
|
|
20194
|
+
let width = bounds.width();
|
|
20195
|
+
let height = bounds.height();
|
|
20196
|
+
if (isNumber(boundsPadding)) {
|
|
20197
|
+
x += boundsPadding;
|
|
20198
|
+
y += boundsPadding;
|
|
20199
|
+
width -= boundsPadding * 2;
|
|
20200
|
+
height -= boundsPadding * 2;
|
|
20201
|
+
}
|
|
20202
|
+
else {
|
|
20203
|
+
x += boundsPadding[3];
|
|
20204
|
+
y += boundsPadding[0];
|
|
20205
|
+
width -= boundsPadding[1] + boundsPadding[3];
|
|
20206
|
+
height -= boundsPadding[0] + boundsPadding[2];
|
|
20207
|
+
}
|
|
20208
|
+
return {
|
|
20209
|
+
x,
|
|
20210
|
+
y,
|
|
20211
|
+
width,
|
|
20212
|
+
height
|
|
20213
|
+
};
|
|
20214
|
+
}
|
|
20215
|
+
const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();
|
|
20216
|
+
|
|
20100
20217
|
class DefaultRectRenderContribution {
|
|
20101
20218
|
constructor() {
|
|
20102
20219
|
this.time = BaseRenderContributionTime.afterFillStroke;
|
|
@@ -20238,111 +20355,6 @@ const defaultRectRenderContribution = new DefaultRectRenderContribution();
|
|
|
20238
20355
|
const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;
|
|
20239
20356
|
const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
20240
20357
|
|
|
20241
|
-
class DefaultImageBackgroundRenderContribution extends DefaultBaseBackgroundRenderContribution {
|
|
20242
|
-
constructor() {
|
|
20243
|
-
super(...arguments);
|
|
20244
|
-
this.time = BaseRenderContributionTime.beforeFillStroke;
|
|
20245
|
-
}
|
|
20246
|
-
drawShape(graphic, context, x, y, doFill, doStroke, fVisible, sVisible, graphicAttribute, drawContext, fillCb, strokeCb) {
|
|
20247
|
-
const { background, backgroundMode = graphicAttribute.backgroundMode, backgroundFit = graphicAttribute.backgroundFit } = graphic.attribute;
|
|
20248
|
-
if (!background) {
|
|
20249
|
-
return;
|
|
20250
|
-
}
|
|
20251
|
-
if (!graphic.backgroundImg) {
|
|
20252
|
-
if (isObject(background)) {
|
|
20253
|
-
const { stroke, fill, lineWidth = 1, cornerRadius = 0, expandX = 0, expandY = 0 } = background;
|
|
20254
|
-
if (!stroke && !fill) {
|
|
20255
|
-
return;
|
|
20256
|
-
}
|
|
20257
|
-
context.beginPath();
|
|
20258
|
-
const { x, y, width, height } = getActualPosition(graphic);
|
|
20259
|
-
if (cornerRadius) {
|
|
20260
|
-
createRectPath(context, x - expandX, y - expandY, width + expandX * 2, height + expandY * 2, cornerRadius);
|
|
20261
|
-
}
|
|
20262
|
-
else {
|
|
20263
|
-
context.rect(x - expandX, y - expandY, width + expandX * 2, height + expandY * 2);
|
|
20264
|
-
}
|
|
20265
|
-
context.globalAlpha = 1;
|
|
20266
|
-
if (fill) {
|
|
20267
|
-
context.fillStyle = fill;
|
|
20268
|
-
context.fill();
|
|
20269
|
-
}
|
|
20270
|
-
if (stroke && lineWidth > 0) {
|
|
20271
|
-
context.lineWidth = lineWidth;
|
|
20272
|
-
context.strokeStyle = stroke;
|
|
20273
|
-
context.stroke();
|
|
20274
|
-
}
|
|
20275
|
-
}
|
|
20276
|
-
else {
|
|
20277
|
-
context.beginPath();
|
|
20278
|
-
const b = graphic.AABBBounds;
|
|
20279
|
-
context.rect(x, y, b.width(), b.height());
|
|
20280
|
-
context.fillStyle = background;
|
|
20281
|
-
context.globalAlpha = 1;
|
|
20282
|
-
context.fill();
|
|
20283
|
-
}
|
|
20284
|
-
}
|
|
20285
|
-
else {
|
|
20286
|
-
const res = graphic.resources.get(background);
|
|
20287
|
-
if (res.state !== 'success' || !res.data) {
|
|
20288
|
-
return;
|
|
20289
|
-
}
|
|
20290
|
-
context.save();
|
|
20291
|
-
if (graphic.parent && !graphic.transMatrix.onlyTranslate()) {
|
|
20292
|
-
const groupAttribute = getTheme(graphic.parent).group;
|
|
20293
|
-
const { scrollX = groupAttribute.scrollX, scrollY = groupAttribute.scrollY } = graphic.parent.attribute;
|
|
20294
|
-
context.setTransformFromMatrix(graphic.parent.globalTransMatrix, true);
|
|
20295
|
-
context.translate(scrollX, scrollY);
|
|
20296
|
-
}
|
|
20297
|
-
const b = graphic.AABBBounds;
|
|
20298
|
-
this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit);
|
|
20299
|
-
context.restore();
|
|
20300
|
-
if (!graphic.transMatrix.onlyTranslate()) {
|
|
20301
|
-
context.setTransformForCurrent();
|
|
20302
|
-
}
|
|
20303
|
-
}
|
|
20304
|
-
}
|
|
20305
|
-
}
|
|
20306
|
-
function getActualPosition(graphic) {
|
|
20307
|
-
const boundsPadding = parsePadding(graphic.attribute.boundsPadding);
|
|
20308
|
-
const bounds = graphic.AABBBounds;
|
|
20309
|
-
let x = bounds.x1;
|
|
20310
|
-
let y = bounds.y1;
|
|
20311
|
-
let width = bounds.width();
|
|
20312
|
-
let height = bounds.height();
|
|
20313
|
-
if (isNumber(boundsPadding)) {
|
|
20314
|
-
x += boundsPadding;
|
|
20315
|
-
y += boundsPadding;
|
|
20316
|
-
width -= boundsPadding * 2;
|
|
20317
|
-
height -= boundsPadding * 2;
|
|
20318
|
-
}
|
|
20319
|
-
else {
|
|
20320
|
-
x += boundsPadding[3];
|
|
20321
|
-
y += boundsPadding[0];
|
|
20322
|
-
width -= boundsPadding[1] + boundsPadding[3];
|
|
20323
|
-
height -= boundsPadding[0] + boundsPadding[2];
|
|
20324
|
-
}
|
|
20325
|
-
return {
|
|
20326
|
-
x,
|
|
20327
|
-
y,
|
|
20328
|
-
width,
|
|
20329
|
-
height
|
|
20330
|
-
};
|
|
20331
|
-
}
|
|
20332
|
-
class DefaultImageRenderContribution extends DefaultRectRenderContribution {
|
|
20333
|
-
constructor() {
|
|
20334
|
-
super(...arguments);
|
|
20335
|
-
this.time = BaseRenderContributionTime.afterFillStroke;
|
|
20336
|
-
this.useStyle = true;
|
|
20337
|
-
this.order = 0;
|
|
20338
|
-
}
|
|
20339
|
-
drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb) {
|
|
20340
|
-
return super.drawShape(rect, context, x, y, doFill, doStroke, fVisible, sVisible, rectAttribute, drawContext, fillCb, strokeCb);
|
|
20341
|
-
}
|
|
20342
|
-
}
|
|
20343
|
-
const defaultImageRenderContribution = new DefaultImageRenderContribution();
|
|
20344
|
-
const defaultImageBackgroundRenderContribution = new DefaultImageBackgroundRenderContribution();
|
|
20345
|
-
|
|
20346
20358
|
class DefaultSymbolRenderContribution {
|
|
20347
20359
|
constructor() {
|
|
20348
20360
|
this.time = BaseRenderContributionTime.afterFillStroke;
|
|
@@ -22649,12 +22661,12 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
22649
22661
|
super();
|
|
22650
22662
|
this.imageRenderContribitions = imageRenderContribitions;
|
|
22651
22663
|
this.numberType = IMAGE_NUMBER_TYPE;
|
|
22652
|
-
this.builtinContributions = [
|
|
22664
|
+
this.builtinContributions = [defaultImageBackgroundRenderContribution];
|
|
22653
22665
|
this.init(imageRenderContribitions);
|
|
22654
22666
|
}
|
|
22655
|
-
drawShape(image, context, x, y, drawContext, params, fillCb
|
|
22667
|
+
drawShape(image, context, x, y, drawContext, params, fillCb) {
|
|
22656
22668
|
const imageAttribute = getTheme(image).image;
|
|
22657
|
-
const { width = imageAttribute.width, height = imageAttribute.height, repeatX = imageAttribute.repeatX, repeatY = imageAttribute.repeatY,
|
|
22669
|
+
const { width = imageAttribute.width, height = imageAttribute.height, repeatX = imageAttribute.repeatX, repeatY = imageAttribute.repeatY, cornerRadius = imageAttribute.cornerRadius, image: url } = image.attribute;
|
|
22658
22670
|
const data = this.valid(image, imageAttribute, fillCb);
|
|
22659
22671
|
if (!data) {
|
|
22660
22672
|
return;
|
|
@@ -22706,15 +22718,6 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
22706
22718
|
}
|
|
22707
22719
|
}
|
|
22708
22720
|
}
|
|
22709
|
-
if (doStroke) {
|
|
22710
|
-
if (strokeCb) {
|
|
22711
|
-
strokeCb(context, image.attribute, imageAttribute);
|
|
22712
|
-
}
|
|
22713
|
-
else if (sVisible) {
|
|
22714
|
-
context.setStrokeStyle(image, image.attribute, originX - x, originY - y, imageAttribute);
|
|
22715
|
-
context.stroke();
|
|
22716
|
-
}
|
|
22717
|
-
}
|
|
22718
22721
|
this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);
|
|
22719
22722
|
}
|
|
22720
22723
|
draw(image, renderService, drawContext) {
|
|
@@ -25817,15 +25820,7 @@ function initIsBrowserEnv() {
|
|
|
25817
25820
|
return;
|
|
25818
25821
|
}
|
|
25819
25822
|
try {
|
|
25820
|
-
|
|
25821
|
-
const ctx = canvas.getContext('2d');
|
|
25822
|
-
_isBrowserEnv = !!(window &&
|
|
25823
|
-
!!canvas.getBoundingClientRect &&
|
|
25824
|
-
!!requestAnimationFrame &&
|
|
25825
|
-
!!window.devicePixelRatio &&
|
|
25826
|
-
ctx &&
|
|
25827
|
-
!!ctx.isPointInPath &&
|
|
25828
|
-
!!ctx.isPointInStroke);
|
|
25823
|
+
_isBrowserEnv = globalThis === window;
|
|
25829
25824
|
if (_isBrowserEnv) {
|
|
25830
25825
|
_isBrowserEnv = !!document.createElement;
|
|
25831
25826
|
}
|
|
@@ -28520,4 +28515,4 @@ function registerWrapTextGraphic() {
|
|
|
28520
28515
|
graphicCreator.RegisterGraphicCreator('wrapText', createWrapText);
|
|
28521
28516
|
}
|
|
28522
28517
|
|
|
28523
|
-
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution,
|
|
28518
|
+
export { ACustomAnimate, ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, Animate, AnimateGroup, AnimateGroup1, AnimateMode, AnimateStatus, AnimateStepType, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeAnimate, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, CbAnimate, Circle, CircleRender, CircleRenderContribution, ClipAngleAnimate, ClipDirectionAnimate, ClipGraphicAnimate, ClipRadiusAnimate, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Container, ContainerModule, Context2dFactory, ContributionProvider, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageBackgroundRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultMorphingAnimateConfig, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStateAnimateConfig, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTicker, DefaultTimeline, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction$1 as Direction, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FadeInPlus, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, Graphic, GraphicAnimate, GraphicCreator$1 as GraphicCreator, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupFadeIn, GroupFadeOut, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncreaseCount, IncrementalDrawContribution, InputText, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, ManualTickHandler, ManualTicker, Mat4Allocate, MatrixAllocate, Meteor, MonotoneX, MonotoneY, MorphingPath, MotionPath, MultiToOneMorphingPath, NOWORK_ANIMATE_ATTR, Node, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PickItemInterceptor, PickerService, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RAFTickHandler, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, ResourceLoader, RichText, RichTextRender, RotateBySphereAnimate, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StaticLayerHandlerContribution, Step$1 as Step, StreamLight, SubAnimate, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, TagPointsUpdate, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TimeOutTickHandler, TransformUtil, UpdateTag, VGlobal, VWindow, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindContributionProvider, bindContributionProviderNoSingletonScope, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache$1 as calcLineCache, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, cloneGraphic, colorEqual, colorStringInterpolationToStr, container, cornerTangents, createArc, createArc3d, createArea, createCircle, createColor, createConicalGradient, createGlyph, createGroup, createImage, createLine, createMat4, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, defaultTicker, defaultTimeline, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawIncrementalAreaSegments, drawIncrementalSegments, drawPathProxy, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getConicGradientAt, getContextFont, getCurrentEnv, getExtraModelMatrix, getModelMatrix, getRichTextBounds, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, imageModule, incrementalAddTo, inject, injectable, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, intersect, isBrowserEnv, isNodeEnv, isSvg, isTransformKey, isXML, layerService, lineModule, lookAt, mat3Tomat4, mat4Allocate, matrixAllocate, morphPath, multiInject, multiToOneMorph, multiply, multiplyMat4Mat3, multiplyMat4Mat4, named, newThemeObj, oneToMultiMorph, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$2 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerGlyphGraphic, registerGroupGraphic, registerImageGraphic, registerLineGraphic, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerSymbolGraphic, registerTextGraphic, registerWrapTextGraphic, renderCommandList, rewriteProto, richtextModule, rotateX, rotateY, runFill, runStroke, segments, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitGraphic, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformKeys, transformMat4, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
|
package/es/animate/config.js
CHANGED
|
@@ -65,6 +65,7 @@ export declare class StreamLight extends ACustomAnimate<any> {
|
|
|
65
65
|
constructor(from: any, to: any, duration: number, easing: EasingType, params?: {
|
|
66
66
|
attribute?: Partial<IRectAttribute | ILineAttribute>;
|
|
67
67
|
streamLength?: number;
|
|
68
|
+
isHorizontal?: boolean;
|
|
68
69
|
});
|
|
69
70
|
getEndProps(): Record<string, any>;
|
|
70
71
|
onStart(): void;
|
|
@@ -203,16 +203,16 @@ export class StreamLight extends ACustomAnimate {
|
|
|
203
203
|
this[type] = line, line.pathProxy = new CustomPath2D, root.add(line);
|
|
204
204
|
}
|
|
205
205
|
onStartRect() {
|
|
206
|
-
var _a;
|
|
207
|
-
const root = this.target.attachShadow(), height = this.target.AABBBounds
|
|
208
|
-
|
|
206
|
+
var _a, _b, _c;
|
|
207
|
+
const root = this.target.attachShadow(), isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b, sizeAttr = isHorizontal ? "height" : "width", otherSizeAttr = isHorizontal ? "width" : "height", size = this.target.AABBBounds[sizeAttr](), y = isHorizontal ? 0 : this.target.AABBBounds.y1, rect = application.graphicService.creator.rect(Object.assign(Object.assign({
|
|
208
|
+
[sizeAttr]: size,
|
|
209
209
|
fill: "#bcdeff",
|
|
210
210
|
shadowBlur: 30,
|
|
211
211
|
shadowColor: "#bcdeff"
|
|
212
|
-
}, null === (
|
|
212
|
+
}, null === (_c = this.params) || void 0 === _c ? void 0 : _c.attribute), {
|
|
213
213
|
x: 0,
|
|
214
|
-
y:
|
|
215
|
-
|
|
214
|
+
y: y,
|
|
215
|
+
[otherSizeAttr]: 0
|
|
216
216
|
}));
|
|
217
217
|
this.rect = rect, root.add(rect);
|
|
218
218
|
}
|
|
@@ -224,18 +224,36 @@ export class StreamLight extends ACustomAnimate {
|
|
|
224
224
|
return this.rect ? this.onUpdateRect(end, ratio, out) : this.line || this.area ? this.onUpdateLineOrArea(end, ratio, out) : void 0;
|
|
225
225
|
}
|
|
226
226
|
onUpdateRect(end, ratio, out) {
|
|
227
|
-
var _a, _b, _c, _d, _e, _f;
|
|
228
|
-
const
|
|
229
|
-
|
|
230
|
-
x: x,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
227
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
228
|
+
const isHorizontal = null === (_b = null === (_a = this.params) || void 0 === _a ? void 0 : _a.isHorizontal) || void 0 === _b || _b, parentAttr = this.target.attribute;
|
|
229
|
+
if (isHorizontal) {
|
|
230
|
+
const parentWidth = null !== (_d = null !== (_c = parentAttr.width) && void 0 !== _c ? _c : parentAttr.x1 - parentAttr.x) && void 0 !== _d ? _d : 250, streamLength = null !== (_f = null === (_e = this.params) || void 0 === _e ? void 0 : _e.streamLength) && void 0 !== _f ? _f : parentWidth, maxLength = null !== (_j = null === (_h = null === (_g = this.params) || void 0 === _g ? void 0 : _g.attribute) || void 0 === _h ? void 0 : _h.width) && void 0 !== _j ? _j : 60, startX = -maxLength, currentX = startX + (streamLength - startX) * ratio, x = Math.max(currentX, 0), w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX), width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
|
|
231
|
+
this.rect.setAttributes({
|
|
232
|
+
x: x,
|
|
233
|
+
width: width
|
|
234
|
+
}, !1, {
|
|
235
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
236
|
+
animationState: {
|
|
237
|
+
ratio: ratio,
|
|
238
|
+
end: end
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
} else {
|
|
242
|
+
const parentHeight = null !== (_l = null !== (_k = parentAttr.height) && void 0 !== _k ? _k : parentAttr.y1 - parentAttr.y) && void 0 !== _l ? _l : 250, streamLength = null !== (_o = null === (_m = this.params) || void 0 === _m ? void 0 : _m.streamLength) && void 0 !== _o ? _o : parentHeight, maxLength = null !== (_r = null === (_q = null === (_p = this.params) || void 0 === _p ? void 0 : _p.attribute) || void 0 === _q ? void 0 : _q.height) && void 0 !== _r ? _r : 60, currentY = parentHeight - (streamLength + maxLength) * ratio;
|
|
243
|
+
let y = Math.min(currentY, parentHeight);
|
|
244
|
+
const h = Math.min(parentHeight - currentY, maxLength);
|
|
245
|
+
let height;
|
|
246
|
+
y <= 0 ? (height = Math.max(y + h, 0), y = 0) : height = h, this.rect.setAttributes({
|
|
247
|
+
y: y,
|
|
248
|
+
height: height
|
|
249
|
+
}, !1, {
|
|
250
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
251
|
+
animationState: {
|
|
252
|
+
ratio: ratio,
|
|
253
|
+
end: end
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
239
257
|
}
|
|
240
258
|
onUpdateLineOrArea(end, ratio, out) {
|
|
241
259
|
const target = this.line || this.area;
|