js_lis 1.0.0 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +22 -5
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -403,10 +403,6 @@ class Layout {
|
|
|
403
403
|
`;
|
|
404
404
|
}
|
|
405
405
|
|
|
406
|
-
startDrag(event) {
|
|
407
|
-
// Implement drag functionality
|
|
408
|
-
}
|
|
409
|
-
|
|
410
406
|
initEventListeners() {
|
|
411
407
|
document.querySelectorAll("input, textarea, form").forEach((element) => {
|
|
412
408
|
element.addEventListener("focus", (event) => {
|
|
@@ -460,6 +456,26 @@ class Layout {
|
|
|
460
456
|
});
|
|
461
457
|
}
|
|
462
458
|
|
|
459
|
+
startDrag(event) {
|
|
460
|
+
this.isDragging = true;
|
|
461
|
+
this.offsetX = event.clientX - document.getElementById("keyboard").offsetLeft;
|
|
462
|
+
this.offsetY = event.clientY - document.getElementById("keyboard").offsetTop;
|
|
463
|
+
|
|
464
|
+
document.addEventListener("mousemove", drag);
|
|
465
|
+
document.addEventListener("mouseup", () => {
|
|
466
|
+
this.isDragging = false;
|
|
467
|
+
document.removeEventListener("mousemove", drag);
|
|
468
|
+
});
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
drag(event) {
|
|
472
|
+
if (this.isDragging) {
|
|
473
|
+
const keyboard = document.getElementById("keyboard");
|
|
474
|
+
keyboard.style.left = `${event.clientX - offsetX}px`;
|
|
475
|
+
keyboard.style.top = `${event.clientY - offsetY}px`;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
463
479
|
toggleCapsLock() {
|
|
464
480
|
this.isCapsLock = !this.isCapsLock;
|
|
465
481
|
const capsLockKeys = document.querySelectorAll(".capslock");
|
|
@@ -684,4 +700,5 @@ class Layout {
|
|
|
684
700
|
}
|
|
685
701
|
}
|
|
686
702
|
|
|
687
|
-
|
|
703
|
+
export default Layout;
|
|
704
|
+
|