Edge scroll, minor refactoring

This commit is contained in:
barsdeveloper
2023-02-08 22:15:37 +01:00
parent cb98b85084
commit 319f5af77f
20 changed files with 175 additions and 60 deletions

View File

@@ -20,6 +20,7 @@ export default class ISelectableDraggableTemplate extends IDraggablePositionedTe
createDraggableObject() {
return /** @type {MouseMoveDraggable} */(new MouseMoveNodes(this.element, this.blueprint, {
draggableElement: this.getDraggableElement(),
scrollGraphEdge: true,
}))
}

View File

@@ -1,5 +1,5 @@
import { html, nothing } from "lit"
import ColorPickerWindowTemplate from "../ColorPickerWindowTemplate"
import ColorPickerWindowTemplate from "../window/ColorPickerWindowTemplate"
import Configuration from "../../Configuration"
import ElementFactory from "../../element/ElementFactory"
import PinTemplate from "./PinTemplate"

View File

@@ -1,14 +1,14 @@
import { html } from "lit"
import { styleMap } from "lit/directives/style-map.js"
import ColorHandlerElement from "../element/ColorHandlerElement"
import ColorSliderElement from "../element/ColorSliderElement"
import Configuration from "../Configuration"
import LinearColorEntity from "../entity/LinearColorEntity"
import Utility from "../Utility"
import ColorHandlerElement from "../../element/ColorHandlerElement"
import ColorSliderElement from "../../element/ColorSliderElement"
import Configuration from "../../Configuration"
import LinearColorEntity from "../../entity/LinearColorEntity"
import Utility from "../../Utility"
import WindowTemplate from "./WindowTemplate"
/**
* @typedef {import("../element/WindowElement").default} WindowElement
* @typedef {import("../../element/WindowElement").default} WindowElement
* @typedef {import("lit").PropertyValues} PropertyValues
*/

View File

@@ -1,10 +1,10 @@
import { html } from "lit"
import Configuration from "../Configuration"
import IDraggablePositionedTemplate from "./IDraggablePositionedTemplate"
import MouseMoveDraggable from "../input/mouse/MouseMoveDraggable"
import SVGIcon from "../SVGIcon"
import Configuration from "../../Configuration"
import IDraggablePositionedTemplate from "../IDraggablePositionedTemplate"
import MouseMoveDraggable from "../../input/mouse/MouseMoveDraggable"
import SVGIcon from "../../SVGIcon"
/** @typedef {import("../element/WindowElement").default} WindowElement */
/** @typedef {import("../../element/WindowElement").default} WindowElement */
/** @extends {IDraggablePositionedTemplate<WindowElement>} */
export default class WindowTemplate extends IDraggablePositionedTemplate {
@@ -25,6 +25,24 @@ export default class WindowTemplate extends IDraggablePositionedTemplate {
})
}
setup() {
const leftBoundary = this.blueprint.template.gridLeftVisibilityBoundary()
const topBoundary = this.blueprint.template.gridTopVisibilityBoundary()
this.element.locationX = this.blueprint.scaleCorrectReverse(this.blueprint.mousePosition[0] - leftBoundary)
this.element.locationY = this.blueprint.scaleCorrectReverse(this.blueprint.mousePosition[1] - topBoundary)
this.element.updateComplete.then(() => {
const bounding = this.blueprint.getBoundingClientRect()
if (this.element.locationX + this.element.sizeX > bounding.width) {
this.element.locationX = bounding.width - this.element.sizeX
}
this.element.locationX = Math.max(0, this.element.locationX)
if (this.element.locationY + this.element.sizeY > bounding.height) {
this.element.locationY = bounding.height - this.element.sizeY
}
this.element.locationY = Math.max(0, this.element.locationY)
})
}
render() {
return html`
<div class="ueb-window">