Moving fonts to dist, grabbing cursor on scrolling

This commit is contained in:
barsdeveloper
2021-12-27 01:45:44 +01:00
parent 1017ce6bb2
commit 303cc5b71e
26 changed files with 202 additions and 93 deletions

View File

@@ -17,10 +17,7 @@ export default class DragMove extends MouseClickDrag {
startDrag() {
if (isNaN(this.stepSize) || this.stepSize <= 0) {
this.stepSize = parseInt(getComputedStyle(this.target).getPropertyValue("--ueb-grid-snap"))
if (isNaN(this.stepSize) || this.stepSize <= 0) {
this.stepSize = 1
}
this.stepSize = this.blueprint.gridSnap
}
// Get the current mouse position
this.mousePosition = this.stepSize != 1 ? this.snapToGrid(this.clickedPosition) : this.clickedPosition

View File

@@ -2,7 +2,15 @@ import MouseClickDrag from "./MouseClickDrag"
export default class DragScroll extends MouseClickDrag {
startDrag() {
this.blueprint.template.applyStartDragScrolling(this.blueprint)
}
dragTo(location, movement) {
this.blueprint.scrollDelta([-movement[0], -movement[1]])
}
endDrag() {
this.blueprint.template.applyEndDragScrolling(this.blueprint)
}
}

View File

@@ -21,14 +21,18 @@ export default class Paste extends Context {
}
pasted(value) {
let top = Number.MAX_SAFE_INTEGER
let left = Number.MAX_SAFE_INTEGER
let top = 0
let left = 0
let count = 0
let nodes = this.serializer.readMultiple(value).map(entity => {
let node = new GraphNode(entity)
top = Math.min(top, node.location[1])
left = Math.min(left, node.location[0])
top += node.location[1]
left += node.location[0]
++count
return node
})
top /= count
left /= count
if (nodes.length > 0) {
this.blueprint.unselectAll()
}