diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index e91def521..550d9e6bf 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -79,6 +79,11 @@ export default class MiOS extends EventEmitter { */ private shouldRegisterSw: boolean; + /** + * ウィンドウシステム + */ + public windows = new WindowSystem(); + /** * MiOSインスタンスを作成します * @param shouldRegisterSw ServiceWorkerを登録するかどうか @@ -359,6 +364,22 @@ export default class MiOS extends EventEmitter { } } +class WindowSystem { + private windows = new Set(); + + public add(window) { + this.windows.add(window); + } + + public remove(window) { + this.windows.delete(window); + } + + public getAll() { + return this.windows; + } +} + /** * Convert the URL safe base64 string to a Uint8Array * @param base64String base64 string diff --git a/src/web/app/desktop/views/components/window.vue b/src/web/app/desktop/views/components/window.vue index 4a9aa900c..ac3af3a57 100644 --- a/src/web/app/desktop/views/components/window.vue +++ b/src/web/app/desktop/views/components/window.vue @@ -3,23 +3,23 @@
-
+

- - + +
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
@@ -32,6 +32,18 @@ import contains from '../../common/scripts/contains'; const minHeight = 40; const minWidth = 200; +function dragListen(fn) { + window.addEventListener('mousemove', fn); + window.addEventListener('mouseleave', dragClear.bind(null, fn)); + window.addEventListener('mouseup', dragClear.bind(null, fn)); +} + +function dragClear(fn) { + window.removeEventListener('mousemove', fn); + window.removeEventListener('mouseleave', dragClear); + window.removeEventListener('mouseup', dragClear); +} + export default Vue.extend({ props: { isModal: { @@ -54,6 +66,7 @@ export default Vue.extend({ type: String } }, + computed: { isFlexible(): boolean { return this.height == null; @@ -62,363 +75,350 @@ export default Vue.extend({ return !this.isFlexible; } }, + + created() { + // ウィンドウをウィンドウシステムに登録 + this.$root.$data.os.windows.add(this); + }, + mounted() { + const main = this.$refs.main as any; + main.style.top = '15%'; + main.style.left = (window.innerWidth / 2) - (main.offsetWidth / 2) + 'px'; - } -}); - + window.addEventListener('resize', this.onBrowserResize); + this.open(); + }, - - -