mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-05-23 19:14:19 +02:00
wip
This commit is contained in:
@@ -1202,6 +1202,7 @@ export class RoomEngine extends EventEmitter {
|
|||||||
const dir = this.camera.getDirection(BABYLON.Axis.Z).scale(this.scene.useRightHandedSystem ? -1 : 1);
|
const dir = this.camera.getDirection(BABYLON.Axis.Z).scale(this.scene.useRightHandedSystem ? -1 : 1);
|
||||||
|
|
||||||
let sticky: string | null;
|
let sticky: string | null;
|
||||||
|
let grabbingEnded = false;
|
||||||
|
|
||||||
this.grabbingCtx = {
|
this.grabbingCtx = {
|
||||||
objectId: selectedObject.metadata.objectId,
|
objectId: selectedObject.metadata.objectId,
|
||||||
@@ -1218,6 +1219,7 @@ export class RoomEngine extends EventEmitter {
|
|||||||
sticky = info.sticky;
|
sticky = info.sticky;
|
||||||
},
|
},
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
|
grabbingEnded = true;
|
||||||
this.sr.disableSnapshotRendering();
|
this.sr.disableSnapshotRendering();
|
||||||
selectedObject.position = initialPosition.clone();
|
selectedObject.position = initialPosition.clone();
|
||||||
selectedObject.rotation = initialRotation.clone();
|
selectedObject.rotation = initialRotation.clone();
|
||||||
@@ -1236,6 +1238,7 @@ export class RoomEngine extends EventEmitter {
|
|||||||
this.sr.enableSnapshotRendering();
|
this.sr.enableSnapshotRendering();
|
||||||
},
|
},
|
||||||
onDone: () => { // todo: sticky状態などを引数でもらうようにしたい
|
onDone: () => { // todo: sticky状態などを引数でもらうようにしたい
|
||||||
|
grabbingEnded = true;
|
||||||
this.putParticleSystem.emitter = selectedObject.position.clone();
|
this.putParticleSystem.emitter = selectedObject.position.clone();
|
||||||
this.putParticleSystem.start();
|
this.putParticleSystem.start();
|
||||||
|
|
||||||
@@ -1304,7 +1307,11 @@ export class RoomEngine extends EventEmitter {
|
|||||||
|
|
||||||
this.sr.enableSnapshotRendering();
|
this.sr.enableSnapshotRendering();
|
||||||
|
|
||||||
this.timer.setInterval(() => {
|
const stopHandleGrabbing = this.timer.setInterval(() => {
|
||||||
|
if (grabbingEnded) {
|
||||||
|
stopHandleGrabbing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.handleGrabbing();
|
this.handleGrabbing();
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
@@ -1437,6 +1444,7 @@ export class RoomEngine extends EventEmitter {
|
|||||||
const ghost = this.createGhost(root);
|
const ghost = this.createGhost(root);
|
||||||
|
|
||||||
let sticky: string | null;
|
let sticky: string | null;
|
||||||
|
let grabbingEnded = false;
|
||||||
|
|
||||||
this.grabbingCtx = {
|
this.grabbingCtx = {
|
||||||
objectId: id,
|
objectId: id,
|
||||||
@@ -1453,9 +1461,12 @@ export class RoomEngine extends EventEmitter {
|
|||||||
sticky = info.sticky;
|
sticky = info.sticky;
|
||||||
},
|
},
|
||||||
onCancel: () => {
|
onCancel: () => {
|
||||||
|
grabbingEnded = true;
|
||||||
// todo
|
// todo
|
||||||
},
|
},
|
||||||
onDone: () => { // todo: sticky状態などを引数でもらうようにしたい
|
onDone: () => { // todo: sticky状態などを引数でもらうようにしたい
|
||||||
|
grabbingEnded = true;
|
||||||
|
|
||||||
if (def.hasCollisions) {
|
if (def.hasCollisions) {
|
||||||
enableObjectCollision(root.getChildMeshes());
|
enableObjectCollision(root.getChildMeshes());
|
||||||
}
|
}
|
||||||
@@ -1511,7 +1522,11 @@ export class RoomEngine extends EventEmitter {
|
|||||||
this.gridPlane.isVisible = true;
|
this.gridPlane.isVisible = true;
|
||||||
this.sr.enableSnapshotRendering();
|
this.sr.enableSnapshotRendering();
|
||||||
|
|
||||||
this.timer.setInterval(() => {
|
const stopHandleGrabbing = this.timer.setInterval(() => {
|
||||||
|
if (grabbingEnded) {
|
||||||
|
stopHandleGrabbing();
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.handleGrabbing();
|
this.handleGrabbing();
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
|
|||||||
@@ -569,6 +569,7 @@ export class Timer {
|
|||||||
callback();
|
callback();
|
||||||
}, ms);
|
}, ms);
|
||||||
this.timeoutIds.push(id);
|
this.timeoutIds.push(id);
|
||||||
|
return () => this.clearTimeout(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public setInterval(callback: () => void, ms: number, signal?: AbortSignal) {
|
public setInterval(callback: () => void, ms: number, signal?: AbortSignal) {
|
||||||
@@ -578,10 +579,24 @@ export class Timer {
|
|||||||
this.intervalIds.push(id);
|
this.intervalIds.push(id);
|
||||||
if (signal != null) {
|
if (signal != null) {
|
||||||
signal.addEventListener('abort', () => {
|
signal.addEventListener('abort', () => {
|
||||||
clearInterval(id);
|
this.clearInterval(id);
|
||||||
this.intervalIds = this.intervalIds.filter(i => i !== id);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
return () => this.clearInterval(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearTimeout(id: number) {
|
||||||
|
// workerで実行される可能性がある
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
clearTimeout(id);
|
||||||
|
this.timeoutIds = this.timeoutIds.filter(i => i !== id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearInterval(id: number) {
|
||||||
|
// workerで実行される可能性がある
|
||||||
|
// eslint-disable-next-line no-restricted-globals
|
||||||
|
clearInterval(id);
|
||||||
|
this.intervalIds = this.intervalIds.filter(i => i !== id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose() {
|
public dispose() {
|
||||||
|
|||||||
Reference in New Issue
Block a user