Skip to content

Commit c3ce6e0

Browse files
committed
fix(dataZoom): use handleLabel.show
1 parent b04f36e commit c3ce6e0

File tree

3 files changed

+162
-131
lines changed

3 files changed

+162
-131
lines changed

src/component/dataZoom/SliderZoomModel.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ import {
2828
} from '../../util/types';
2929
import { inheritDefaultOption } from '../../util/component';
3030

31+
interface SliderHandleLabelOption {
32+
show?: boolean
33+
}
34+
3135
export interface SliderDataZoomOption extends DataZoomOption, BoxLayoutOptionMixin {
3236

3337
show?: boolean
@@ -79,7 +83,7 @@ export interface SliderDataZoomOption extends DataZoomOption, BoxLayoutOptionMix
7983

8084
handleIcon?: string
8185

82-
handleLabelShow?: boolean
86+
handleLabel?: SliderHandleLabelOption
8387

8488
/**
8589
* number: height of icon. width will be calculated according to the aspect of icon.
@@ -119,7 +123,7 @@ export interface SliderDataZoomOption extends DataZoomOption, BoxLayoutOptionMix
119123
brushStyle?: ItemStyleOption
120124

121125
emphasis?: {
122-
handleLabelShow?: boolean
126+
handleLabel: SliderHandleLabelOption
123127
handleStyle?: ItemStyleOption
124128
moveHandleStyle?: ItemStyleOption
125129
}
@@ -174,7 +178,6 @@ class SliderZoomModel extends DataZoomModel<SliderDataZoomOption> {
174178
// Color of selected window.
175179
fillerColor: 'rgba(135,175,274,0.2)',
176180
handleIcon: 'path://M-9.35,34.56V42m0-40V9.5m-2,0h4a2,2,0,0,1,2,2v21a2,2,0,0,1-2,2h-4a2,2,0,0,1-2-2v-21A2,2,0,0,1-11.35,9.5Z',
177-
handleLabelShow: false,
178181
// Percent of the slider height
179182
handleSize: '100%',
180183

@@ -205,7 +208,9 @@ class SliderZoomModel extends DataZoomModel<SliderDataZoomOption> {
205208
},
206209

207210
emphasis: {
208-
handleLabelShow: true,
211+
handleLabel: {
212+
show: true
213+
},
209214
handleStyle: {
210215
borderColor: '#8FB0F7'
211216
},

src/component/dataZoom/SliderZoomView.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,8 @@ class SliderZoomView extends DataZoomView {
619619
sliderGroup.add(handles[handleIndex] = path);
620620

621621
const textStyleModel = dataZoomModel.getModel('textStyle');
622-
const handleLabelShow = dataZoomModel.get('handleLabelShow');
622+
const handleLabel = dataZoomModel.get('handleLabel') || {};
623+
const handleLabelShow = handleLabel.show || false;
623624

624625
thisGroup.add(
625626
handleLabels[handleIndex] = new graphic.Text({
@@ -889,9 +890,10 @@ class SliderZoomView extends DataZoomView {
889890
* @param isEmphasis true: show, false: hide
890891
*/
891892
private _showDataInfo(isEmphasis?: boolean) {
892-
const normalShow = this.dataZoomModel.get('handleLabelShow');
893-
const emphasisShow = this.dataZoomModel.getModel('emphasis')
894-
.get('handleLabelShow');
893+
const handleLabel = this.dataZoomModel.get('handleLabel') || {};
894+
const normalShow = handleLabel.show || false;
895+
const emphasisHandleLabel = this.dataZoomModel.getModel(['emphasis', 'handleLabel']);
896+
const emphasisShow = emphasisHandleLabel.get('show') || false;
895897
// Dragging is considered as emphasis, unless emphasisShow is false
896898
const toShow = (isEmphasis || this._dragging)
897899
? emphasisShow

test/dataZoom-handleLabelShow.html

Lines changed: 147 additions & 123 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)