@@ -16,7 +16,7 @@ let windowY = 0;
1616export function initializeWindowManager ( ) {
1717 // ウィンドウドラッグ機能
1818 setupWindowDragging ( ) ;
19-
19+
2020 // ウィンドウコントロール
2121 setupWindowControls ( ) ;
2222}
@@ -25,36 +25,36 @@ export function initializeWindowManager() {
2525 * ウィンドウドラッグ機能を設定
2626 */
2727function setupWindowDragging ( ) {
28- document . querySelectorAll ( ' .window-header' ) . forEach ( header => {
29- header . addEventListener ( ' mousedown' , ( e ) => {
30- if ( e . target . classList . contains ( ' window-control' ) ) return ;
31-
28+ document . querySelectorAll ( " .window-header" ) . forEach ( ( header ) => {
29+ header . addEventListener ( " mousedown" , ( e ) => {
30+ if ( e . target . classList . contains ( " window-control" ) ) return ;
31+
3232 isDragging = true ;
3333 currentWindow = header . parentElement ;
3434 startX = e . clientX ;
3535 startY = e . clientY ;
3636 const rect = currentWindow . getBoundingClientRect ( ) ;
3737 windowX = rect . left ;
3838 windowY = rect . top ;
39-
39+
4040 // 最前面に移動
4141 bringToFront ( currentWindow ) ;
42-
42+
4343 e . preventDefault ( ) ;
4444 } ) ;
4545 } ) ;
46-
47- document . addEventListener ( ' mousemove' , ( e ) => {
46+
47+ document . addEventListener ( " mousemove" , ( e ) => {
4848 if ( ! isDragging ) return ;
49-
49+
5050 const deltaX = e . clientX - startX ;
5151 const deltaY = e . clientY - startY ;
52-
53- currentWindow . style . left = ( windowX + deltaX ) + 'px' ;
54- currentWindow . style . top = ( windowY + deltaY ) + 'px' ;
52+
53+ currentWindow . style . left = windowX + deltaX + "px" ;
54+ currentWindow . style . top = windowY + deltaY + "px" ;
5555 } ) ;
56-
57- document . addEventListener ( ' mouseup' , ( ) => {
56+
57+ document . addEventListener ( " mouseup" , ( ) => {
5858 isDragging = false ;
5959 currentWindow = null ;
6060 } ) ;
@@ -65,24 +65,24 @@ function setupWindowDragging() {
6565 */
6666function setupWindowControls ( ) {
6767 // 閉じるボタン
68- document . querySelectorAll ( ' .close' ) . forEach ( btn => {
69- btn . addEventListener ( ' click' , ( ) => {
70- btn . closest ( ' .window' ) . style . display = ' none' ;
68+ document . querySelectorAll ( " .close" ) . forEach ( ( btn ) => {
69+ btn . addEventListener ( " click" , ( ) => {
70+ btn . closest ( " .window" ) . style . display = " none" ;
7171 } ) ;
7272 } ) ;
73-
73+
7474 // 最小化ボタン
75- document . querySelectorAll ( ' .minimize' ) . forEach ( btn => {
76- btn . addEventListener ( ' click' , ( ) => {
75+ document . querySelectorAll ( " .minimize" ) . forEach ( ( btn ) => {
76+ btn . addEventListener ( " click" , ( ) => {
7777 // TODO: 最小化実装
78- console . log ( ' Minimize not implemented yet' ) ;
78+ console . log ( " Minimize not implemented yet" ) ;
7979 } ) ;
8080 } ) ;
81-
81+
8282 // 最大化ボタン
83- document . querySelectorAll ( ' .maximize' ) . forEach ( btn => {
84- btn . addEventListener ( ' click' , ( ) => {
85- const window = btn . closest ( ' .window' ) ;
83+ document . querySelectorAll ( " .maximize" ) . forEach ( ( btn ) => {
84+ btn . addEventListener ( " click" , ( ) => {
85+ const window = btn . closest ( " .window" ) ;
8686 toggleMaximize ( window ) ;
8787 } ) ;
8888 } ) ;
@@ -92,40 +92,40 @@ function setupWindowControls() {
9292 * ウィンドウを最前面に移動
9393 */
9494function bringToFront ( window ) {
95- const windows = document . querySelectorAll ( ' .window' ) ;
95+ const windows = document . querySelectorAll ( " .window" ) ;
9696 let maxZ = 0 ;
97-
98- windows . forEach ( w => {
99- const z = parseInt ( w . style . zIndex || '0' ) ;
97+
98+ windows . forEach ( ( w ) => {
99+ const z = parseInt ( w . style . zIndex || "0" ) ;
100100 if ( z > maxZ ) maxZ = z ;
101101 } ) ;
102-
102+
103103 window . style . zIndex = maxZ + 1 ;
104104}
105105
106106/**
107107 * ウィンドウの最大化をトグル
108108 */
109109function toggleMaximize ( window ) {
110- if ( window . dataset . maximized === ' true' ) {
110+ if ( window . dataset . maximized === " true" ) {
111111 // 元のサイズに戻す
112112 window . style . width = window . dataset . originalWidth ;
113113 window . style . height = window . dataset . originalHeight ;
114114 window . style . left = window . dataset . originalLeft ;
115115 window . style . top = window . dataset . originalTop ;
116- window . dataset . maximized = ' false' ;
116+ window . dataset . maximized = " false" ;
117117 } else {
118118 // 現在のサイズを保存
119119 window . dataset . originalWidth = window . style . width ;
120120 window . dataset . originalHeight = window . style . height ;
121121 window . dataset . originalLeft = window . style . left ;
122122 window . dataset . originalTop = window . style . top ;
123-
123+
124124 // 最大化
125- window . style . width = ' 100vw' ;
126- window . style . height = ' 100vh' ;
127- window . style . left = '0' ;
128- window . style . top = '0' ;
129- window . dataset . maximized = ' true' ;
125+ window . style . width = " 100vw" ;
126+ window . style . height = " 100vh" ;
127+ window . style . left = "0" ;
128+ window . style . top = "0" ;
129+ window . dataset . maximized = " true" ;
130130 }
131- }
131+ }
0 commit comments