@@ -71,6 +71,9 @@ export class Selector extends Service {
71
71
}
72
72
73
73
public select ( ...children : ChildType [ ] ) : void {
74
+ if ( ! this . enable ) {
75
+ return ;
76
+ }
74
77
this . selected . forEach ( ( child ) => child . draggable ( false ) ) ;
75
78
this . selected = [ ] ;
76
79
this . selector . nodes ( [ ] ) ;
@@ -83,11 +86,22 @@ export class Selector extends Service {
83
86
}
84
87
85
88
private onMouseDown ( ) : void {
89
+ if ( ! this . enable ) {
90
+ return ;
91
+ }
86
92
this . rubberStartPoint . clone ( this . app . pointer ) ;
87
93
this . rubberRect . setPosition ( this . rubberStartPoint ) ;
88
94
}
89
95
90
- private onMouseMove ( ) : void {
96
+ private onMouseMove ( { event } : EventArgs [ 'mouse:move' ] ) : void {
97
+ if ( ! this . enable ) {
98
+ return ;
99
+ }
100
+ if ( event . target instanceof Konva . Stage ) {
101
+ document . body . style . cursor = 'default' ;
102
+ } else {
103
+ document . body . style . cursor = 'move' ;
104
+ }
91
105
const position = new Point (
92
106
Math . min ( this . app . pointer . x , this . rubberStartPoint . x ) ,
93
107
Math . min ( this . app . pointer . y , this . rubberStartPoint . y )
@@ -101,10 +115,16 @@ export class Selector extends Service {
101
115
}
102
116
103
117
private onMouseUp ( ) : void {
118
+ if ( ! this . enable ) {
119
+ return ;
120
+ }
104
121
this . rubberRect . visible ( false ) ;
105
122
}
106
123
107
124
private onMouseClick ( { event } : EventArgs [ 'mouse:click' ] ) : void {
125
+ if ( ! this . enable ) {
126
+ return ;
127
+ }
108
128
if ( event . target instanceof Konva . Stage ) {
109
129
this . select ( ) ;
110
130
} else {
@@ -118,6 +138,7 @@ export class Selector extends Service {
118
138
this . app . off ( 'mouse:up' , this . onMouseUp ) ;
119
139
this . app . off ( 'mouse:click' , this . onMouseClick ) ;
120
140
this . selected = [ ] ;
141
+ this . enable = false ;
121
142
this . selector . destroy ( ) ;
122
143
this . optionLayer . destroy ( ) ;
123
144
}
0 commit comments