From 328e6e69ec168e44084acc4382a17445c9d6d9b5 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Sat, 14 Jan 2023 19:56:57 +0100 Subject: [PATCH] cleaned up and added shifts --- index.html | 91 +++++++++++++++++++----------------------------------- 1 file changed, 32 insertions(+), 59 deletions(-) diff --git a/index.html b/index.html index 30e112c..c44f676 100644 --- a/index.html +++ b/index.html @@ -1559,6 +1559,14 @@ function toggleVisibilityEntitiesFromClass(classname){ entities.map( e => e.setAttribute("visible", "true")) } +function pushLeftClass(classname, value=.1){ + Array.from( document.querySelectorAll("."+classname) ).map( e => e.object3D.position.x -= value) +} + +function pushRightClass(classname, value=.1){ + Array.from( document.querySelectorAll("."+classname) ).map( e => e.object3D.position.x += value) +} + function pushUpClass(classname, value=.1){ Array.from( document.querySelectorAll("."+classname) ).map( e => e.object3D.position.y += value) } @@ -1925,11 +1933,13 @@ function getClosestTilesSnappingPosition( t, threshold=0.05 ){ return point } +var tile_snapping_enabled = true + AFRAME.registerComponent('snap-on-pinchended', { init: function(){ + let el = this.el this.el.addEventListener('released', function (event) { - setFeedbackHUD("should snap to iso grid"); // TODO test - console.log('dropped',el,'to snap') + if (tile_snapping_enabled) el.setAttribute("rotation", "0 0 0") // if works, generalize and add to https://git.benetou.fr/utopiah/text-code-xr-engine/issues/66 // should come back from emit('released') // could rely on getClosestTilesSnappingPosition() @@ -1989,7 +1999,7 @@ function rescalePlace(scale = 10, yoffset=-1){ - + @@ -2000,68 +2010,31 @@ function rescalePlace(scale = 10, yoffset=-1){ - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + +