[vlc-devel] [PATCH v3 02/10] test: iosvlc: add pinch gesture recognizer
Alexandre Janniaux
ajanni at videolabs.io
Tue Feb 16 15:25:42 UTC 2021
Allow the test application to be resized to test the behaviour of
libvlccore resizing. Later, this should probably be enabled by a feature
flag or an environment variable.
---
test/iosvlc.m | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/test/iosvlc.m b/test/iosvlc.m
index 23b2c236b4..381ada18f5 100644
--- a/test/iosvlc.m
+++ b/test/iosvlc.m
@@ -37,11 +37,23 @@
libvlc_instance_t *_libvlc;
UIWindow *window;
UIView *subview;
+ UIPinchGestureRecognizer *_pinchRecognizer;
}
@end
@implementation AppDelegate
+- (void)pinchRecognized:(UIPinchGestureRecognizer *)pinchRecognizer
+{
+ CGFloat scale = pinchRecognizer.scale;
+ CGRect viewBounds = subview.frame;
+ if (scale >= 1.0 && (viewBounds.size.width == 0 || viewBounds.size.height == 0))
+ viewBounds.size.width = viewBounds.size.height = 1;
+ viewBounds.size.width *= scale;
+ viewBounds.size.height *= scale;
+ subview.bounds = viewBounds;
+ pinchRecognizer.scale = 1.0;
+}
/* Called after application launch */
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
@@ -76,6 +88,10 @@
[window addSubview:subview];
[window makeKeyAndVisible];
+ _pinchRecognizer = [[UIPinchGestureRecognizer alloc]
+ initWithTarget:self action:@selector(pinchRecognized:)];
+ [window addGestureRecognizer:_pinchRecognizer];
+
/* Start glue interface, see code below */
libvlc_add_intf(_libvlc, "ios_interface,none");
--
2.30.1
More information about the vlc-devel
mailing list