From f1c7815557e980bbf5e5adbcd3ff5c767e5c55c1 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Sun, 26 Mar 2023 11:14:03 +0200 Subject: [PATCH] scaling via left pinch while holding somethinmg --- index.html | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/index.html b/index.html index a2d7eda..782af04 100644 --- a/index.html +++ b/index.html @@ -2468,6 +2468,28 @@ function sendPerspectiveToServer(){ }, "image/jpeg", 0.8); } +function doublePinchToScale(){ + let initialPositionSecondary + let elSecondary = document.querySelector('[pinchsecondary]') + elSecondary.addEventListener('pinchmoved', movedSecondary ); + function movedSecondary(event){ + if (!selectedElement) return + let scale = initialPositionSecondary.distanceTo(event.detail.position) + selectedElement.setAttribute("scale", ""+scale+" "+scale+" "+scale+" ") + } + elSecondary.addEventListener('pinchstarted', startedSecondary ); + function startedSecondary(event){ + initialPositionSecondary = event.detail.position.clone() + } +} + +// used for testing +AFRAME.registerComponent('startfunctions', { + init: function () { + doublePinchToScale() + } +}) +
@@ -2477,6 +2499,7 @@ function sendPerspectiveToServer(){