mirror of
https://github.com/anatolykopyl/vue-three-d-mockup.git
synced 2026-03-26 12:55:08 +00:00
Fixed bug with rapid mouse movement
This commit is contained in:
@@ -9,6 +9,7 @@ class MockupModel extends Group {
|
|||||||
|
|
||||||
this.animation = this.floatAnim;
|
this.animation = this.floatAnim;
|
||||||
this.goingHome = false;
|
this.goingHome = false;
|
||||||
|
this.homeTimeout = null;
|
||||||
|
|
||||||
this.home = home;
|
this.home = home;
|
||||||
this.reset();
|
this.reset();
|
||||||
@@ -55,7 +56,7 @@ class MockupModel extends Group {
|
|||||||
this.rotSpeed.y = (this.home.rotation.y - this.rotation.y) / rT;
|
this.rotSpeed.y = (this.home.rotation.y - this.rotation.y) / rT;
|
||||||
this.rotSpeed.z = (this.home.rotation.z - this.rotation.z) / rT;
|
this.rotSpeed.z = (this.home.rotation.z - this.rotation.z) / rT;
|
||||||
|
|
||||||
setTimeout(() => {
|
this.homeTimeout = setTimeout(() => {
|
||||||
this.goingHome = false;
|
this.goingHome = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
this.startFloat();
|
this.startFloat();
|
||||||
@@ -277,7 +278,11 @@ var script = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseEnter() {
|
function handleMouseEnter() {
|
||||||
if (phone) { phone.animation = phone.lookAtAnim; }
|
if (phone) {
|
||||||
|
phone.animation = phone.lookAtAnim;
|
||||||
|
phone.goingHome = false;
|
||||||
|
clearTimeout(phone.homeTimeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseLeave() {
|
function handleMouseLeave() {
|
||||||
|
|||||||
@@ -169,7 +169,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseEnter() {
|
function handleMouseEnter() {
|
||||||
if (phone) { phone.animation = phone.lookAtAnim; }
|
if (phone) {
|
||||||
|
phone.animation = phone.lookAtAnim;
|
||||||
|
phone.goingHome = false;
|
||||||
|
clearTimeout(phone.homeTimeout);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseLeave() {
|
function handleMouseLeave() {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ export default class MockupModel extends Group {
|
|||||||
|
|
||||||
this.animation = this.floatAnim;
|
this.animation = this.floatAnim;
|
||||||
this.goingHome = false;
|
this.goingHome = false;
|
||||||
|
this.homeTimeout = null;
|
||||||
|
|
||||||
this.home = home;
|
this.home = home;
|
||||||
this.reset();
|
this.reset();
|
||||||
@@ -52,7 +53,7 @@ export default class MockupModel extends Group {
|
|||||||
this.rotSpeed.y = (this.home.rotation.y - this.rotation.y) / rT;
|
this.rotSpeed.y = (this.home.rotation.y - this.rotation.y) / rT;
|
||||||
this.rotSpeed.z = (this.home.rotation.z - this.rotation.z) / rT;
|
this.rotSpeed.z = (this.home.rotation.z - this.rotation.z) / rT;
|
||||||
|
|
||||||
setTimeout(() => {
|
this.homeTimeout = setTimeout(() => {
|
||||||
this.goingHome = false;
|
this.goingHome = false;
|
||||||
this.reset();
|
this.reset();
|
||||||
this.startFloat();
|
this.startFloat();
|
||||||
|
|||||||
Reference in New Issue
Block a user