From eb23485a6c3215bd37dd5c4b14889891729eaf5d Mon Sep 17 00:00:00 2001 From: sz-p Date: Thu, 28 Nov 2024 20:44:39 +0800 Subject: [PATCH 1/2] fix(visualMap): cursor is pointer on selectedMode=false --- src/component/visualMap/PiecewiseView.ts | 25 ++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/src/component/visualMap/PiecewiseView.ts b/src/component/visualMap/PiecewiseView.ts index d94b0ed758..93cf0e7c76 100644 --- a/src/component/visualMap/PiecewiseView.ts +++ b/src/component/visualMap/PiecewiseView.ts @@ -23,7 +23,7 @@ import * as graphic from '../../util/graphic'; import {createSymbol} from '../../util/symbol'; import * as layout from '../../util/layout'; import * as helper from './helper'; -import PiecewiseModel from './PiecewiseModel'; +import PiecewiseModel, { PiecewiseVisualMapOption } from './PiecewiseModel'; import { TextAlign } from 'zrender/src/core/types'; import { VisualMappingOption } from '../../visual/VisualMapping'; import { createTextStyle } from '../../label/labelStyle'; @@ -43,6 +43,7 @@ class PiecewiseVisualMapView extends VisualMapView { const visualMapModel = this.visualMapModel; const textGap = visualMapModel.get('textGap'); + const selectMode = visualMapModel.get('selectedMode'); const textStyleModel = visualMapModel.textStyleModel; const textFont = textStyleModel.getFont(); const textFill = textStyleModel.getTextColor(); @@ -68,13 +69,12 @@ class PiecewiseVisualMapView extends VisualMapView { const representValue = visualMapModel.getRepresentValue(piece) as number; this._createItemSymbol( - itemGroup, representValue, [0, 0, itemSize[0], itemSize[1]] + itemGroup, representValue, [0, 0, itemSize[0], itemSize[1]], selectMode ); if (showLabel) { const visualState = this.visualMapModel.getValueState(representValue); - - itemGroup.add(new graphic.Text({ + const itemText = new graphic.Text({ style: { x: itemAlign === 'right' ? -textGap : itemSize[0] + textGap, y: itemSize[1] / 2, @@ -83,9 +83,11 @@ class PiecewiseVisualMapView extends VisualMapView { align: itemAlign as TextAlign, font: textFont, fill: textFill, - opacity: visualState === 'outOfRange' ? 0.5 : 1 + opacity: visualState === 'outOfRange' ? 0.5 : 1, } - })); + }); + itemText.silent = !selectMode; + itemGroup.add(itemText); } thisGroup.add(itemGroup); @@ -199,15 +201,18 @@ class PiecewiseVisualMapView extends VisualMapView { private _createItemSymbol( group: graphic.Group, representValue: number, - shapeParam: number[] + shapeParam: number[], + selectMode: PiecewiseVisualMapOption['selectedMode'], ) { - group.add(createSymbol( + const itemSymbol = createSymbol( // symbol will be string this.getControllerVisual(representValue, 'symbol') as string, shapeParam[0], shapeParam[1], shapeParam[2], shapeParam[3], // color will be string this.getControllerVisual(representValue, 'color') as string - )); + ); + itemSymbol.silent = !selectMode; + group.add(itemSymbol); } private _onItemClick( @@ -241,4 +246,4 @@ class PiecewiseVisualMapView extends VisualMapView { } } -export default PiecewiseVisualMapView; \ No newline at end of file +export default PiecewiseVisualMapView; From aa2baff56b543901bebb460a323a528532f740af Mon Sep 17 00:00:00 2001 From: sz-p Date: Thu, 28 Nov 2024 20:44:54 +0800 Subject: [PATCH 2/2] test(visualMap): cursor is pointer on selectedMode=false --- test/visualMap-selectMode.html | 144 +++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 test/visualMap-selectMode.html diff --git a/test/visualMap-selectMode.html b/test/visualMap-selectMode.html new file mode 100644 index 0000000000..b254e0ea50 --- /dev/null +++ b/test/visualMap-selectMode.html @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + +
+
+ + + + + +