Skip to content

Commit 0e58a54

Browse files
author
Zhicheng WANG
committed
fix: 支持 move-handle
1 parent 81446a4 commit 0e58a54

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
1-
import { Directive, HostBinding } from '@angular/core';
1+
import { ContentChild, Directive, HostBinding } from '@angular/core';
22
import { MovableDirective } from '@ui-model/angular/src/lib/directives/movable.directive';
33

44
@Directive({
55
selector: '[uiMovableTransform]',
66
})
77
export class MovableTransformDirective {
8-
9-
constructor(private movable: MovableDirective) {
10-
}
8+
@ContentChild(MovableDirective, { static: false })
9+
movable: MovableDirective;
1110

1211
@HostBinding('style.transform')
1312
get transform(): string {
13+
if (!this.movable) {
14+
return '';
15+
}
1416
return `translate(${this.movable.offset.x}px,${this.movable.offset.y}px)`;
1517
}
1618
}

0 commit comments

Comments
 (0)