Needle Engine

Changes between version 3.28.2-beta and 3.28.3-beta
Files changed (2) hide show
  1. src/engine-components/ui/EventSystem.ts +11 -4
  2. src/engine-components/export/usdz/ThreeUSDZExporter.ts +0 -6
src/engine-components/ui/EventSystem.ts CHANGED
@@ -172,6 +172,11 @@
172
172
  if (!rc) return;
173
173
  const opts = new PointerEventData(this.context.input);
174
174
  opts.inputSource = _ctrl;
175
+ opts.pointerId = _ctrl.input?.handedness === "right" ? 0 : 1;
176
+ opts.isDown = _ctrl.selectionDown;
177
+ opts.isUp = _ctrl.selectionUp;
178
+ opts.isPressed = _ctrl.selectionPressed;
179
+ opts.isClicked = _ctrl.selectionClick;
175
180
  this.handleIntersections(rc, opts);
176
181
  };
177
182
 
@@ -294,7 +299,6 @@
294
299
  * For example if an event component has only an onPointerClick method we don't need to raycast during movement events
295
300
  * */
296
301
  private shouldRaycastObject = (obj: Object3D): RaycastTestObjectReturnType => {
297
-
298
302
  // check if this object is actually a UI shadow hierarchy object
299
303
  let shadowComponent: Object3D | null = null;
300
304
  const isUI = isUIObject(obj);
@@ -412,7 +416,7 @@
412
416
  * Then calling propagate.
413
417
  */
414
418
  private handleEventOnObject(object: THREE.Object3D, args: PointerEventData): boolean {
415
- // ensures that invisible objects are not handled on accident
419
+ // ensures that invisible objects are ignored
416
420
  if (!this.testIsVisible(object)) {
417
421
  if (args.isClicked && debug)
418
422
  console.log("not allowed", object);
@@ -420,7 +424,10 @@
420
424
  }
421
425
 
422
426
  // Event without pointer can't be handled
423
- if (args.pointerId === undefined) return false;
427
+ if (args.pointerId === undefined) {
428
+ if(debug) console.warn("Event without pointer can't be handled", args);
429
+ return false;
430
+ }
424
431
 
425
432
  // We want to call all event methods even if the event was used
426
433
  // Used event can't be handled
@@ -465,6 +472,7 @@
465
472
  console.log(this.context.time.frame, object);
466
473
 
467
474
  // Handle OnPointerExit -> in case when we are about to hover something new
475
+ // TODO: we need to keep track of the components that already received a PointerEnterEvent -> we can have a hierarchy where the hovered object changes but the component is on the parent and should not receive a PointerExit event because it's still hovered (just another child object)
468
476
  const hovering = this.hoveredByID.get(args.pointerId);
469
477
  const isNewlyHovering = hovering?.obj !== object;
470
478
 
@@ -538,7 +546,6 @@
538
546
 
539
547
  if (comp.onPointerEnter) {
540
548
  if (isNewlyHovering) {
541
- //console.log(args);
542
549
  comp.onPointerEnter(args);
543
550
  }
544
551
  }
src/engine-components/export/usdz/ThreeUSDZExporter.ts CHANGED
@@ -1562,12 +1562,6 @@
1562
1562
 
1563
1563
  }
1564
1564
 
1565
- if ( material.side === DoubleSide ) {
1566
-
1567
- console.warn( 'THREE.USDZExporter: USDZ does not support double sided materials', material );
1568
-
1569
- }
1570
-
1571
1565
  if ( material.map !== null ) {
1572
1566
 
1573
1567
  inputs.push( `${pad}color3f inputs:diffuseColor.connect = ${materialRoot}/Material_${material.id}/Texture_${material.map.id}_diffuse.outputs:rgb>` );