Started writing documentation

This commit is contained in:
barsdeveloper
2021-06-30 00:38:39 +02:00
parent d143a5cdc3
commit 1e1534b2ce
2 changed files with 26 additions and 7 deletions

View File

@@ -51,10 +51,6 @@ export default class UEBlueprintDragScroll extends UEBlueprintDrag {
this.blueprintNode.translate(-x, -y) this.blueprintNode.translate(-x, -y)
} }
scaledExpand(x, y, scale) {
}
clamp(val, min, max) { clamp(val, min, max) {
return Math.min(Math.max(val, min), max); return Math.min(Math.max(val, min), max);
} }

View File

@@ -22,6 +22,10 @@ export default class UEBlueprint extends UEBlueprintDOMModel {
` `
} }
static clamp(val, min, max) {
return Math.min(Math.max(val, min), max);
}
constructor() { constructor() {
super() super()
this.expandGridSize = 400 this.expandGridSize = 400
@@ -141,6 +145,10 @@ export default class UEBlueprint extends UEBlueprintDOMModel {
] ]
} }
/**
* Get the scroll limits
* @return {array} The horizonal and vertical maximum scroll limits
*/
getScrollMax() { getScrollMax() {
let parentElement = this.gridDOMElement.parentElement let parentElement = this.gridDOMElement.parentElement
return [ return [
@@ -149,16 +157,26 @@ export default class UEBlueprint extends UEBlueprintDOMModel {
] ]
} }
/**
* Expand the grid, considers the absolute value of params
* @param {number} x - Horizontal expansion value
* @param {number} y - Vertical expansion value
*/
_expand(x, y) { _expand(x, y) {
x = Math.round(x) x = Math.round(Math.abs(x))
y = Math.round(y) y = Math.round(Math.abs(y))
this.additional = [this.additional[0] + Math.abs(x), this.additional[1] + Math.abs(y)] this.additional = [this.additional[0] + x, this.additional[1] + y]
if (this.gridDOMElement) { if (this.gridDOMElement) {
this.gridDOMElement.style.setProperty('--ueb-additional-x', this.additional[0]) this.gridDOMElement.style.setProperty('--ueb-additional-x', this.additional[0])
this.gridDOMElement.style.setProperty('--ueb-additional-y', this.additional[1]) this.gridDOMElement.style.setProperty('--ueb-additional-y', this.additional[1])
} }
} }
/**
* Moves the content of the grid according to the coordinates
* @param {number} x - Horizontal translation value
* @param {number} y - Vertical translation value
*/
_translate(x, y) { _translate(x, y) {
x = Math.round(x) x = Math.round(x)
y = Math.round(y) y = Math.round(y)
@@ -169,6 +187,11 @@ export default class UEBlueprint extends UEBlueprintDOMModel {
} }
} }
/**
* Expand the grind indefinitely, the content will remain into position
* @param {number} x - Horizontal expand value (negative means left, positive means right)
* @param {number} y - Vertical expand value (negative means top, positive means bottom)
*/
seamlessExpand(x, y) { seamlessExpand(x, y) {
// First expand the grid to contain the additional space // First expand the grid to contain the additional space
this._expand(x, y) this._expand(x, y)