Closed joshtynjala closed 6 years ago
Thanks a lot for the heads-up, Josh! I never got a Surface Book in my hands for testing, so I'm really thankful for that feedback. I'll change that supportsCursor
logic to using the os
string instead — that makes sense.
Hm ... thinking this through, I'm not so sure this is such a good idea. Checking for Windows and MacOS would make sure that it works correctly on Windows and MacOS — but it's hard to say if it would still work correctly on other (perhaps less popular) devices. E.g. I don't know how AIR behaves when running Android with the Samsung Galaxy Docking station. Or Android consoles — do they perhaps work with Mouse Events, since they are lacking a multi-touch screen? ... or what about Linux? It should be included in that list of Mouse-affine platforms, but I think Capabilities.os
returns Linux
even on Android, doesn't it?
Perhaps I should implement it like this:
private var _supportsCursor:Boolean;
_supportsCursor = Capabilities.os.indexOf("Windows") >= 0 ||
Capabilities.os.indexOf("Mac OS") >= 0 || Mouse.supportsCursor;
That might do the trick, as it still contains that original Mouse.supportsCursor
fallback check. What do you say?
That might do the trick, as it still contains that original Mouse.supportsCursor fallback check. What do you say?
As I was reading through your post, this is what I immediately considered when you brought up other platforms that potentially support a mouse. This seems like the best approach to me!
I just added the workaround — I hope this works for you! :smile:
Works great. Thank you, Daniel!
I'm testing on a Surface Book 2, which is a Windows laptop with a touchscreen. Only touches are working for me. The mouse seems to be ignored.
How to reproduce this issue:
Starling.multitouchEnabled
totrue
when initializing Starling.mobileDevice
profile in ADL.It looks like Starling doesn't listen to mouse events because
Mouse.supportsCursor
is returningfalse
. I assume thatMouse.supportsCursor
is alwaystrue
on macOS because I haven't changed my code, and I never had this problem on macOS.When running the same code with the
desktop
profile in ADL, the mouse works fine. So it seems like AIR is customizingMouse.supportsCursor
based on the profile, but only on Windows.This is definitely an AIR bug, since it's behaving inconsistently across platforms. However, I wonder if there's a better way for Starling to detect that it's running in ADL on desktop instead of on a real mobile device. This may be affecting developers today, and it's not necessarily obvious why. I happen to be familiar with Starling's internals, so I knew exactly where to look, but not everyone will have that knowledge.
Capabilities.version
won't work because it can be customized with command line options passed to ADL. You can make it start with "AND" or "IOS" instead of "WIN" or "MAC" when testing on desktop (I think Flash Builder customizes it by default).As far as I know,
Capabilities.os
cannot be customized in ADL, so checking that this string starts with "Windows " or "Mac OS " might be a good solution.