How to use the troika-core.Facade.defineEventProperty function in troika-core

To help you get started, we’ve selected a few troika-core examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github protectwise / troika / packages / troika-xr / src / facade / XRInputSourceFacade.js View on Github external
mousedown: 'xrsqueezestart',
    mouseup: 'xrsqueezeend',
    click: 'xrsqueeze'
  },
  // TODO decide on event names, and handle touching without press:
  // all: {
  //   mousedown: 'xrbuttondown',
  //   mouseup: 'xrbuttonup',
  //   click: 'xrbuttonclick'
  // }
}

// ...and add shortcut event handler properties on Object3DFacade for those events:
Facade.defineEventProperty(Object3DFacade, 'onXRSelectStart', 'xrselectstart')
Facade.defineEventProperty(Object3DFacade, 'onXRSelect', 'xrselect')
Facade.defineEventProperty(Object3DFacade, 'onXRSelectEnd', 'xrselectend')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeStart', 'xrsqueezestart')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueeze', 'xrsqueeze')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeEnd', 'xrsqueezeend')


export default XRInputSourceFacade
github protectwise / troika / packages / troika-xr / src / facade / XRInputSourceFacade.js View on Github external
},
  // TODO decide on event names, and handle touching without press:
  // all: {
  //   mousedown: 'xrbuttondown',
  //   mouseup: 'xrbuttonup',
  //   click: 'xrbuttonclick'
  // }
}

// ...and add shortcut event handler properties on Object3DFacade for those events:
Facade.defineEventProperty(Object3DFacade, 'onXRSelectStart', 'xrselectstart')
Facade.defineEventProperty(Object3DFacade, 'onXRSelect', 'xrselect')
Facade.defineEventProperty(Object3DFacade, 'onXRSelectEnd', 'xrselectend')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeStart', 'xrsqueezestart')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueeze', 'xrsqueeze')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeEnd', 'xrsqueezeend')


export default XRInputSourceFacade
github protectwise / troika / packages / troika-3d / src / facade / Object3DFacade.js View on Github external
// Predefine shape to facilitate JS engine optimization
assign(Object3DFacade.prototype, {
  lookAt: null,
  threeObject: null,
  _parentObject3DFacade: null,
  _removeChildIds: null,
  _matrixChanged: true,
  _worldMatrixVersion: -1,
  _worldMatrixVersionAfterLastUpdate: -1,
  _boundingSphereChanged: false
})

// Define onBeforeRender/onAfterRender event handler properties
Facade.defineEventProperty(Object3DFacade, 'onBeforeRender', 'beforerender')
Facade.defineEventProperty(Object3DFacade, 'onAfterRender', 'afterrender')


export default Object3DFacade
github protectwise / troika / packages / troika-3d / src / facade / Object3DFacade.js View on Github external
Object.defineProperty(Object3DFacade.prototype, 'isObject3DFacade', {value: true})

// Predefine shape to facilitate JS engine optimization
assign(Object3DFacade.prototype, {
  lookAt: null,
  threeObject: null,
  _parentObject3DFacade: null,
  _removeChildIds: null,
  _matrixChanged: true,
  _worldMatrixVersion: -1,
  _worldMatrixVersionAfterLastUpdate: -1,
  _boundingSphereChanged: false
})

// Define onBeforeRender/onAfterRender event handler properties
Facade.defineEventProperty(Object3DFacade, 'onBeforeRender', 'beforerender')
Facade.defineEventProperty(Object3DFacade, 'onAfterRender', 'afterrender')


export default Object3DFacade
github protectwise / troika / packages / troika-xr / src / facade / XRInputSourceFacade.js View on Github external
[BUTTON_SQUEEZE]: {
    mousedown: 'xrsqueezestart',
    mouseup: 'xrsqueezeend',
    click: 'xrsqueeze'
  },
  // TODO decide on event names, and handle touching without press:
  // all: {
  //   mousedown: 'xrbuttondown',
  //   mouseup: 'xrbuttonup',
  //   click: 'xrbuttonclick'
  // }
}

// ...and add shortcut event handler properties on Object3DFacade for those events:
Facade.defineEventProperty(Object3DFacade, 'onXRSelectStart', 'xrselectstart')
Facade.defineEventProperty(Object3DFacade, 'onXRSelect', 'xrselect')
Facade.defineEventProperty(Object3DFacade, 'onXRSelectEnd', 'xrselectend')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeStart', 'xrsqueezestart')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueeze', 'xrsqueeze')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeEnd', 'xrsqueezeend')


export default XRInputSourceFacade
github protectwise / troika / packages / troika-xr / src / facade / XRInputSourceFacade.js View on Github external
mouseup: 'xrsqueezeend',
    click: 'xrsqueeze'
  },
  // TODO decide on event names, and handle touching without press:
  // all: {
  //   mousedown: 'xrbuttondown',
  //   mouseup: 'xrbuttonup',
  //   click: 'xrbuttonclick'
  // }
}

// ...and add shortcut event handler properties on Object3DFacade for those events:
Facade.defineEventProperty(Object3DFacade, 'onXRSelectStart', 'xrselectstart')
Facade.defineEventProperty(Object3DFacade, 'onXRSelect', 'xrselect')
Facade.defineEventProperty(Object3DFacade, 'onXRSelectEnd', 'xrselectend')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeStart', 'xrsqueezestart')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueeze', 'xrsqueeze')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeEnd', 'xrsqueezeend')


export default XRInputSourceFacade
github protectwise / troika / packages / troika-xr / src / facade / XRInputSourceFacade.js View on Github external
},
  [BUTTON_SQUEEZE]: {
    mousedown: 'xrsqueezestart',
    mouseup: 'xrsqueezeend',
    click: 'xrsqueeze'
  },
  // TODO decide on event names, and handle touching without press:
  // all: {
  //   mousedown: 'xrbuttondown',
  //   mouseup: 'xrbuttonup',
  //   click: 'xrbuttonclick'
  // }
}

// ...and add shortcut event handler properties on Object3DFacade for those events:
Facade.defineEventProperty(Object3DFacade, 'onXRSelectStart', 'xrselectstart')
Facade.defineEventProperty(Object3DFacade, 'onXRSelect', 'xrselect')
Facade.defineEventProperty(Object3DFacade, 'onXRSelectEnd', 'xrselectend')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeStart', 'xrsqueezestart')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueeze', 'xrsqueeze')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeEnd', 'xrsqueezeend')


export default XRInputSourceFacade
github protectwise / troika / packages / troika-xr / src / facade / XRInputSourceFacade.js View on Github external
click: 'xrsqueeze'
  },
  // TODO decide on event names, and handle touching without press:
  // all: {
  //   mousedown: 'xrbuttondown',
  //   mouseup: 'xrbuttonup',
  //   click: 'xrbuttonclick'
  // }
}

// ...and add shortcut event handler properties on Object3DFacade for those events:
Facade.defineEventProperty(Object3DFacade, 'onXRSelectStart', 'xrselectstart')
Facade.defineEventProperty(Object3DFacade, 'onXRSelect', 'xrselect')
Facade.defineEventProperty(Object3DFacade, 'onXRSelectEnd', 'xrselectend')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeStart', 'xrsqueezestart')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueeze', 'xrsqueeze')
Facade.defineEventProperty(Object3DFacade, 'onXRSqueezeEnd', 'xrsqueezeend')


export default XRInputSourceFacade