mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-23 19:20:46 +01:00
lint
This commit is contained in:
parent
3bd055b045
commit
b5fe3e894b
1 changed files with 5 additions and 0 deletions
|
@ -197,6 +197,7 @@ function iframeOnLoad() {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function windowEventHandler(event: MessageEvent) {
|
function windowEventHandler(event: MessageEvent) {
|
||||||
if (event.source !== iframeEl.value?.contentWindow) {
|
if (event.source !== iframeEl.value?.contentWindow) {
|
||||||
return;
|
return;
|
||||||
|
@ -217,6 +218,7 @@ function windowEventHandler(event: MessageEvent) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function calcScale() {
|
function calcScale() {
|
||||||
if (!resizerRootEl.value) return;
|
if (!resizerRootEl.value) return;
|
||||||
const previewWidth = resizerRootEl.value.clientWidth - 40; // 左右の余白 20pxずつ
|
const previewWidth = resizerRootEl.value.clientWidth - 40; // 左右の余白 20pxずつ
|
||||||
|
@ -225,15 +227,18 @@ function calcScale() {
|
||||||
const scale = Math.min(previewWidth / iframeWidth, previewHeight / iframeHeight.value, 1); // 拡大はしない
|
const scale = Math.min(previewWidth / iframeWidth, previewHeight / iframeHeight.value, 1); // 拡大はしない
|
||||||
iframeScale.value = scale;
|
iframeScale.value = scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
window.addEventListener('message', windowEventHandler);
|
window.addEventListener('message', windowEventHandler);
|
||||||
if (!resizerRootEl.value) return;
|
if (!resizerRootEl.value) return;
|
||||||
resizeObserver.observe(resizerRootEl.value);
|
resizeObserver.observe(resizerRootEl.value);
|
||||||
});
|
});
|
||||||
|
|
||||||
onDeactivated(() => {
|
onDeactivated(() => {
|
||||||
window.removeEventListener('message', windowEventHandler);
|
window.removeEventListener('message', windowEventHandler);
|
||||||
resizeObserver.disconnect();
|
resizeObserver.disconnect();
|
||||||
});
|
});
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
window.removeEventListener('message', windowEventHandler);
|
window.removeEventListener('message', windowEventHandler);
|
||||||
resizeObserver.disconnect();
|
resizeObserver.disconnect();
|
||||||
|
|
Loading…
Reference in a new issue