Last active
August 8, 2020 17:08
-
-
Save tomaspietravallo/0aca28203bbaf1c0f1d83f4d749b9ae6 to your computer and use it in GitHub Desktop.
onPan & onLongPress seem to be broken (? or my code is ¯\_(ツ)_/¯
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let x, y; | |
TouchGestures.onLongPress().subscribe((event)=>{ | |
event.location.x.monitor({fireOnInitialValue: true}).subscribe((v)=>{ | |
x = v.newValue; | |
}); | |
event.location.y.monitor({fireOnInitialValue: true}).subscribe((v)=>{ | |
y = v.newValue; | |
Diagnostics.log(`Gesture: onLongPress \t| X: ${x}, Y: ${y}`); | |
}); | |
}); | |
let x1, y1; | |
TouchGestures.onPan().subscribe((event)=>{ | |
event.location.x.monitor({fireOnInitialValue: true}).subscribe((v)=>{ | |
x1 = v.newValue; | |
}); | |
event.location.y.monitor({fireOnInitialValue: true}).subscribe((v)=>{ | |
y1 = v.newValue; | |
Diagnostics.log(`Gesture: onPan \t| X: ${x1}, Y: ${y1}`); | |
}); | |
}); |
pofulu
commented
Aug 8, 2020
•
function checkAndPack2(x, y, defaultValue){
let values = [x, y];
values.map(x => x || R.val(defaultValue));
return R.pack2(values[0], values[1]);
};
I ended up using the function above to pack the values and check for any undefined
, but this is the same function I had had some issues with. I also learned about R.monitorMany
which made the code much cleaner - similar to yours @pofulu, thanks for the help ❤️
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment