mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-25 17:10:43 +00:00
wip
This commit is contained in:
parent
ea732458ab
commit
82cdaeb56e
3 changed files with 12 additions and 18 deletions
|
|
@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
|
||||
<template>
|
||||
<div :class="[$style.screen, { [$style.zen]: false }]">
|
||||
<canvas ref="canvas" :class="$style.canvas" tabindex="-1"></canvas>
|
||||
<canvas ref="canvas" :key="canvasKey" :class="$style.canvas" tabindex="-1"></canvas>
|
||||
|
||||
<Transition
|
||||
:enterActiveClass="$style.transition_fade_enterActive"
|
||||
|
|
@ -109,6 +109,7 @@ const props = defineProps<{
|
|||
room: Misskey.entities.WorldRoomDetailed;
|
||||
}>();
|
||||
|
||||
const canvasKey = ref(0); // 一度ワーカーに渡したcanvasは再利用できないため作り直すためのkey
|
||||
const canvas = useTemplateRef('canvas');
|
||||
|
||||
const interacions = shallowRef<{
|
||||
|
|
@ -433,12 +434,16 @@ async function revert() {
|
|||
});
|
||||
if (canceled) return;
|
||||
|
||||
await controller.reset(latestData);
|
||||
canvasKey.value++;
|
||||
await nextTick();
|
||||
await controller.reset(canvas.value!, attachments, latestData);
|
||||
isModified.value = false;
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
await controller.reset(null, roomControllerOptions.value);
|
||||
canvasKey.value++;
|
||||
await nextTick();
|
||||
await controller.reset(canvas.value!, attachments, null, roomControllerOptions.value);
|
||||
}
|
||||
|
||||
// TODO: ちゃんと書く
|
||||
|
|
|
|||
|
|
@ -262,19 +262,11 @@ export abstract class EngineControllerBase<T extends RoomEngineBase> {
|
|||
};
|
||||
}
|
||||
|
||||
public async reset(roomState?: RoomState | null, options?: RoomControllerOptions | null, canvas?: HTMLCanvasElement | null) {
|
||||
protected async _reset_() {
|
||||
this.destroy();
|
||||
this.abortController = new AbortController();
|
||||
if (roomState != null) this.roomState.value = roomState;
|
||||
if (options != null) this.options = options;
|
||||
this.isReady.value = false;
|
||||
this.isSitting.value = false;
|
||||
this.isEditMode.value = false;
|
||||
this.isRoomLightOn.value = true;
|
||||
this.grabbing.value = null;
|
||||
this.selected.value = null;
|
||||
this.initializeProgress.value = 0;
|
||||
await this.init(canvas ?? this.canvas!);
|
||||
}
|
||||
|
||||
private callCounter = 0;
|
||||
|
|
|
|||
|
|
@ -101,19 +101,16 @@ export class RoomController extends EngineControllerBase<RoomEngine> {
|
|||
});
|
||||
}
|
||||
|
||||
public async reset(roomState?: RoomState | null, options?: RoomControllerOptions | null, canvas?: HTMLCanvasElement | null) {
|
||||
this.destroy();
|
||||
this.abortController = new AbortController();
|
||||
public async reset(canvas: HTMLCanvasElement, attachments: RoomAttachments, roomState?: RoomState | null, options?: RoomControllerOptions | null) {
|
||||
this._reset_();
|
||||
if (roomState != null) this.roomState.value = roomState;
|
||||
if (options != null) this.options = options;
|
||||
this.isReady.value = false;
|
||||
this.isSitting.value = false;
|
||||
this.isEditMode.value = false;
|
||||
this.isRoomLightOn.value = true;
|
||||
this.grabbing.value = null;
|
||||
this.selected.value = null;
|
||||
this.initializeProgress.value = 0;
|
||||
await this.init(canvas ?? this.canvas!);
|
||||
await this.init(canvas, attachments);
|
||||
}
|
||||
|
||||
public setCameraMoveVector(vec: { x: number; y: number }, dash: boolean) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue