File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
packages/core/src/customs Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { fabric } from 'fabric' ;
2
2
3
3
export class Polyline extends fabric . Polyline {
4
+ private selectedControl : string | null = null ;
5
+ private originalPoint : fabric . Point | null = null ;
6
+
4
7
public onSelect ( options : { e ?: Event | undefined } ) : boolean {
5
8
const points = this . points ?? [ ] ;
6
9
this . controls = points . reduce < Record < string , fabric . Control > > (
@@ -18,6 +21,16 @@ export class Polyline extends fabric.Polyline {
18
21
)
19
22
) ;
20
23
} ,
24
+ actionHandler : ( eventData , transformData , x , y ) => {
25
+ // 更新点的位置
26
+ points [ index ] . x = x ;
27
+ points [ index ] . y = y ;
28
+ // 重新设置points
29
+ this . points = points ;
30
+ // 更新坐标
31
+ this . setCoords ( ) ;
32
+ return true ;
33
+ } ,
21
34
} ) ;
22
35
return controls ;
23
36
} ,
You can’t perform that action at this time.
0 commit comments