Bug Report: SketchView can’t draw by pencile/hand
New version Pythonista.
Using Examples\User Interface\Sketch.py
change last line sv.present(‘fullscreen’) to sv.present(‘sheet’)
you can’t draw it. Please fix it.
@wolf71, this might not be a bug, or at least not a bug in Pythonista.
As the doc states:
'sheet': The view covers only part of the screen, and can be dismissed with a downwards swipe gesture (on iOS 13+).
The ”downwards swipe” looks to me to be more of a long-running pan than a single swipe, and conflicts with regular panning (drawing in sketch).
This probably could be hacked, to remove the gesture from the sheet.
v = sv.objc_instance for _ in range(6): v = v.superview() v.gestureRecognizers().setEnabled(False)
@mikael Thanks a lot. Since iOS 13.3/Pythonista 3.3, I had a similar problem with a script running in appex mode, thus with a view presented in sheet mode. Each touch move did also move the base view. Your appended lines solve it. Thanks to gestures wizard 😀
@mikael Thank you very much.
import gestures swiper = gestures.swipe(sv, lambda x: sv.close(), direction=gestures.DOWN)
... and while it technically works, it is not really usable since iOS swipe gesture is so sensitive that it is easily triggered when starting to draw downwards.
There is an (undocumented) way to adjust this sensitivity, but I could not find a value that would be a reliably workable compromise between drawing and swiping.
Could be useful for some other use case, though.
v = sv.objc_instance
for _ in range(6): v = v.superview()
From some time (iOS 14?), these lines are no more sufficient...
Up to 8 instead of 6 solve the problem, but I have generalized it with
#for _ in range(8): v = v.superview() #v.gestureRecognizers().setEnabled(False) UIPanGestureRecognizer = ObjCClass('UIPanGestureRecognizer') #i = 0 while v: #i+=2 #print(' '*i,v._get_objc_classname()) if v.gestureRecognizers(): for gr in v.gestureRecognizers(): # comment next line to avoid UIParallaxTransitionPanGestureRecognizer #if gr.isKindOfClass_(UIPanGestureRecognizer.ptr): if gr._get_objc_classname() == b'UIPanGestureRecognizer': #print(' '*i,gr._get_objc_classname()) gr.setEnabled(False) v = v.superview()