mirror of
https://gitee.com/antv/g6.git
synced 2024-11-29 18:28:19 +08:00
fix(behavior): adjust setCursor value logic
This commit is contained in:
parent
38d690b218
commit
28f61af00f
@ -94,6 +94,12 @@ export interface DragElementOptions extends BaseBehaviorOptions, Prefix<'shadow'
|
||||
* <en/> Cursor style
|
||||
*/
|
||||
cursor?: {
|
||||
/**
|
||||
* <zh/> 默认指针样式
|
||||
*
|
||||
* <en/> Default cursor style
|
||||
*/
|
||||
default?: Cursor;
|
||||
/**
|
||||
* <zh/> 可抓取指针样式
|
||||
*
|
||||
@ -129,6 +135,7 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
||||
shadowStrokeOpacity: 0.9,
|
||||
shadowLineDash: [5, 5],
|
||||
cursor: {
|
||||
default: 'default',
|
||||
grab: 'grab',
|
||||
grabbing: 'grabbing',
|
||||
},
|
||||
@ -307,9 +314,10 @@ export class DragElement extends BaseBehavior<DragElementOptions> {
|
||||
if (this.isDragging) return;
|
||||
const { type } = event;
|
||||
const { canvas } = this.context;
|
||||
const { cursor } = this.options;
|
||||
|
||||
if (type === CommonEvent.POINTER_ENTER) canvas.setCursor('grab');
|
||||
else canvas.setCursor('default');
|
||||
if (type === CommonEvent.POINTER_ENTER) canvas.setCursor(cursor?.grab || 'grab');
|
||||
else canvas.setCursor(cursor?.default || 'default');
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user