[feature-3555]Swiping with Ignition 8 Perspective

Has anyone got swiping working with Perspective? The touch events onTouchStart, onTouchMove and onTouchEnd don’t seem to give access to any useful properties for finding out which direction the user swiped in.

Can you describe exactly what you’re trying to do? I don’t know anything about how React’s touch APIs are used, but with some more context might be able to cobble something together.

I’m trying to detect when someone swipes so I can respond appropriately. It would be nice to detect if they swipe left or right, up or down so that I can for example display another motor when they swipe right or go up a level in the menu if they swipe left.

Left and right would probably be easiest using the carousel component, but I’ll take a look at what I can find out actually detecting gestures.

Unfortunately, quick research seems to suggest that, at least with React’s raw events, you have to keep track of the position and state yourself, then make the decision on whether it’s a left/right/etc swipe manually, based on position changes.

The touch events should have a touches property, which will be composed of various Touch objects, which have various properties you should be able to access.

This would be great, but unfortunately when we tried using the touches property we received a “property doesn’t exist” error.

Hmm, I’ll have to check what’s going on here.

Any progress?
I got the same error.

com.inductiveautomation.ignition.common.script.JythonExecException: Traceback (most recent call last): File "", line 5, in runAction AttributeError: 'com.inductiveautomation.ignition.common.script.ada' object has no attribute 'touches'

at org.python.core.Py.AttributeError(Py.java:207)

at org.python.core.PyObject.noAttributeError(PyObject.java:1032)

at org.python.core.PyObject.__getattr__(PyObject.java:1027)

at org.python.pycode._pyx5.runAction$1(:6)

at org.python.pycode._pyx5.call_function()

at org.python.core.PyTableCode.call(PyTableCode.java:171)

at org.python.core.PyBaseCode.call(PyBaseCode.java:308)

at org.python.core.PyFunction.function___call__(PyFunction.java:471)

at org.python.core.PyFunction.__call__(PyFunction.java:466)

at org.python.core.PyFunction.__call__(PyFunction.java:456)

at org.python.core.PyFunction.__call__(PyFunction.java:451)

at com.inductiveautomation.ignition.common.script.ScriptManager.runFunction(ScriptManager.java:776)

at com.inductiveautomation.ignition.common.script.ScriptManager$ScriptFunctionImpl.invoke(ScriptManager.java:894)

at com.inductiveautomation.ignition.gateway.project.ProjectScriptLifecycle$AutoRecompilingScriptFunction.invoke(ProjectScriptLifecycle.java:574)

at com.inductiveautomation.perspective.gateway.script.ScriptFunctionHelper.invoke(ScriptFunctionHelper.java:87)

at com.inductiveautomation.perspective.gateway.action.ScriptAction.runAction(ScriptAction.java:65)

at com.inductiveautomation.perspective.gateway.action.ActionDecorator.runAction(ActionDecorator.java:18)

at com.inductiveautomation.perspective.gateway.action.SecuredAction.runAction(SecuredAction.java:51)

at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.lambda$call$0(ActionCollection.java:257)

at com.inductiveautomation.perspective.gateway.api.LoggingContext.mdc(LoggingContext.java:54)

at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:246)

at com.inductiveautomation.perspective.gateway.model.ActionCollection$ActionSequence$ExecuteActionsTask.call(ActionCollection.java:215)

at com.inductiveautomation.perspective.gateway.threading.BlockingTaskQueue$TaskWrapper.run(BlockingTaskQueue.java:154)

at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

at java.base/java.util.concurrent.FutureTask.run(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

at java.base/java.lang.Thread.run(Unknown Source)

Caused by: org.python.core.PyException: Traceback (most recent call last): File "", line 5, in runAction AttributeError: 'com.inductiveautomation.ignition.common.script.ada' object has no attribute 'touches'

Bump. It doesn’t look like the touches property has been made available yet :frowning:

I want to add gestures to my calendar:
image

Well, two years too late I did the required legwork and got a ticket in place. The gist is that we don’t pass anything ‘complex’ from the frontend to the backend (to use in scripts) - only string/number/boolean types. I suggested we relax that limitation for touches and potentially other useful properties.

1 Like