1- ( function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } ) ( { 1 :[ function ( require , module , exports ) {
1+ ( function ( ) { function e ( t , n , r ) { function s ( o , u ) { if ( ! n [ o ] ) { if ( ! t [ o ] ) { var a = typeof require == "function" && require ; if ( ! u && a ) return a ( o , ! 0 ) ; if ( i ) return i ( o , ! 0 ) ; var f = new Error ( "Cannot find module '" + o + "'" ) ; throw f . code = "MODULE_NOT_FOUND" , f } var l = n [ o ] = { exports :{ } } ; t [ o ] [ 0 ] . call ( l . exports , function ( e ) { var n = t [ o ] [ 1 ] [ e ] ; return s ( n ?n :e ) } , l , l . exports , e , t , n , r ) } return n [ o ] . exports } var i = typeof require == "function" && require ; for ( var o = 0 ; o < r . length ; o ++ ) s ( r [ o ] ) ; return s } return e } ) ( ) ( { 1 :[ function ( require , module , exports ) {
22'use strict' ;
33
44require ( '../index.js' ) ;
@@ -213,9 +213,9 @@ AFRAME.registerComponent('super-hands', {
213213 } ,
214214 onStretchEndButton : function ( evt ) {
215215 const stretched = this . state . get ( this . STRETCH_EVENT ) ;
216- const endEvt = { hand : this . el , buttonEvent : evt } ;
217- // check if end event accepted
218- if ( stretched && ! this . emitCancelable ( stretched , this . UNSTRETCH_EVENT , endEvt ) ) {
216+ const endEvt = { hand : this . el , buttonEvent : evt
217+ // check if end event accepted
218+ } ; if ( stretched && ! this . emitCancelable ( stretched , this . UNSTRETCH_EVENT , endEvt ) ) {
219219 this . promoteHoveredEl ( stretched ) ;
220220 this . state . delete ( this . STRETCH_EVENT ) ;
221221 this . hover ( ) ;
@@ -531,7 +531,7 @@ AFRAME.registerComponent('super-hands', {
531531 }
532532} ) ;
533533
534- } , { "./misc_components/locomotor-auto-config.js" :3 , "./misc_components/progressive-controls.js" :4 , "./primitives/a-locomotor.js" :14 , "./reaction_components/clickable.js" :15 , "./reaction_components/drag-droppable.js" :16 , "./reaction_components/draggable.js" :17 , "./reaction_components/droppable.js" :18 , "./reaction_components/grabbable.js" :19 , "./reaction_components/hoverable.js" :20 , "./reaction_components/stretchable.js" :23 , "./systems/super-hands-system.js" :24 } ] , 3 :[ function ( require , module , exports ) {
534+ } , { "./misc_components/locomotor-auto-config.js" :3 , "./misc_components/progressive-controls.js" :4 , "./primitives/a-locomotor.js" :14 , "./reaction_components/clickable.js" :15 , "./reaction_components/drag-droppable.js" :16 , "./reaction_components/draggable.js" :17 , "./reaction_components/droppable.js" :18 , "./reaction_components/grabbable.js" :19 , "./reaction_components/hoverable.js" :20 , "./reaction_components/stretchable.js" :24 , "./systems/super-hands-system.js" :25 } ] , 3 :[ function ( require , module , exports ) {
535535'use strict' ;
536536
537537/* global AFRAME */
@@ -2551,7 +2551,10 @@ AFRAME.registerComponent('droppable', {
25512551const inherit = AFRAME . utils . extendDeep ;
25522552const physicsCore = require ( './prototypes/physics-grab-proto.js' ) ;
25532553const buttonsCore = require ( './prototypes/buttons-proto.js' ) ;
2554- AFRAME . registerComponent ( 'grabbable' , inherit ( { } , physicsCore , buttonsCore , {
2554+ const networkedCore = require ( './prototypes/networked-proto.js' ) ;
2555+ // new object with all core modules
2556+ const base = inherit ( { } , physicsCore , buttonsCore , networkedCore ) ;
2557+ AFRAME . registerComponent ( 'grabbable' , inherit ( base , {
25552558 schema : {
25562559 maxGrabbers : { type : 'int' , default : NaN } ,
25572560 invert : { default : false } ,
@@ -2567,9 +2570,9 @@ AFRAME.registerComponent('grabbable', inherit({}, physicsCore, buttonsCore, {
25672570 this . deltaPositionIsValid = false ;
25682571 this . grabDistance = undefined ;
25692572 this . grabDirection = { x : 0 , y : 0 , z : - 1 } ;
2570- this . grabOffset = { x : 0 , y : 0 , z : 0 } ;
2571- // persistent object speeds up repeat setAttribute calls
2572- this . destPosition = { x : 0 , y : 0 , z : 0 } ;
2573+ this . grabOffset = { x : 0 , y : 0 , z : 0
2574+ // persistent object speeds up repeat setAttribute calls
2575+ } ; this . destPosition = { x : 0 , y : 0 , z : 0 } ;
25732576 this . deltaPosition = new THREE . Vector3 ( ) ;
25742577 this . targetPosition = new THREE . Vector3 ( ) ;
25752578 this . physicsInit ( ) ;
@@ -2616,7 +2619,7 @@ AFRAME.registerComponent('grabbable', inherit({}, physicsCore, buttonsCore, {
26162619 // room for more grabbers?
26172620 const grabAvailable = ! Number . isFinite ( this . data . maxGrabbers ) || this . grabbers . length < this . data . maxGrabbers ;
26182621
2619- if ( this . grabbers . indexOf ( evt . detail . hand ) === - 1 && grabAvailable ) {
2622+ if ( this . grabbers . indexOf ( evt . detail . hand ) === - 1 && grabAvailable && this . networkedOk ( ) ) {
26202623 if ( ! evt . detail . hand . object3D ) {
26212624 console . warn ( 'grabbable entities must have an object3D' ) ;
26222625 return ;
@@ -2676,7 +2679,7 @@ AFRAME.registerComponent('grabbable', inherit({}, physicsCore, buttonsCore, {
26762679 }
26772680} ) ) ;
26782681
2679- } , { "./prototypes/buttons-proto.js" :21 , "./prototypes/physics-grab-proto.js" :22 } ] , 20 :[ function ( require , module , exports ) {
2682+ } , { "./prototypes/buttons-proto.js" :21 , "./prototypes/networked-proto.js" : 22 , "./prototypes/ physics-grab-proto.js" :23 } ] , 20 :[ function ( require , module , exports ) {
26802683'use strict' ;
26812684
26822685/* global AFRAME */
@@ -2747,6 +2750,25 @@ module.exports = function () {
27472750} ( ) ;
27482751
27492752} , { } ] , 22 :[ function ( require , module , exports ) {
2753+ "use strict" ;
2754+
2755+ // integration with networked-aframe
2756+ module . exports = {
2757+ schema : {
2758+ takeOwnership : { default : false }
2759+ } ,
2760+ networkedOk : function ( ) {
2761+ if ( ! window . NAF || window . NAF . utils . isMine ( this . el ) ) {
2762+ return true ;
2763+ }
2764+ if ( this . data . takeOwnership ) {
2765+ return window . NAF . utils . takeOwnership ( this . el ) ;
2766+ }
2767+ return false ;
2768+ }
2769+ } ;
2770+
2771+ } , { } ] , 23 :[ function ( require , module , exports ) {
27502772'use strict' ;
27512773
27522774// base code used by grabbable for physics interactions
@@ -2804,13 +2826,16 @@ module.exports = {
28042826 }
28052827} ;
28062828
2807- } , { } ] , 23 :[ function ( require , module , exports ) {
2829+ } , { } ] , 24 :[ function ( require , module , exports ) {
28082830'use strict' ;
28092831
28102832/* global AFRAME, THREE */
28112833const inherit = AFRAME . utils . extendDeep ;
2812- const buttonCore = require ( './prototypes/buttons-proto.js' ) ;
2813- AFRAME . registerComponent ( 'stretchable' , inherit ( { } , buttonCore , {
2834+ const buttonsCore = require ( './prototypes/buttons-proto.js' ) ;
2835+ const networkedCore = require ( './prototypes/networked-proto.js' ) ;
2836+ // new object with all core modules
2837+ const base = inherit ( { } , buttonsCore , networkedCore ) ;
2838+ AFRAME . registerComponent ( 'stretchable' , inherit ( base , {
28142839 schema : {
28152840 usePhysics : { default : 'ifavailable' } ,
28162841 invert : { default : false } ,
@@ -2863,7 +2888,7 @@ AFRAME.registerComponent('stretchable', inherit({}, buttonCore, {
28632888 this . el . removeEventListener ( this . UNSTRETCH_EVENT , this . end ) ;
28642889 } ,
28652890 start : function ( evt ) {
2866- if ( this . stretched || this . stretchers . includes ( evt . detail . hand ) || ! this . startButtonOk ( evt ) || evt . defaultPrevented ) {
2891+ if ( this . stretched || this . stretchers . includes ( evt . detail . hand ) || ! this . startButtonOk ( evt ) || evt . defaultPrevented || ! this . networkedOk ( ) ) {
28672892 return ;
28682893 } // already stretched or already captured this hand or wrong button
28692894 this . stretchers . push ( evt . detail . hand ) ;
@@ -2937,7 +2962,7 @@ AFRAME.registerComponent('stretchable', inherit({}, buttonCore, {
29372962 }
29382963} ) ) ;
29392964
2940- } , { "./prototypes/buttons-proto.js" :21 } ] , 24 :[ function ( require , module , exports ) {
2965+ } , { "./prototypes/buttons-proto.js" :21 , "./prototypes/networked-proto.js" : 22 } ] , 25 :[ function ( require , module , exports ) {
29412966'use strict' ;
29422967
29432968/* global AFRAME */
0 commit comments