mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-22 06:44:43 +08:00
Edge scroll, minor refactoring
This commit is contained in:
@@ -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,
|
||||
}))
|
||||
}
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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">
|
||||
Reference in New Issue
Block a user