This commit is contained in:
barsdeveloper
2021-10-09 22:11:11 +02:00
parent 4406b4abe7
commit 84606486c4
15 changed files with 40 additions and 40 deletions

View File

@@ -1,10 +1,10 @@
/**
* A Graph Entity is an element that can stay directly (as a first child) on the blueprint grid. Those entities are either nodes or links
*/
export default class UGraphEntity extends HTMLElement {
export default class GraphEntity extends HTMLElement {
constructor() {
super()
/** @type {import("./UEBlueprint").default}" */
/** @type {import("./UEBlueprint").EBlueprint}" */
this.blueprint = null
}

View File

@@ -1,8 +1,8 @@
import FGuid from "./FGuid";
import Guid from "./Guid";
export default class UGraphPin {
export default class GraphPin {
constructor(Options) {
this.PinId = new FGuid(Options?.PinId)
this.PinId = new Guid(Options?.PinId)
this.PinName = Options?.PinName ?? ""
this.PinToolTip = Options?.PinToolTip ?? ""
this.PinType = {
@@ -50,9 +50,9 @@ export default class UGraphPin {
prefix += prefix != "" ? "." : ""
for (const property in object) {
if (object[property]?.constructor?.name === 'Object') {
result += UGraphPin.subSerialize(prefix + property, object[property])
result += GraphPin.subSerialize(prefix + property, object[property])
} else {
result += `${prefix + property}=${UGraphPin.serializeValue(object[property])},`
result += `${prefix + property}=${GraphPin.serializeValue(object[property])},`
}
}
return result

View File

@@ -1,4 +1,4 @@
export default class FGuid {
export default class Guid {
static generateGuid() {
let result = ""
let random = new Uint32Array(4);
@@ -15,7 +15,7 @@ export default class FGuid {
} else if (guid?.constructor?.name === 'FGuid') {
this.value = guid.value
} else {
this.value = FGuid.generateGuid()
this.value = Guid.generateGuid()
}
}

View File

@@ -1,6 +1,6 @@
import UBlueprintEntity from "./UBlueprintEntity"
export default class ULink extends UBlueprintEntity {
export default class Link extends UBlueprintEntity {
/**
*
@@ -26,4 +26,4 @@ export default class ULink extends UBlueprintEntity {
}
}
customElements.define('u-link', ULink)
customElements.define('u-link', Link)

View File

@@ -1,7 +1,7 @@
import UDrag from "./input/UDrag"
import UGraphEntity from "./UGraphEntity"
import Drag from "./input/Drag"
import GraphEntity from "./GraphEntity"
export default class USelectableDraggable extends UGraphEntity {
export default class SelectableDraggable extends GraphEntity {
constructor() {
super()
@@ -17,7 +17,7 @@ export default class USelectableDraggable extends UGraphEntity {
connectedCallback() {
super.connectedCallback()
this.dragObject = new UDrag(this, null, { // UDrag doesn't need blueprint
this.dragObject = new Drag(this, null, { // UDrag doesn't need blueprint
looseTarget: true
})
}

View File

@@ -1,7 +1,7 @@
import Utility from "./Utility"
import UDragScroll from "./input/UDragScroll"
import USelect from "./input/USelect"
import UZoom from "./input/UZoom"
import DragScroll from "./input/DragScroll"
import Select from "./input/Select"
import Zoom from "./input/Zoom"
import FastSelectionModel from "./selection/FastSelectionModel"
import SimpleSelectionModel from "./selection/SimpleSelectionModel"
@@ -108,17 +108,17 @@ export default class UEBlueprint extends HTMLElement {
this.nodesContainerElement = this.querySelector('[data-nodes]')
this.insertChildren()
this.dragObject = new UDragScroll(this.getGridDOMElement(), this, {
this.dragObject = new DragScroll(this.getGridDOMElement(), this, {
clickButton: 2,
moveEverywhere: true,
exitAnyButton: false
})
this.zoomObject = new UZoom(this.getGridDOMElement(), this, {
this.zoomObject = new Zoom(this.getGridDOMElement(), this, {
looseTarget: true
})
this.selectObject = new USelect(this.getGridDOMElement(), this, {
this.selectObject = new Select(this.getGridDOMElement(), this, {
clickButton: 0,
moveEverywhere: true,
exitAnyButton: true

View File

@@ -1,6 +1,6 @@
import USelectableDraggable from "./USelectableDraggable"
import SelectableDraggable from "./SelectableDraggable"
export default class UEBlueprintObject extends USelectableDraggable {
export default class UEBlueprintObject extends SelectableDraggable {
static classInputs = [/*
{
name: "Input Example",

View File

@@ -1,5 +1,5 @@
import UEBlueprint from "./UEBlueprint"
import UEBlueprintObject from "./UEBlueprintObject"
import UGraphPin from "./UGraphPin"
import GraphPin from "./GraphPin"
export { UEBlueprint, UEBlueprintObject, UGraphPin }
export { UEBlueprint as UEBlueprint, UEBlueprintObject, GraphPin as UGraphPin }

View File

@@ -1,6 +1,6 @@
import UMouseClickDrag from "./UMouseClickDrag"
import MouseClickDrag from "./MouseClickDrag"
export default class UDrag extends UMouseClickDrag {
export default class Drag extends MouseClickDrag {
constructor(target, blueprint, options) {
super(target, blueprint, options)
this.stepSize = parseInt(options?.stepSize)

View File

@@ -1,6 +1,6 @@
import UMouseClickDrag from "./UMouseClickDrag"
import MouseClickDrag from "./MouseClickDrag"
export default class UDragScroll extends UMouseClickDrag {
export default class DragScroll extends MouseClickDrag {
dragTo(location, movement) {
this.blueprint.scrollDelta([-movement[0], -movement[1]])

View File

@@ -1,9 +1,9 @@
import UPointing from "./UPointing"
import Pointing from "./Pointing"
/**
* This class manages the ui gesture of mouse click and drag. Tha actual operations are implemented by the subclasses.
*/
export default class UMouseClickDrag extends UPointing {
export default class MouseClickDrag extends Pointing {
constructor(target, blueprint, options) {
super(target, blueprint, options)
this.clickButton = options?.clickButton ?? 0

View File

@@ -1,11 +1,11 @@
import UPointing from "./UPointing"
import Pointing from "./Pointing"
export default class UMouseWheel extends UPointing {
export default class MouseWheel extends Pointing {
/**
*
* @param {HTMLElement} target
* @param {import("../UEBlueprint").default} blueprint
* @param {import("../UEBlueprint").EBlueprint} blueprint
* @param {Object} options
*/
constructor(target, blueprint, options) {

View File

@@ -1,11 +1,11 @@
import Utility from "../Utility"
export default class UPointing {
export default class Pointing {
constructor(target, blueprint, options) {
/** @type {HTMLElement} */
this.target = target
/** @type {import("../UEBlueprint").default}" */
/** @type {import("../UEBlueprint").EBlueprint}" */
this.blueprint = blueprint
this.movementSpace = this.blueprint?.getGridDOMElement() ?? document.documentElement
}

View File

@@ -1,6 +1,6 @@
import UMouseClickDrag from "./UMouseClickDrag"
import MouseClickDrag from "./MouseClickDrag"
export default class USelect extends UMouseClickDrag {
export default class Select extends MouseClickDrag {
constructor(target, blueprint, options) {
super(target, blueprint, options)

View File

@@ -1,6 +1,6 @@
import UMouseWheel from "./UMouseWheel";
import MouseWheel from "./MouseWheel";
export default class UZoom extends UMouseWheel {
export default class Zoom extends MouseWheel {
wheel(variation, location) {
let zoomLevel = this.blueprint.getZoom()
zoomLevel -= variation