保存一下
This commit is contained in:
@@ -5,9 +5,8 @@ import type { IWindowForm } from '@/core/window/IWindowForm.ts'
|
||||
import type { IWindowFormConfig } from '@/core/window/types/IWindowFormConfig.ts'
|
||||
import type { WindowFormPos } from '@/core/window/types/WindowFormTypes.ts'
|
||||
import { processManager } from '@/core/process/ProcessManager.ts'
|
||||
import { Draggable } from '@/core/utils/Draggable.ts'
|
||||
import { Resizable } from '@/core/utils/Resizable.ts'
|
||||
import { DraggableResizable } from '@/core/utils/DraggableResizable.ts'
|
||||
import { DraggableResizableWindow } from '@/core/utils/DraggableResizableWindow.ts'
|
||||
|
||||
export default class WindowFormImpl implements IWindowForm {
|
||||
private readonly _id: string = uuidV4();
|
||||
@@ -53,13 +52,35 @@ export default class WindowFormImpl implements IWindowForm {
|
||||
div.style.height = '20px';
|
||||
div.style.backgroundColor = 'red';
|
||||
dom.appendChild(div)
|
||||
const bt1 = document.createElement('button');
|
||||
bt1.innerText = '最小化';
|
||||
bt1.addEventListener('click', () => {
|
||||
win.minimize();
|
||||
})
|
||||
div.appendChild(bt1)
|
||||
const bt2 = document.createElement('button');
|
||||
bt2.innerText = '最大化';
|
||||
bt2.addEventListener('click', () => {
|
||||
win.maximize();
|
||||
})
|
||||
div.appendChild(bt2)
|
||||
const bt3 = document.createElement('button');
|
||||
bt3.innerText = '关闭';
|
||||
bt3.addEventListener('click', () => {
|
||||
this.desktopRootDom.removeChild(dom)
|
||||
win.destroy();
|
||||
this.proc?.windowForms.delete(this.id);
|
||||
processManager.removeProcess(this.proc!)
|
||||
})
|
||||
div.appendChild(bt3)
|
||||
|
||||
new DraggableResizable({
|
||||
const win = new DraggableResizableWindow({
|
||||
target: dom,
|
||||
handle: div,
|
||||
mode: 'position',
|
||||
snapThreshold: 20,
|
||||
boundary: document.body,
|
||||
taskbar: { position: { x: 50, y: window.innerHeight - 40 } },
|
||||
})
|
||||
|
||||
this.desktopRootDom.appendChild(dom);
|
||||
|
||||
Reference in New Issue
Block a user