backup
This commit is contained in:
@@ -3,22 +3,29 @@ import { ref } from 'vue'
|
||||
const windows = ref([]);
|
||||
|
||||
import LoginWindow from '~/components/windows/LoginWindow.vue';
|
||||
import RegisterWindow from '~/components/windows/RegisterWindow.vue';
|
||||
import ExampleWindow from '~/components/windows/ExampleWindow.vue';
|
||||
|
||||
let windowMap = {
|
||||
login: LoginWindow
|
||||
login: LoginWindow,
|
||||
register: RegisterWindow,
|
||||
example: ExampleWindow
|
||||
};
|
||||
|
||||
async function InjectWindow(window_type, plugin, window_component) {
|
||||
let systemWidows = {};
|
||||
systemWidows[window_type] = (await import(`../../plugins/${plugin}/views/${window_component}.vue`)).default;
|
||||
windowMap = { ...windowMap, ...systemWidows };
|
||||
}
|
||||
|
||||
// Presets
|
||||
const defValues = {
|
||||
'example': {
|
||||
id: "example",
|
||||
title: "Example",
|
||||
close: () => ClearWindow('example')
|
||||
},
|
||||
'login': {
|
||||
id: 'login',
|
||||
title: 'Login',
|
||||
},
|
||||
'register': {
|
||||
id: 'register',
|
||||
title: 'Register'
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +66,9 @@ function SetupHandle(id, handle) {
|
||||
SetOnTop(id);
|
||||
});
|
||||
|
||||
// Move window listeners
|
||||
handler.addEventListener("mousedown", (event) => {
|
||||
if(win.noMove) return;
|
||||
draggingWindow = true;
|
||||
|
||||
let windowRect = currentWindow.getBoundingClientRect();
|
||||
@@ -67,8 +76,8 @@ function SetupHandle(id, handle) {
|
||||
offsetY = windowRect.top - event.clientY;
|
||||
})
|
||||
|
||||
// Move window listeners
|
||||
document.addEventListener("mousemove", (event) => {
|
||||
if(win.noMove) return;
|
||||
if (!draggingWindow) return;
|
||||
|
||||
if (event.clientX + offsetX < -currentWindow.getBoundingClientRect().width + 20) currentWindow.style.left = (-currentWindow.getBoundingClientRect().width + 20) + "px";
|
||||
@@ -81,6 +90,7 @@ function SetupHandle(id, handle) {
|
||||
})
|
||||
|
||||
document.addEventListener("mouseup", (event) => {
|
||||
if(win.noMove) return;
|
||||
draggingWindow = false;
|
||||
// ummm suposo que no pots tancar mentres mous?
|
||||
SaveWindowPos({ id, x: parseInt(currentWindow.style.left, 10), y: parseInt(currentWindow.style.top, 10) });
|
||||
@@ -126,6 +136,11 @@ function SetResizable(id, resizable) {
|
||||
win.resizable = resizable;
|
||||
}
|
||||
|
||||
function SetMovable(id, movable) {
|
||||
let win = GetWindowWithId(id);
|
||||
win.noMove = !movable;
|
||||
}
|
||||
|
||||
function SetSize(id, size) {
|
||||
let currentWindowId = "window-wrapper-" + id;
|
||||
let currentWindow = document.getElementById(currentWindowId);
|
||||
@@ -284,10 +299,10 @@ export {
|
||||
SetMaxSize,
|
||||
SetMinSize,
|
||||
SetPosition,
|
||||
SetMovable,
|
||||
ResetPosition,
|
||||
Windows,
|
||||
WindowMap,
|
||||
InjectWindow,
|
||||
ReloadRef,
|
||||
ClearWindows,
|
||||
CreateWindow,
|
||||
|
||||
Reference in New Issue
Block a user