iPad version is weird!

I’m doing a multi-scene project. One scene involves unlocking a chest by moving 4 rotor-strips to a pre-chosen UNLOCK sequence, like a combination lock. The rotor-strips move by clicking/tapping just above or just below the displayed symbol. It works fine on my Mac, but the iPad version behaves weirdly. Whatever rotor-strip I tap, only the rightmost moves, and then only upwards.
I’ve created a small subset of the project to isolate the problem using just a small window of 600x400, but it still persists.
I’ll attach an 830kB zip file of the subset of project to demo the problem. Any insights or help much appreciated.
RotorTestDemo.zip (825.1 KB)

The issue is that on desktop mouse events are used and on mobile touch events are used. Hype does this because touch events tend to feel more responsive on mobile (and desktop cannot use them).

Touch events do not have an offsetX property, so the xClick = event.offsetX/element.offsetWidth; calculation results in NaN.

The quickest fix is to uncheck Use touch events in the Document Inspector. This means that even on mobile, the same mouse events will be used which have the offsetX property you need.

You could also make code to handle both mouse and touch events (there are several different techniques, including using a newer "pointerevents" that is a unified API). But this probably isn't worth the effort vs. toggling a checkbox :).

Spot on, Jonathan! I think I might have made this error before, but, if so, I failed to recall it at the right time. Problem solved simply by unchecking a checkbox. Wow! That, plus a bit of resizing the strip spacing to get things nicely aligned, and I'm back on track in the parent project.
Many thanks!!

1 Like

Great, glad that did the trick!