scaling continuation and hotfix on refresh from wiki page (throttling)

direct-scaling
Fabien Benetou 2 years ago
parent f1c7815557
commit 59d3e0c64d
  1. 7
      index.html

@ -1526,6 +1526,7 @@ AFRAME.registerComponent('glossary', {
AFRAME.registerComponent('fot', { AFRAME.registerComponent('fot', {
init:function(){ init:function(){
this.tick = AFRAME.utils.throttleTick(this.tick, 500, this);
}, },
tick: function(){ tick: function(){
let generatorName = this.attrName let generatorName = this.attrName
@ -2433,6 +2434,7 @@ AFRAME.registerComponent('refresh-text-content-from-wiki-page', {
this.added = [] this.added = []
let = forcedPagename = AFRAME.utils.getUrlParameter('roomname') let = forcedPagename = AFRAME.utils.getUrlParameter('roomname')
forcedPagename?this.pagename=forcedPagename:this.pagename=this.data.pagename forcedPagename?this.pagename=forcedPagename:this.pagename=this.data.pagename
this.tick = AFRAME.utils.throttleTick(this.tick, 500, this);
}, },
tick: function(){ tick: function(){
let generatorName = this.attrName let generatorName = this.attrName
@ -2470,16 +2472,19 @@ function sendPerspectiveToServer(){
function doublePinchToScale(){ function doublePinchToScale(){
let initialPositionSecondary let initialPositionSecondary
let initialScale
let elSecondary = document.querySelector('[pinchsecondary]') let elSecondary = document.querySelector('[pinchsecondary]')
elSecondary.addEventListener('pinchmoved', movedSecondary ); elSecondary.addEventListener('pinchmoved', movedSecondary );
function movedSecondary(event){ function movedSecondary(event){
if (!selectedElement) return if (!selectedElement) return
let scale = initialPositionSecondary.distanceTo(event.detail.position) let scale = initialScale * initialPositionSecondary.distanceTo(event.detail.position) * 50
selectedElement.setAttribute("scale", ""+scale+" "+scale+" "+scale+" ") selectedElement.setAttribute("scale", ""+scale+" "+scale+" "+scale+" ")
} }
elSecondary.addEventListener('pinchstarted', startedSecondary ); elSecondary.addEventListener('pinchstarted', startedSecondary );
function startedSecondary(event){ function startedSecondary(event){
initialPositionSecondary = event.detail.position.clone() initialPositionSecondary = event.detail.position.clone()
if (!selectedElement) return
initialScale = AFRAME.utils.coordinates.parse( selectedElement.getAttribute("scale") ).x
} }
} }

Loading…
Cancel
Save