Skip to content

Commit c27796f

Browse files
mrxzdmarcos
andauthored
Import directly from three and only use lib/three for AFRAME.THREE export (#5670)
* Import directly from three and only use lib/three for AFRAME.THREE export * Fix GLTFLoader mocking in gltf-model.test.js unit test --------- Co-authored-by: Diego Marcos <diego.marcos@gmail.com>
1 parent fd1a848 commit c27796f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+109
-86
lines changed

‎src/components/anchored.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* global THREE, XRRigidTransform, localStorage */
1+
/* global XRRigidTransform, localStorage */
2+
import * as THREE from 'three';
23
import { registerComponent } from '../core/component.js';
34
import * as utils from '../utils/index.js';
45
var warn = utils.debug('components:anchored:warn');

‎src/components/animation.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import THREE from '../lib/three.js';
1+
import * as THREE from 'three';
22
import anime from 'super-animejs';
33
import { registerComponent, components } from '../core/component.js';
44
import * as utils from '../utils/index.js';

‎src/components/camera.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import THREE from '../lib/three.js';
1+
import * as THREE from 'three';
22
import { registerComponent } from '../core/component.js';
33

44
/**

‎src/components/cursor.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* global THREE, MouseEvent, TouchEvent */
1+
/* global MouseEvent, TouchEvent */
2+
import * as THREE from 'three';
23
import { registerComponent } from '../core/component.js';
34
import * as utils from '../utils/index.js';
45

‎src/components/geometry.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import THREE from '../lib/three.js';
1+
import * as THREE from 'three';
22
import { geometries, geometryNames } from '../core/geometry.js';
33
import { registerComponent } from '../core/component.js';
44

‎src/components/gltf-model.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import THREE from '../lib/three.js';
1+
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
22
import { registerComponent } from '../core/component.js';
33
import * as utils from '../utils/index.js';
44
var warn = utils.debug('components:gltf-model:warn');
@@ -15,7 +15,7 @@ export var Component = registerComponent('gltf-model', {
1515
var meshoptDecoder = this.system.getMeshoptDecoder();
1616
var ktxLoader = this.system.getKTX2Loader();
1717
this.model = null;
18-
this.loader = new THREE.GLTFLoader();
18+
this.loader = new GLTFLoader();
1919
if (dracoLoader) {
2020
this.loader.setDRACOLoader(dracoLoader);
2121
}

‎src/components/hand-controls.js‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* global THREE */
1+
import * as THREE from 'three';
2+
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
23
import { registerComponent } from '../core/component.js';
34
import { AFRAME_CDN_ROOT } from '../constants/index.js';
45

@@ -63,7 +64,7 @@ export var Component = registerComponent('hand-controls', {
6364
// Active buttons populated by events provided by the attached controls.
6465
this.pressedButtons = {};
6566
this.touchedButtons = {};
66-
this.loader = new THREE.GLTFLoader();
67+
this.loader = new GLTFLoader();
6768
this.loader.setCrossOrigin('anonymous');
6869

6970
this.onGripDown = function () { self.handleButton('grip', 'down'); };

‎src/components/hand-tracking-controls.js‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
/* global THREE, XRHand */
1+
/* global XRHand */
2+
import * as THREE from 'three';
23
import { registerComponent } from '../core/component.js';
34
import { AEntity } from '../core/a-entity.js';
45
import { checkControllerPresentAndSetup } from '../utils/tracked-controls.js';

‎src/components/hand-tracking-grab-controls.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { registerComponent } from '../core/component.js';
2-
import THREE from '../lib/three.js';
2+
import * as THREE from 'three';
33

44
registerComponent('hand-tracking-grab-controls', {
55
schema: {

‎src/components/hp-mixed-reality-controls.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { registerComponent } from '../core/component.js';
2-
import THREE from '../lib/three.js';
2+
import * as THREE from 'three';
33
import { AFRAME_CDN_ROOT } from '../constants/index.js';
44
import { checkControllerPresentAndSetup, emitIfAxesChanged, onButtonEvent } from '../utils/tracked-controls.js';
55

0 commit comments

Comments
 (0)