diff --git a/src/chart/helper/Line.ts b/src/chart/helper/Line.ts index 961502bda2c2e3ed8b77700379170777251f0b8d..bbfb774ba5aba47784b143a004e58d2370ad4b35 100644 --- a/src/chart/helper/Line.ts +++ b/src/chart/helper/Line.ts @@ -64,6 +64,22 @@ interface InnerLineLabel extends LineLabel { function makeSymbolTypeKey(symbolCategory: 'fromSymbol' | 'toSymbol') { return '_' + symbolCategory + 'Type' as '_fromSymbolType' | '_toSymbolType'; } +function makeSymbolTypeValue(name: 'fromSymbol' | 'toSymbol', lineData: LineList, idx: number) { + const symbolType = lineData.getItemVisual(idx, name); + if (!symbolType || symbolType === 'none') { + return symbolType; + } + const symbolSize = lineData.getItemVisual(idx, name + 'Size' as 'fromSymbolSize' | 'toSymbolSize'); + const symbolRotate = lineData.getItemVisual(idx, name + 'Rotate' as 'fromSymbolRotate' | 'toSymbolRotate'); + const symbolOffset = lineData.getItemVisual(idx, name + 'Offset' as 'fromSymbolOffset' | 'toSymbolOffset'); + const symbolKeepAspect = lineData.getItemVisual(idx, + name + 'KeepAspect' as 'fromSymbolKeepAspect' | 'toSymbolKeepAspect'); + const symbolSizeArr = symbolUtil.normalizeSymbolSize(symbolSize); + + const symbolOffsetArr = symbolUtil.normalizeSymbolOffset(symbolOffset || 0, symbolSizeArr); + + return symbolType + symbolSizeArr + symbolOffsetArr + (symbolRotate || '') + (symbolKeepAspect || ''); +} /** * @inner @@ -164,7 +180,7 @@ class Line extends graphic.Group { // it will be updated after line#update. // Or symbol position and rotation update in line#beforeUpdate will be one frame slow this.add(symbol); - this[makeSymbolTypeKey(symbolCategory)] = lineData.getItemVisual(idx, symbolCategory); + this[makeSymbolTypeKey(symbolCategory)] = makeSymbolTypeValue(symbolCategory, lineData, idx); }, this); this._updateCommonStl(lineData, idx, seriesScope); @@ -184,7 +200,7 @@ class Line extends graphic.Group { graphic.updateProps(line, target, seriesModel, idx); each(SYMBOL_CATEGORIES, function (symbolCategory) { - const symbolType = (lineData as LineList).getItemVisual(idx, symbolCategory); + const symbolType = makeSymbolTypeValue(symbolCategory, lineData as LineList, idx); const key = makeSymbolTypeKey(symbolCategory); // Symbol changed if (this[key] !== symbolType) { diff --git a/test/lines-symbolSize-update.html b/test/lines-symbolSize-update.html new file mode 100644 index 0000000000000000000000000000000000000000..2ed2fa7d314143979c55f8ec3050a9d22151668e --- /dev/null +++ b/test/lines-symbolSize-update.html @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + +
+ + + + + + + diff --git a/test/runTest/actions/__meta__.json b/test/runTest/actions/__meta__.json index 46d6b8e41a7f6a5661843e57c20960ff186620c5..7ee9a15209e9af046602e60d2ecc2c7bd1fd45a5 100644 --- a/test/runTest/actions/__meta__.json +++ b/test/runTest/actions/__meta__.json @@ -130,6 +130,7 @@ "line-sampling": 2, "line-visual2": 2, "lines-bus": 1, + "lines-symbolSize-update": 1, "map": 3, "map-contour": 2, "map-default": 1, diff --git a/test/runTest/actions/lines-symbolSize-update.json b/test/runTest/actions/lines-symbolSize-update.json new file mode 100644 index 0000000000000000000000000000000000000000..aee5b67469d4ee9be24a94cf58e8f636f9745800 --- /dev/null +++ b/test/runTest/actions/lines-symbolSize-update.json @@ -0,0 +1 @@ +[{"name":"Action 1","ops":[{"type":"mousemove","time":484,"x":83,"y":96},{"type":"mousemove","time":685,"x":91,"y":83},{"type":"mousemove","time":899,"x":92,"y":83},{"type":"mousedown","time":1506,"x":92,"y":83},{"type":"mouseup","time":1511,"x":92,"y":83},{"time":1512,"delay":400,"type":"screenshot-auto"}],"scrollY":0,"scrollX":0,"timestamp":1679391497375}] \ No newline at end of file