mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-19 04:07:33 +08:00
Replace parsing and test libraries
* WIP * WIP * wip * WIP * Several fixes * Tests wip port to playwright * WIP * Fix more tests * Serialization tests fixed * Several fixes for tests * Input options types * Type adjustments * Fix object reference parser * Tests fixes * More tests fixes
This commit is contained in:
@@ -3,6 +3,21 @@ import IDraggableElement from "../../element/IDraggableElement.js"
|
||||
import IPointing from "./IPointing.js"
|
||||
import Utility from "../../Utility.js"
|
||||
|
||||
/**
|
||||
* @typedef {import("./IPointing.js").Options & {
|
||||
* clickButton?: Number,
|
||||
* consumeEvent?: Boolean,
|
||||
* draggableElement?: HTMLElement,
|
||||
* exitAnyButton?: Boolean,
|
||||
* moveEverywhere?: Boolean,
|
||||
* movementSpace?: HTMLElement,
|
||||
* repositionOnClick?: Boolean,
|
||||
* scrollGraphEdge?: Boolean,
|
||||
* strictTarget?: Boolean,
|
||||
* stepSize?: Number,
|
||||
* }} Options
|
||||
*/
|
||||
|
||||
/**
|
||||
* @template {IElement} T
|
||||
* @extends {IPointing<T>}
|
||||
@@ -60,6 +75,7 @@ export default class IMouseClickDrag extends IPointing {
|
||||
this.lastLocation = Utility.snapToGrid(this.clickedPosition[0], this.clickedPosition[1], this.stepSize)
|
||||
this.startDrag(this.location)
|
||||
this.started = true
|
||||
this.#mouseMoveHandler(e)
|
||||
}
|
||||
|
||||
/** @param {MouseEvent} e */
|
||||
@@ -125,16 +141,16 @@ export default class IMouseClickDrag extends IPointing {
|
||||
#movementListenedElement
|
||||
#draggableElement
|
||||
|
||||
clickedOffset = [0, 0]
|
||||
clickedPosition = [0, 0]
|
||||
lastLocation = [0, 0]
|
||||
clickedOffset = /** @type {Coordinates} */([0, 0])
|
||||
clickedPosition = /** @type {Coordinates} */([0, 0])
|
||||
lastLocation = /** @type {Coordinates} */([0, 0])
|
||||
started = false
|
||||
stepSize = 1
|
||||
|
||||
/**
|
||||
* @param {T} target
|
||||
* @param {Blueprint} blueprint
|
||||
* @param {Object} options
|
||||
* @param {Options} options
|
||||
*/
|
||||
constructor(target, blueprint, options = {}) {
|
||||
options.clickButton ??= Configuration.mouseClickButton
|
||||
@@ -147,7 +163,7 @@ export default class IMouseClickDrag extends IPointing {
|
||||
options.scrollGraphEdge ??= false
|
||||
options.strictTarget ??= false
|
||||
super(target, blueprint, options)
|
||||
this.stepSize = parseInt(options?.stepSize ?? Configuration.gridSize)
|
||||
this.stepSize = Number(options.stepSize ?? Configuration.gridSize)
|
||||
this.#movementListenedElement = this.options.moveEverywhere ? document.documentElement : this.movementSpace
|
||||
this.#draggableElement = /** @type {HTMLElement} */(this.options.draggableElement)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user