mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:28:17 +08:00
Moving fonts to dist, grabbing cursor on scrolling
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user