File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -810,13 +810,23 @@ p5.prototype._updateNextMouseCoords = function(e) {
810
810
e
811
811
) ;
812
812
813
- this . _setProperty ( 'movedX' , e . movementX ) ;
814
- this . _setProperty ( 'movedY' , e . movementY ) ;
813
+
815
814
this . _setProperty ( 'mouseX' , mousePos . x ) ;
816
815
this . _setProperty ( 'mouseY' , mousePos . y ) ;
817
816
this . _setProperty ( 'winMouseX' , mousePos . winX ) ;
818
817
this . _setProperty ( 'winMouseY' , mousePos . winY ) ;
819
818
819
+ if ( document . pointerLockElement === canvas ) {
820
+ this . _setProperty ( 'movedX' , e . movementX ) ;
821
+ this . _setProperty ( 'movedY' , e . movementY ) ;
822
+ }
823
+
824
+ else {
825
+ const deltaX = this . mouseX - this . pmouseX ;
826
+ const deltaY = this . mouseY - this . pmouseY ;
827
+ this . _setProperty ( 'movedX' , deltaX ) ;
828
+ this . _setProperty ( 'movedY' , deltaY ) ;
829
+ }
820
830
}
821
831
822
832
if ( ! this . _hasMouseInteracted ) {
You can’t perform that action at this time.
0 commit comments