File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
packages/model-viewer/src/three-components Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -647,15 +647,16 @@ export class SmoothControls extends EventDispatcher {
647
647
}
648
648
649
649
private recenter ( pointer : Pointer ) {
650
+ const { scene} = this ;
651
+ ( scene . element as any ) [ $panElement ] . style . opacity = 0 ;
652
+
650
653
if ( ! this . enablePan ||
651
654
Math . abs ( pointer . clientX - this . startPointerPosition . clientX ) >
652
655
TAP_DISTANCE ||
653
656
Math . abs ( pointer . clientY - this . startPointerPosition . clientY ) >
654
657
TAP_DISTANCE ) {
655
658
return ;
656
659
}
657
- const { scene} = this ;
658
- ( scene . element as any ) [ $panElement ] . style . opacity = 0 ;
659
660
660
661
const hit = scene . positionAndNormalFromPoint (
661
662
scene . getNDC ( pointer . clientX , pointer . clientY ) ) ;
@@ -673,15 +674,17 @@ export class SmoothControls extends EventDispatcher {
673
674
}
674
675
675
676
private resetRadius ( ) {
677
+ const { scene} = this ;
678
+ ( scene . element as any ) [ $panElement ] . style . opacity = 0 ;
679
+
676
680
if ( ! this . enablePan || this . panPerPixel === 0 ) {
677
681
return ;
678
682
}
679
- const { scene} = this ;
680
- ( scene . element as any ) [ $panElement ] . style . opacity = 0 ;
681
683
682
684
const hit = scene . positionAndNormalFromPoint ( vector2 . set ( 0 , 0 ) ) ;
683
- if ( hit == null )
685
+ if ( hit == null ) {
684
686
return ;
687
+ }
685
688
686
689
scene . target . worldToLocal ( hit . position ) ;
687
690
const goalTarget = scene . getTarget ( ) ;
@@ -767,7 +770,7 @@ export class SmoothControls extends EventDispatcher {
767
770
null :
768
771
this . touchModeZoom ;
769
772
this . touchDecided = true ;
770
- if ( this . enablePan ) {
773
+ if ( this . enablePan && this . touchMode != null ) {
771
774
this . initializePan ( ) ;
772
775
const x = 0.5 * ( targetTouches [ 0 ] . clientX + targetTouches [ 1 ] . clientX ) ;
773
776
const y = 0.5 * ( targetTouches [ 0 ] . clientY + targetTouches [ 1 ] . clientY ) ;
You can’t perform that action at this time.
0 commit comments