@visactor/vrender-core 0.19.8-beta.2 → 0.19.8
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/custom-animate.d.ts +0 -1
- package/cjs/animate/custom-animate.js +18 -36
- package/cjs/animate/custom-animate.js.map +1 -1
- package/cjs/env-check.js +3 -1
- package/cjs/env-check.js.map +1 -1
- package/cjs/graphic/glyph.js +5 -3
- package/cjs/graphic/glyph.js.map +1 -1
- package/cjs/graphic/graphic-service/graphic-service.d.ts +2 -1
- package/cjs/graphic/graphic-service/graphic-service.js +4 -2
- 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 +3 -0
- package/cjs/interface/graphic-service.js.map +1 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.d.ts +9 -1
- package/cjs/render/contributions/render/contributions/image-contribution-render.js +15 -3
- 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 +5 -4
- package/cjs/render/contributions/render/image-render.js.map +1 -1
- package/dist/index.es.js +167 -162
- package/es/animate/custom-animate.d.ts +0 -1
- package/es/animate/custom-animate.js +18 -36
- package/es/animate/custom-animate.js.map +1 -1
- package/es/env-check.js +3 -1
- package/es/env-check.js.map +1 -1
- package/es/graphic/glyph.js +5 -3
- package/es/graphic/glyph.js.map +1 -1
- package/es/graphic/graphic-service/graphic-service.d.ts +2 -1
- package/es/graphic/graphic-service/graphic-service.js +4 -3
- 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 +3 -0
- package/es/interface/graphic-service.js.map +1 -1
- package/es/render/contributions/render/contributions/image-contribution-render.d.ts +9 -1
- package/es/render/contributions/render/contributions/image-contribution-render.js +14 -0
- 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 +7 -5
- package/es/render/contributions/render/image-render.js.map +1 -1
- package/package.json +3 -3
|
@@ -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,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;IACtC,CAAC;IAED,SAAS,CACP,KAAa,EACb,OAAmB,EACnB,CAAS,EACT,CAAS,EACT,WAAyB,EACzB,MAAiC,EACjC,MAIY;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,OAAO,EAChC,OAAO,GAAG,cAAc,CAAC,OAAO,EAChC,YAAY,GAAG,cAAc,CAAC,YAAY,EAC1C,KAAK,EAAE,GAAG,EACX,GAAG,KAAK,CAAC,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IAAI,CAAC,KAAa,EAAE,aAA6B,EAAE,WAAyB;QAC1E,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YAC5B,OAAO;SACR;QACD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAIrC,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,IAAA,iBAAQ,EAAC,GAAG,CAAC,EAAE;YAC5C,uBAAc,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YACxC,OAAO;SACR;aAAM,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,EAAE;YAClC,OAAO;SACR;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QACD,MAAM,cAAc,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC;QAC7C,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;IACxD,CAAC;CACF,CAAA;AA9HY,wBAAwB;IADpC,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"]}
|
|
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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AAM,CAAC,CAAC;IAClH,CAAC;IAED,IAAI,CAAC,KAAa,EAAE,aAA6B,EAAE,WAAyB;QAC1E,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC,SAAS,CAAC;QACvC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE;YAC5B,OAAO;SACR;QACD,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAIrC,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,IAAA,iBAAQ,EAAC,GAAG,CAAC,EAAE;YAC5C,uBAAc,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;YACxC,OAAO;SACR;aAAM,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,EAAE;YAClC,OAAO;SACR;QAED,MAAM,EAAE,OAAO,EAAE,GAAG,aAAa,CAAC,UAAU,CAAC;QAC7C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO;SACR;QACD,MAAM,cAAc,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC,KAAK,CAAC;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"]}
|
package/dist/index.es.js
CHANGED
|
@@ -8575,14 +8575,10 @@ class StreamLight extends ACustomAnimate {
|
|
|
8575
8575
|
root.add(line);
|
|
8576
8576
|
}
|
|
8577
8577
|
onStartRect() {
|
|
8578
|
-
var _a
|
|
8578
|
+
var _a;
|
|
8579
8579
|
const root = this.target.attachShadow();
|
|
8580
|
-
const
|
|
8581
|
-
const
|
|
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 }));
|
|
8580
|
+
const height = this.target.AABBBounds.height();
|
|
8581
|
+
const rect = application.graphicService.creator.rect(Object.assign(Object.assign({ height: height, fill: '#bcdeff', shadowBlur: 30, shadowColor: '#bcdeff' }, (_a = this.params) === null || _a === void 0 ? void 0 : _a.attribute), { x: 0, y: 0, width: 0 }));
|
|
8586
8582
|
this.rect = rect;
|
|
8587
8583
|
root.add(rect);
|
|
8588
8584
|
}
|
|
@@ -8601,56 +8597,25 @@ class StreamLight extends ACustomAnimate {
|
|
|
8601
8597
|
}
|
|
8602
8598
|
}
|
|
8603
8599
|
onUpdateRect(end, ratio, out) {
|
|
8604
|
-
var _a, _b, _c, _d, _e, _f
|
|
8605
|
-
const
|
|
8606
|
-
const
|
|
8607
|
-
|
|
8608
|
-
|
|
8609
|
-
|
|
8610
|
-
|
|
8611
|
-
|
|
8612
|
-
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
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;
|
|
8639
|
-
}
|
|
8640
|
-
else {
|
|
8641
|
-
height = h;
|
|
8600
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8601
|
+
const parentWidth = (_a = this.target.attribute.width) !== null && _a !== void 0 ? _a : 250;
|
|
8602
|
+
const streamLength = (_c = (_b = this.params) === null || _b === void 0 ? void 0 : _b.streamLength) !== null && _c !== void 0 ? _c : parentWidth;
|
|
8603
|
+
const maxLength = (_f = (_e = (_d = this.params) === null || _d === void 0 ? void 0 : _d.attribute) === null || _e === void 0 ? void 0 : _e.width) !== null && _f !== void 0 ? _f : 60;
|
|
8604
|
+
const startX = -maxLength;
|
|
8605
|
+
const currentX = startX + (streamLength - startX) * ratio;
|
|
8606
|
+
const x = Math.max(currentX, 0);
|
|
8607
|
+
const w = Math.min(Math.min(currentX + maxLength, maxLength), streamLength - currentX);
|
|
8608
|
+
const width = w + x > parentWidth ? Math.max(parentWidth - x, 0) : w;
|
|
8609
|
+
this.rect.setAttributes({
|
|
8610
|
+
x,
|
|
8611
|
+
width
|
|
8612
|
+
}, false, {
|
|
8613
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
8614
|
+
animationState: {
|
|
8615
|
+
ratio,
|
|
8616
|
+
end
|
|
8642
8617
|
}
|
|
8643
|
-
|
|
8644
|
-
y,
|
|
8645
|
-
height
|
|
8646
|
-
}, false, {
|
|
8647
|
-
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
8648
|
-
animationState: {
|
|
8649
|
-
ratio,
|
|
8650
|
-
end
|
|
8651
|
-
}
|
|
8652
|
-
});
|
|
8653
|
-
}
|
|
8618
|
+
});
|
|
8654
8619
|
}
|
|
8655
8620
|
onUpdateLineOrArea(end, ratio, out) {
|
|
8656
8621
|
const target = this.line || this.area;
|
|
@@ -15747,6 +15712,7 @@ class Glyph extends Graphic {
|
|
|
15747
15712
|
if (!isChange) {
|
|
15748
15713
|
return;
|
|
15749
15714
|
}
|
|
15715
|
+
this.stopStateAnimates();
|
|
15750
15716
|
const stateAttrs = {};
|
|
15751
15717
|
const subAttrs = this.subGraphic.map(() => ({}));
|
|
15752
15718
|
states.forEach(stateName => {
|
|
@@ -15770,16 +15736,19 @@ class Glyph extends Graphic {
|
|
|
15770
15736
|
this.applyStateAttrs(stateAttrs, states, hasAnimation);
|
|
15771
15737
|
}
|
|
15772
15738
|
clearStates(hasAnimation) {
|
|
15773
|
-
|
|
15774
|
-
|
|
15739
|
+
this.stopStateAnimates();
|
|
15740
|
+
if (this.hasState() && this.normalAttrs) {
|
|
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 = [];
|
|
15775
15750
|
}
|
|
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);
|
|
15781
15751
|
this.normalAttrs = null;
|
|
15782
|
-
this.currentStates = [];
|
|
15783
15752
|
}
|
|
15784
15753
|
clone() {
|
|
15785
15754
|
const glyph = new Glyph(Object.assign({}, this.attribute));
|
|
@@ -18262,6 +18231,7 @@ let DefaultGraphicService = class DefaultGraphicService {
|
|
|
18262
18231
|
this.tempAABBBounds2 = new AABBBounds();
|
|
18263
18232
|
this._rectBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18264
18233
|
this._symbolBoundsContribitions = [new DefaultSymbolOuterBorderBoundsContribution()];
|
|
18234
|
+
this._imageBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18265
18235
|
this._circleBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18266
18236
|
this._arcBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
18267
18237
|
this._pathBoundsContribitions = [new DefaultOuterBorderBoundsContribution()];
|
|
@@ -18790,6 +18760,12 @@ let DefaultGraphicService = class DefaultGraphicService {
|
|
|
18790
18760
|
const tb2 = this.tempAABBBounds2;
|
|
18791
18761
|
tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
|
|
18792
18762
|
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
|
+
});
|
|
18793
18769
|
this.transformAABBBounds(attribute, aabbBounds, imageTheme, false, graphic);
|
|
18794
18770
|
return aabbBounds;
|
|
18795
18771
|
}
|
|
@@ -20121,99 +20097,6 @@ function createRectPath(path, x, y, width, height, rectCornerRadius) {
|
|
|
20121
20097
|
return path;
|
|
20122
20098
|
}
|
|
20123
20099
|
|
|
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
|
-
|
|
20217
20100
|
class DefaultRectRenderContribution {
|
|
20218
20101
|
constructor() {
|
|
20219
20102
|
this.time = BaseRenderContributionTime.afterFillStroke;
|
|
@@ -20355,6 +20238,111 @@ const defaultRectRenderContribution = new DefaultRectRenderContribution();
|
|
|
20355
20238
|
const defaultRectTextureRenderContribution = defaultBaseTextureRenderContribution;
|
|
20356
20239
|
const defaultRectBackgroundRenderContribution = defaultBaseBackgroundRenderContribution;
|
|
20357
20240
|
|
|
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
|
+
|
|
20358
20346
|
class DefaultSymbolRenderContribution {
|
|
20359
20347
|
constructor() {
|
|
20360
20348
|
this.time = BaseRenderContributionTime.afterFillStroke;
|
|
@@ -22661,12 +22649,12 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
22661
22649
|
super();
|
|
22662
22650
|
this.imageRenderContribitions = imageRenderContribitions;
|
|
22663
22651
|
this.numberType = IMAGE_NUMBER_TYPE;
|
|
22664
|
-
this.builtinContributions = [defaultImageBackgroundRenderContribution];
|
|
22652
|
+
this.builtinContributions = [defaultImageRenderContribution, defaultImageBackgroundRenderContribution];
|
|
22665
22653
|
this.init(imageRenderContribitions);
|
|
22666
22654
|
}
|
|
22667
|
-
drawShape(image, context, x, y, drawContext, params, fillCb) {
|
|
22655
|
+
drawShape(image, context, x, y, drawContext, params, fillCb, strokeCb) {
|
|
22668
22656
|
const imageAttribute = getTheme(image).image;
|
|
22669
|
-
const { width = imageAttribute.width, height = imageAttribute.height, repeatX = imageAttribute.repeatX, repeatY = imageAttribute.repeatY, cornerRadius = imageAttribute.cornerRadius, image: url } = image.attribute;
|
|
22657
|
+
const { width = imageAttribute.width, height = imageAttribute.height, repeatX = imageAttribute.repeatX, repeatY = imageAttribute.repeatY, x: originX = imageAttribute.x, y: originY = imageAttribute.y, cornerRadius = imageAttribute.cornerRadius, image: url } = image.attribute;
|
|
22670
22658
|
const data = this.valid(image, imageAttribute, fillCb);
|
|
22671
22659
|
if (!data) {
|
|
22672
22660
|
return;
|
|
@@ -22718,6 +22706,15 @@ let DefaultCanvasImageRender = class DefaultCanvasImageRender extends BaseRender
|
|
|
22718
22706
|
}
|
|
22719
22707
|
}
|
|
22720
22708
|
}
|
|
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
|
+
}
|
|
22721
22718
|
this.afterRenderStep(image, context, x, y, doFill, false, fVisible, false, imageAttribute, drawContext, fillCb);
|
|
22722
22719
|
}
|
|
22723
22720
|
draw(image, renderService, drawContext) {
|
|
@@ -25820,7 +25817,15 @@ function initIsBrowserEnv() {
|
|
|
25820
25817
|
return;
|
|
25821
25818
|
}
|
|
25822
25819
|
try {
|
|
25823
|
-
|
|
25820
|
+
const canvas = document.createElement('canvas');
|
|
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);
|
|
25824
25829
|
if (_isBrowserEnv) {
|
|
25825
25830
|
_isBrowserEnv = !!document.createElement;
|
|
25826
25831
|
}
|
|
@@ -28515,4 +28520,4 @@ function registerWrapTextGraphic() {
|
|
|
28515
28520
|
graphicCreator.RegisterGraphicCreator('wrapText', createWrapText);
|
|
28516
28521
|
}
|
|
28517
28522
|
|
|
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 };
|
|
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, DefaultImageRenderContribution, 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, defaultImageRenderContribution, 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 };
|
|
@@ -65,7 +65,6 @@ 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;
|
|
69
68
|
});
|
|
70
69
|
getEndProps(): Record<string, any>;
|
|
71
70
|
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(),
|
|
208
|
-
|
|
206
|
+
var _a;
|
|
207
|
+
const root = this.target.attachShadow(), height = this.target.AABBBounds.height(), rect = application.graphicService.creator.rect(Object.assign(Object.assign({
|
|
208
|
+
height: height,
|
|
209
209
|
fill: "#bcdeff",
|
|
210
210
|
shadowBlur: 30,
|
|
211
211
|
shadowColor: "#bcdeff"
|
|
212
|
-
}, null === (
|
|
212
|
+
}, null === (_a = this.params) || void 0 === _a ? void 0 : _a.attribute), {
|
|
213
213
|
x: 0,
|
|
214
|
-
y:
|
|
215
|
-
|
|
214
|
+
y: 0,
|
|
215
|
+
width: 0
|
|
216
216
|
}));
|
|
217
217
|
this.rect = rect, root.add(rect);
|
|
218
218
|
}
|
|
@@ -224,36 +224,18 @@ 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
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
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
|
-
}
|
|
227
|
+
var _a, _b, _c, _d, _e, _f;
|
|
228
|
+
const parentWidth = null !== (_a = this.target.attribute.width) && void 0 !== _a ? _a : 250, streamLength = null !== (_c = null === (_b = this.params) || void 0 === _b ? void 0 : _b.streamLength) && void 0 !== _c ? _c : parentWidth, maxLength = null !== (_f = null === (_e = null === (_d = this.params) || void 0 === _d ? void 0 : _d.attribute) || void 0 === _e ? void 0 : _e.width) && void 0 !== _f ? _f : 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;
|
|
229
|
+
this.rect.setAttributes({
|
|
230
|
+
x: x,
|
|
231
|
+
width: width
|
|
232
|
+
}, !1, {
|
|
233
|
+
type: AttributeUpdateType.ANIMATE_PLAY,
|
|
234
|
+
animationState: {
|
|
235
|
+
ratio: ratio,
|
|
236
|
+
end: end
|
|
237
|
+
}
|
|
238
|
+
});
|
|
257
239
|
}
|
|
258
240
|
onUpdateLineOrArea(end, ratio, out) {
|
|
259
241
|
const target = this.line || this.area;
|