Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/chart/candlestick/CandlestickSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export interface CandlestickStateOption {
}
export interface CandlestickDataItemOption
extends CandlestickStateOption, StatesOptionMixin<CandlestickStateOption, ExtraStateOption> {
cursor?: string
value: CandlestickDataValue
}

Expand Down
6 changes: 6 additions & 0 deletions src/chart/candlestick/CandlestickView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ function setBoxCommon(el: NormalBoxPath, data: SeriesData, dataIndex: number, is
el.useStyle(data.getItemVisual(dataIndex, 'style'));
el.style.strokeNoScale = true;

const cursorStyle = itemModel.getShallow('cursor');
cursorStyle && el.attr('cursor', cursorStyle);

el.__simpleBox = isSimpleBox;

setStatesStylesFromModel(el, itemModel);
Expand Down Expand Up @@ -429,6 +432,9 @@ function setLargeStyle(sign: number, el: LargeBoxPath, seriesModel: CandlestickS
el.useStyle(itemStyle);
el.style.fill = null;
el.style.stroke = borderColor;

const cursorStyle = seriesModel.get('cursor');
cursorStyle && el.attr('cursor', cursorStyle);
}


Expand Down
6 changes: 6 additions & 0 deletions src/component/dataZoom/InsideZoomModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ export interface InsideDataZoomOption extends DataZoomOption {

preventDefaultMouseMove?: boolean

/**
* Mouse cursor styles on states "can grab" and "grabbing".
*/
cursorGrab?: string
cursorGrabbing?: string

/**
* Inside dataZoom don't support textStyle
*/
Expand Down
11 changes: 10 additions & 1 deletion src/component/dataZoom/roams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { makeInner } from '../../util/model';
import { Dictionary, RoamOptionMixin, ZRElementEvent } from '../../util/types';
import ExtensionAPI from '../../core/ExtensionAPI';
import InsideZoomModel from './InsideZoomModel';
import { each, curry, Curry1, HashMap, createHashMap } from 'zrender/src/core/util';
import { each, curry, Curry1, HashMap, createHashMap, retrieve2 } from 'zrender/src/core/util';
import {
DataZoomPayloadBatchItem, collectReferCoordSysModelInfo,
DataZoomCoordSysMainType, DataZoomReferCoordSysInfo
Expand Down Expand Up @@ -198,6 +198,8 @@ function mergeControllerParams(
'type_undefined': -1
};
let preventDefaultMouseMove = true;
let cursorGrab: RoamOption['cursorGrab'];
let cursorGrabbing: RoamOption['cursorGrabbing'];

dataZoomInfoMap.each(function (dataZoomInfo) {
const dataZoomModel = dataZoomInfo.model;
Expand All @@ -214,6 +216,11 @@ function mergeControllerParams(
// users may be confused why it does not work when multiple insideZooms exist.
preventDefaultMouseMove = preventDefaultMouseMove
&& dataZoomModel.get('preventDefaultMouseMove', true);

// Intuitively, use the last declared setting in ec option when this axis is covered
// by multiple `dataZoom`s.
cursorGrab = retrieve2(dataZoomModel.get('cursorGrab', true), cursorGrab);
cursorGrabbing = retrieve2(dataZoomModel.get('cursorGrabbing', true), cursorGrabbing);
});

return {
Expand All @@ -234,6 +241,8 @@ function mergeControllerParams(
roamTrigger: null,
isInSelf: coordSysRecord.containsPoint
},
cursorGrab,
cursorGrabbing,
}
};
}
Expand Down
12 changes: 10 additions & 2 deletions src/component/helper/RoamController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ export interface RoamOption {
* If fixed the page when pan
*/
preventDefaultMouseMove?: boolean

/**
* Cursor styles
*/
cursorGrab?: string // 'grab' by default.
cursorGrabbing?: string // 'grabbing' by default.
}
type RoamSetting = Omit<Required<RoamOption>, 'zInfo'> & {
zInfoParsed: {
Expand Down Expand Up @@ -174,6 +180,8 @@ class RoamController extends Eventful<RoamEventDefinition> {
preventDefaultMouseMove: true,
zInfoParsed,
triggerInfo,
cursorGrab: 'grab', // CSS cursor 'grab'
cursorGrabbing: 'grabbing', // CSS cursor 'grabbing'
});

if (controlType == null) {
Expand Down Expand Up @@ -257,7 +265,7 @@ class RoamController extends Eventful<RoamEventDefinition> {
if (!target && this._checkPointer(e, x, y)) {
// To indicate users that this area is draggable, otherwise users probably cannot kwown
// that when hovering out of the shape but still inside the bounding rect.
return 'grab';
return this._opt.cursorGrab;
}
if (forReverse) {
return target && (target as Displayable).cursor || 'default';
Expand Down Expand Up @@ -318,7 +326,7 @@ class RoamController extends Eventful<RoamEventDefinition> {
return;
}

zr.setCursorStyle('grabbing');
zr.setCursorStyle(this._opt.cursorGrabbing);

const oldX = this._x;
const oldY = this._y;
Expand Down
Loading