touch track point improvements
This commit is contained in:
1 parent
03fcfaff28
commit
4dc6220f28
3 files changed
+54
-31
No files matched your search
@@ -224,7 +224,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
dispatch_async(dispatch_get_global_queue(touchDownQos, 0), ^{
|
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
// continue to the next loop if current touch is already captured by OSC. works only in regular native touch
|
// continue to the next loop if current touch is already captured by OSC. works only in regular native touch
|
||||||
if([OnScreenControls.touchesCapturedByOnScreenControls containsObject:touch]) continue;
|
if([OnScreenControls.touchesCapturedByOnScreenControls containsObject:touch]) continue;
|
||||||
@@ -233,8 +233,8 @@
|
|||||||
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_DOWN withEvent:event];
|
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_DOWN withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
if(self->trackPointEnabled){
|
||||||
if(self->trackPointEnabled){
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
@@ -244,13 +244,13 @@
|
|||||||
trackPoint.hidden = false;
|
trackPoint.hidden = false;
|
||||||
}
|
}
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
if([OnScreenControls.touchesCapturedByOnScreenControls containsObject:touch]) continue;
|
if([OnScreenControls.touchesCapturedByOnScreenControls containsObject:touch]) continue;
|
||||||
if(self->activateCoordSelector) [self updatePointerObjInDict:touch];
|
if(self->activateCoordSelector) [self updatePointerObjInDict:touch];
|
||||||
@@ -259,8 +259,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
if(self->trackPointEnabled){
|
||||||
if(self->trackPointEnabled){
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
@@ -269,12 +269,12 @@
|
|||||||
trackPoint.position = [touch locationInView:self->streamView];
|
trackPoint.position = [touch locationInView:self->streamView];
|
||||||
}
|
}
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
if([OnScreenControls.touchesCapturedByOnScreenControls containsObject:touch]){
|
if([OnScreenControls.touchesCapturedByOnScreenControls containsObject:touch]){
|
||||||
[OnScreenControls.touchesCapturedByOnScreenControls removeObject:touch];
|
[OnScreenControls.touchesCapturedByOnScreenControls removeObject:touch];
|
||||||
@@ -287,8 +287,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
if(self->trackPointEnabled){
|
||||||
if(self->trackPointEnabled){
|
if(touches.count == [UITouchUtil touchesIn:streamView from:event].count){
|
||||||
|
[CATransaction begin];
|
||||||
|
[CATransaction setDisableActions:YES];
|
||||||
|
for(CAShapeLayer* trackPoint in trackPointPool) trackPoint.hidden = true;
|
||||||
|
[CATransaction commit];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
@@ -297,15 +305,14 @@
|
|||||||
trackPoint.hidden = true;
|
trackPoint.hidden = true;
|
||||||
}
|
}
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
[self touchesEnded:touches withEvent:event];
|
[self touchesEnded:touches withEvent:event];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)populatePointerObjIntoDict:(UITouch*)touch{
|
- (void)populatePointerObjIntoDict:(UITouch*)touch{
|
||||||
NativeTouchPointer* pointer = [[NativeTouchPointer alloc] initWithTouch:touch];
|
NativeTouchPointer* pointer = [[NativeTouchPointer alloc] initWithTouch:touch];
|
||||||
pointer.useRelativeCoords = pointer.initialPoint.x > pointerVelocityDividerLocationByPoints;
|
pointer.useRelativeCoords = pointer.initialPoint.x > pointerVelocityDividerLocationByPoints;
|
||||||
@@ -345,6 +352,9 @@
|
|||||||
pointerIdPool= nil;
|
pointerIdPool= nil;
|
||||||
unassignedPointerIds = nil;
|
unassignedPointerIds = nil;
|
||||||
blacklistedTouches = nil;
|
blacklistedTouches = nil;
|
||||||
|
for(CAShapeLayer* layer in trackPointPool){
|
||||||
|
[layer removeFromSuperlayer];
|
||||||
|
}
|
||||||
trackPointPool = nil;
|
trackPointPool = nil;
|
||||||
pointerObjDict = nil;
|
pointerObjDict = nil;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2996,6 +2996,7 @@ import SVGKit
|
|||||||
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
self.functionalButtonDelegate?.alterAbsTouchDragWith(mouseButton:BUTTON_LEFT)
|
||||||
}
|
}
|
||||||
buttonDownVisualEffectLayer.removeFromSuperlayer()
|
buttonDownVisualEffectLayer.removeFromSuperlayer()
|
||||||
|
trackPoint.removeFromSuperlayer()
|
||||||
crossMarkLayer.removeFromSuperlayer()
|
crossMarkLayer.removeFromSuperlayer()
|
||||||
lrudIndicatorBall.removeFromSuperlayer()
|
lrudIndicatorBall.removeFromSuperlayer()
|
||||||
l3r3Indicator.removeFromSuperlayer()
|
l3r3Indicator.removeFromSuperlayer()
|
||||||
|
|||||||
@@ -215,15 +215,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
dispatch_async(dispatch_get_global_queue(touchDownQos, 0), ^{
|
dispatch_async(dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
// continue to the next loop if current touch is already captured by OSC. works only in regular native touch
|
// continue to the next loop if current touch is already captured by OSC. works only in regular native touch
|
||||||
[self handleTouchDown:touch]; //generate & populate pointerId
|
[self handleTouchDown:touch]; //generate & populate pointerId
|
||||||
if(self->activateCoordSelector) [self populatePointerObjIntoDict:touch];
|
if(self->activateCoordSelector) [self populatePointerObjIntoDict:touch];
|
||||||
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_DOWN];
|
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_DOWN];
|
||||||
}
|
}
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
if(self->trackPointEnabled){
|
if(self->trackPointEnabled){
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
@@ -233,13 +234,13 @@
|
|||||||
trackPoint.hidden = false;
|
trackPoint.hidden = false;
|
||||||
}
|
}
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
if(self->activateCoordSelector) [self updatePointerObjInDict:touch];
|
if(self->activateCoordSelector) [self updatePointerObjInDict:touch];
|
||||||
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_MOVE];
|
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_MOVE];
|
||||||
@@ -247,8 +248,8 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
if(self->trackPointEnabled){
|
||||||
if(self->trackPointEnabled){
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
@@ -257,12 +258,12 @@
|
|||||||
trackPoint.position = [touch locationInView:self->streamView];
|
trackPoint.position = [touch locationInView:self->streamView];
|
||||||
}
|
}
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_main_queue(), ^{
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, moveEventIntervalNSec), dispatch_get_global_queue(QOS_CLASS_USER_INTERACTIVE, 0), ^{
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_UP]; //send touch event before remove pointerId
|
[self sendTouchEvent:touch withTouchtype:LI_TOUCH_EVENT_UP]; //send touch event before remove pointerId
|
||||||
[self removePointerId:touch]; //then remove pointerId
|
[self removePointerId:touch]; //then remove pointerId
|
||||||
@@ -271,8 +272,16 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
if(self->trackPointEnabled){
|
||||||
if(self->trackPointEnabled){
|
if(touches.count == [UITouchUtil touchesIn:streamView from:event].count){
|
||||||
|
[CATransaction begin];
|
||||||
|
[CATransaction setDisableActions:YES];
|
||||||
|
for(CAShapeLayer* trackPoint in trackPointPool) trackPoint.hidden = true;
|
||||||
|
[CATransaction commit];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[CATransaction begin];
|
[CATransaction begin];
|
||||||
[CATransaction setDisableActions:YES];
|
[CATransaction setDisableActions:YES];
|
||||||
for (UITouch* touch in touches){
|
for (UITouch* touch in touches){
|
||||||
@@ -281,8 +290,8 @@
|
|||||||
trackPoint.hidden = true;
|
trackPoint.hidden = true;
|
||||||
}
|
}
|
||||||
[CATransaction commit];
|
[CATransaction commit];
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
|
||||||
@@ -325,6 +334,9 @@
|
|||||||
pointerIdPool= nil;
|
pointerIdPool= nil;
|
||||||
unassignedPointerIds = nil;
|
unassignedPointerIds = nil;
|
||||||
blacklistedTouches = nil;
|
blacklistedTouches = nil;
|
||||||
|
for(CAShapeLayer* layer in trackPointPool){
|
||||||
|
[layer removeFromSuperlayer];
|
||||||
|
}
|
||||||
trackPointPool = nil;
|
trackPointPool = nil;
|
||||||
pointerObjDict = nil;
|
pointerObjDict = nil;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user