iOS:fix draggable
This commit is contained in:
parent
84d19230e4
commit
5d3ef0edb5
@ -24,7 +24,7 @@
|
||||
|
||||
@implementation DoricDraggableNode
|
||||
- (UIView *)build {
|
||||
UIView *stackView = [UIView new];
|
||||
UIView *stackView = [super build];
|
||||
UIPanGestureRecognizer *gesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(onDrag:)];
|
||||
[stackView addGestureRecognizer:gesture];
|
||||
return stackView;
|
||||
@ -36,6 +36,8 @@ - (void)onDrag:(UIPanGestureRecognizer *)gesture {
|
||||
originalFrame.origin.x += point.x;
|
||||
originalFrame.origin.y += point.y;
|
||||
self.view.frame = originalFrame;
|
||||
self.view.doricLayout.marginLeft = originalFrame.origin.x;
|
||||
self.view.doricLayout.marginTop = originalFrame.origin.y;
|
||||
[gesture setTranslation:CGPointZero inView:self.view];
|
||||
[self callJSResponse:_onDragFunction, @(originalFrame.origin.x), @(originalFrame.origin.y), nil];
|
||||
}
|
||||
|
Reference in New Issue
Block a user