All more or less working
This commit is contained in:
1 parent
22108112d3
commit
4190563bc3
7 files changed
+85
-82
No files matched your search
@@ -26,12 +26,6 @@ function newCanvas() {
|
||||
|
||||
let thisObject = {
|
||||
eventHandler: undefined,
|
||||
tutorialSpace: undefined,
|
||||
chartingSpace: undefined,
|
||||
floatingSpace: undefined,
|
||||
panelSpace: undefined,
|
||||
cockpitSpace: undefined,
|
||||
designSpace: undefined,
|
||||
animation: undefined,
|
||||
mouse: undefined,
|
||||
shorcutNumbers: new Map(),
|
||||
@@ -56,12 +50,12 @@ function newCanvas() {
|
||||
|
||||
function finalize() {
|
||||
try {
|
||||
thisObject.tutorialSpace.finalize()
|
||||
thisObject.docSpace.finalize()
|
||||
UI.projects.superalgos.spaces.tutorialSpace.finalize()
|
||||
UI.projects.superalgos.spaces.docSpace.finalize()
|
||||
//thisObject.chatSpace.finalize()
|
||||
thisObject.sideSpace.finalize()
|
||||
thisObject.chartingSpace.finalize()
|
||||
thisObject.floatingSpace.finalize()
|
||||
UI.projects.superalgos.spaces.sideSpace.finalize()
|
||||
UI.projects.superalgos.spaces.chartingSpace.finalize()
|
||||
UI.projects.superalgos.spaces.floatingSpace.finalize()
|
||||
thisObject.shorcutNumbers = undefined
|
||||
|
||||
if (browserCanvas.removeEventListener) {
|
||||
@@ -102,6 +96,10 @@ function newCanvas() {
|
||||
thisObject.animation = newAnimation()
|
||||
thisObject.animation.initialize()
|
||||
|
||||
/*
|
||||
Here we will setup the UI object, with all the
|
||||
projects and spaces.
|
||||
*/
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let projectDefinition = PROJECTS_SCHEMA[i]
|
||||
UI.projects[projectDefinition.propertyName] = {}
|
||||
@@ -162,14 +160,15 @@ function newCanvas() {
|
||||
let spaceInstance = spaceAnimationMap.get(j)
|
||||
let spaceDefinition = spaceDefinitionMap.get(j)
|
||||
if (spaceInstance === undefined || spaceDefinition === undefined) { continue }
|
||||
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Physics', spaceInstance.physics)
|
||||
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Draw', spaceInstance.draw)
|
||||
if (spaceInstance.physics !== undefined) {
|
||||
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Physics', spaceInstance.physics)
|
||||
}
|
||||
if (spaceInstance.draw !== undefined) {
|
||||
thisObject.animation.addCallBackFunction(spaceDefinition.name + ' ' + 'Draw', spaceInstance.draw)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log(UI)
|
||||
return
|
||||
|
||||
thisObject.animation.start()
|
||||
|
||||
} catch (err) {
|
||||
@@ -329,7 +328,7 @@ function newCanvas() {
|
||||
thisObject.mouse.action = 'key down'
|
||||
|
||||
checkMediaRecording(event)
|
||||
canvas.chartingSpace.onKeyPressed(event)
|
||||
UI.projects.superalgos.spaces.chartingSpace.onKeyPressed(event)
|
||||
|
||||
/* Shourcuts to Menu Items */
|
||||
if ((event.keyCode >= 48 && event.keyCode <= 57)) {
|
||||
@@ -349,37 +348,37 @@ function newCanvas() {
|
||||
}
|
||||
}
|
||||
|
||||
if (event.key === 'Escape' && canvas.floatingSpace.inMapMode === true) {
|
||||
canvas.floatingSpace.exitMapMode()
|
||||
if (event.key === 'Escape' && UI.projects.superalgos.spaces.floatingSpace.inMapMode === true) {
|
||||
UI.projects.superalgos.spaces.floatingSpace.exitMapMode()
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'M' || event.key === 'm')) {
|
||||
canvas.floatingSpace.toggleMapMode()
|
||||
UI.projects.superalgos.spaces.floatingSpace.toggleMapMode()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'R' || event.key === 'r')) {
|
||||
canvas.floatingSpace.toggleDrawReferenceLines()
|
||||
UI.projects.superalgos.spaces.floatingSpace.toggleDrawReferenceLines()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'C' || event.key === 'c')) {
|
||||
canvas.floatingSpace.toggleDrawChainLines()
|
||||
UI.projects.superalgos.spaces.floatingSpace.toggleDrawChainLines()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && (event.key === 'S' || event.key === 's')) {
|
||||
canvas.designSpace.workspace.save()
|
||||
UI.projects.superalgos.spaces.designSpace.workspace.save()
|
||||
if (event.preventDefault !== undefined) {
|
||||
event.preventDefault()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
let nodeOnFocus = await canvas.designSpace.workspace.getNodeThatIsOnFocus()
|
||||
let nodeOnFocus = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeThatIsOnFocus()
|
||||
if (nodeOnFocus !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.codeEditor !== undefined) {
|
||||
if (nodeOnFocus.payload.uiObject.codeEditor.visible === true) {
|
||||
@@ -425,55 +424,55 @@ function newCanvas() {
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowUp') {
|
||||
thisObject.cockpitSpace.toTop()
|
||||
UI.projects.superalgos.spaces.cockpitSpace.toTop()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowDown') {
|
||||
thisObject.cockpitSpace.toBottom()
|
||||
UI.projects.superalgos.spaces.cockpitSpace.toBottom()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowLeft') {
|
||||
thisObject.cockpitSpace.moveUp()
|
||||
UI.projects.superalgos.spaces.cockpitSpace.moveUp()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === true || event.metaKey === true) && event.code === 'ArrowRight') {
|
||||
thisObject.cockpitSpace.moveDown()
|
||||
UI.projects.superalgos.spaces.cockpitSpace.moveDown()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowLeft') {
|
||||
canvas.chartingSpace.oneScreenLeft()
|
||||
UI.projects.superalgos.spaces.chartingSpace.oneScreenLeft()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowRight') {
|
||||
canvas.chartingSpace.oneScreenRight()
|
||||
UI.projects.superalgos.spaces.chartingSpace.oneScreenRight()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowUp') {
|
||||
canvas.chartingSpace.oneScreenUp()
|
||||
UI.projects.superalgos.spaces.chartingSpace.oneScreenUp()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if (event.shiftKey === true && (event.ctrlKey === false && event.metaKey === false) && event.code === 'ArrowDown') {
|
||||
canvas.chartingSpace.oneScreenDown()
|
||||
UI.projects.superalgos.spaces.chartingSpace.oneScreenDown()
|
||||
event.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowLeft') {
|
||||
let displaceVector = canvas.floatingSpace.oneScreenLeft()
|
||||
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenLeft()
|
||||
if (displaceVector !== undefined) {
|
||||
dragVector.downX = dragVector.downX + displaceVector.x
|
||||
dragVector.downY = dragVector.downY + displaceVector.y
|
||||
@@ -484,7 +483,7 @@ function newCanvas() {
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowRight') {
|
||||
let displaceVector = canvas.floatingSpace.oneScreenRight()
|
||||
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenRight()
|
||||
if (displaceVector !== undefined) {
|
||||
dragVector.downX = dragVector.downX + displaceVector.x
|
||||
dragVector.downY = dragVector.downY + displaceVector.y
|
||||
@@ -495,7 +494,7 @@ function newCanvas() {
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowUp') {
|
||||
let displaceVector = canvas.floatingSpace.oneScreenUp()
|
||||
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenUp()
|
||||
if (displaceVector !== undefined) {
|
||||
dragVector.downX = dragVector.downX + displaceVector.x
|
||||
dragVector.downY = dragVector.downY + displaceVector.y
|
||||
@@ -506,7 +505,7 @@ function newCanvas() {
|
||||
}
|
||||
|
||||
if ((event.ctrlKey === true || event.metaKey === true) && event.shiftKey === false && event.code === 'ArrowDown') {
|
||||
let displaceVector = canvas.floatingSpace.oneScreenDown()
|
||||
let displaceVector = UI.projects.superalgos.spaces.floatingSpace.oneScreenDown()
|
||||
if (displaceVector !== undefined) {
|
||||
dragVector.downX = dragVector.downX + displaceVector.x
|
||||
dragVector.downY = dragVector.downY + displaceVector.y
|
||||
@@ -528,7 +527,7 @@ function newCanvas() {
|
||||
if ((event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 65 && event.keyCode <= 90)) {
|
||||
/* From here we prevent the default behaviour. Putting it earlier prevents imput box and text area to receive keystrokes */
|
||||
event.preventDefault()
|
||||
let nodeUsingThisKey = await canvas.designSpace.workspace.getNodeByShortcutKey(event.key)
|
||||
let nodeUsingThisKey = await UI.projects.superalgos.spaces.designSpace.workspace.getNodeByShortcutKey(event.key)
|
||||
|
||||
if (nodeUsingThisKey !== undefined) {
|
||||
if (nodeOnFocus !== undefined) {
|
||||
@@ -544,7 +543,7 @@ function newCanvas() {
|
||||
nodeOnFocus.payload.uiObject.setValue('Shortcut Key: Ctrl + Alt + ' + event.key)
|
||||
}
|
||||
} else {
|
||||
canvas.floatingSpace.positionAtNode(nodeUsingThisKey)
|
||||
UI.projects.superalgos.spaces.floatingSpace.positionAtNode(nodeUsingThisKey)
|
||||
}
|
||||
return
|
||||
} else {
|
||||
@@ -568,7 +567,7 @@ function newCanvas() {
|
||||
try {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
thisObject.cockpitSpace.toTop()
|
||||
UI.projects.superalgos.spaces.cockpitSpace.toTop()
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] onDragEnter -> err = ' + err.stack) }
|
||||
}
|
||||
@@ -612,7 +611,7 @@ function newCanvas() {
|
||||
x: event.x,
|
||||
y: event.y
|
||||
}
|
||||
thisObject.designSpace.workspace.spawn(reader.result, mousePosition)
|
||||
UI.projects.superalgos.spaces.designSpace.workspace.spawn(reader.result, mousePosition)
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
@@ -656,13 +655,14 @@ function newCanvas() {
|
||||
|
||||
for (let j = 0; j < projectDefinition.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseDownMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
|
||||
/*
|
||||
Here we manage a few exceptional behaviours. Specifically with the
|
||||
charting space and the floating space, since they have a non standard
|
||||
way of handling this event.
|
||||
*/
|
||||
if (spaceInstance.spaceDefinition.name === 'Charting Space') {
|
||||
if (spaceInstance.definition.name === 'Charting Space') {
|
||||
/* we check if it is over any of the existing containers at the Charting Space. */
|
||||
container = spaceInstance.getContainer(point, GET_CONTAINER_PURPOSE.DRAGGING)
|
||||
|
||||
@@ -682,9 +682,9 @@ function newCanvas() {
|
||||
continue
|
||||
}
|
||||
|
||||
if (spaceInstance.spaceDefinition.name === 'Floating Space') {
|
||||
if (spaceInstance.definition.name === 'Floating Space') {
|
||||
/* we check if it is over any of the existing containers at the Floating Space. */
|
||||
container = thisObject.floatingSpace.getContainer(point)
|
||||
container = spaceInstance.getContainer(point)
|
||||
|
||||
if (container !== undefined && container.isDraggeable === true) {
|
||||
containerBeingDragged = container
|
||||
@@ -758,6 +758,7 @@ function newCanvas() {
|
||||
|
||||
for (let j = 0; j < projectDefinition.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseClickMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
|
||||
if (spaceInstance.getContainer === undefined) { continue }
|
||||
container = spaceInstance.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_CLICK)
|
||||
@@ -801,14 +802,14 @@ function newCanvas() {
|
||||
point.x = event.pageX
|
||||
point.y = event.pageY - CURRENT_TOP_MARGIN
|
||||
|
||||
if (canvas.chartingSpace.viewport !== undefined) {
|
||||
canvas.chartingSpace.viewport.mousePosition.x = point.x
|
||||
canvas.chartingSpace.viewport.mousePosition.y = point.y
|
||||
if (UI.projects.superalgos.spaces.chartingSpace.viewport !== undefined) {
|
||||
UI.projects.superalgos.spaces.chartingSpace.viewport.mousePosition.x = point.x
|
||||
UI.projects.superalgos.spaces.chartingSpace.viewport.mousePosition.y = point.y
|
||||
}
|
||||
|
||||
if (containerDragStarted === true || floatingObjectDragStarted === true || viewPortBeingDragged === true) {
|
||||
if (floatingObjectDragStarted === true) {
|
||||
let targetContainer = thisObject.floatingSpace.getContainer(point)
|
||||
let targetContainer = UI.projects.superalgos.spaces.floatingSpace.getContainer(point)
|
||||
if (targetContainer !== undefined) {
|
||||
if (targetContainer.id !== containerBeingDragged.id) {
|
||||
containerBeingDragged.eventHandler.raiseEvent('onDragFinished', point)
|
||||
@@ -868,6 +869,7 @@ function newCanvas() {
|
||||
|
||||
for (let j = 0; j < projectDefinition.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseOverMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
|
||||
if (spaceInstance.getContainer === undefined) { continue }
|
||||
container = spaceInstance.getContainer(point, GET_CONTAINER_PURPOSE.MOUSE_OVER)
|
||||
@@ -927,6 +929,7 @@ function newCanvas() {
|
||||
|
||||
for (let j = 0; j < projectDefinition.spaces.length; j++) {
|
||||
let spaceInstance = projectInstance.events.onMouseWheelMap.get(j)
|
||||
if (spaceInstance === undefined) { continue }
|
||||
|
||||
if (spaceInstance.getContainer === undefined) { continue }
|
||||
container = spaceInstance.getContainer({ x: point.x, y: point.y })
|
||||
@@ -993,7 +996,7 @@ function newCanvas() {
|
||||
y: dragVector.upY - dragVector.downY
|
||||
}
|
||||
|
||||
canvas.chartingSpace.viewport.displace(displaceVector)
|
||||
UI.projects.superalgos.spaces.chartingSpace.viewport.displace(displaceVector)
|
||||
}
|
||||
if (containerDragStarted) {
|
||||
if (containerBeingDragged !== undefined) {
|
||||
@@ -1004,7 +1007,7 @@ function newCanvas() {
|
||||
}
|
||||
|
||||
let downNoZoom
|
||||
downNoZoom = canvas.chartingSpace.viewport.unTransformThisPoint(downCopy)
|
||||
downNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(downCopy)
|
||||
|
||||
let upCopy = {
|
||||
x: dragVector.upX,
|
||||
@@ -1012,7 +1015,7 @@ function newCanvas() {
|
||||
}
|
||||
|
||||
let upNoZoom
|
||||
upNoZoom = canvas.chartingSpace.viewport.unTransformThisPoint(upCopy)
|
||||
upNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(upCopy)
|
||||
|
||||
displaceVector = {
|
||||
x: upNoZoom.x - downNoZoom.x,
|
||||
|
||||
@@ -53,7 +53,7 @@ function newFrame() {
|
||||
}
|
||||
|
||||
function isInViewPort() {
|
||||
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the canvas.chartingSpace.viewport */
|
||||
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.superalgos.spaces.chartingSpace.viewport */
|
||||
|
||||
point1 = {
|
||||
x: 0,
|
||||
@@ -70,7 +70,7 @@ function newFrame() {
|
||||
point1 = transformThisPoint(point1, thisObject.container)
|
||||
point3 = transformThisPoint(point3, thisObject.container)
|
||||
|
||||
if (point1.x < canvas.chartingSpace.viewport.visibleArea.topRight.x && point1.y < canvas.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > canvas.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > canvas.chartingSpace.viewport.visibleArea.topLeft.y) {
|
||||
if (point1.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight.x && point1.y < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
@@ -78,7 +78,7 @@ function newFrame() {
|
||||
}
|
||||
|
||||
function isCenterInViewPort() {
|
||||
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the canvas.chartingSpace.viewport */
|
||||
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the UI.projects.superalgos.spaces.chartingSpace.viewport */
|
||||
|
||||
point1 = {
|
||||
x: thisObject.width * 40 / 100,
|
||||
@@ -95,7 +95,7 @@ function newFrame() {
|
||||
point1 = transformThisPoint(point1, thisObject.container)
|
||||
point3 = transformThisPoint(point3, thisObject.container)
|
||||
|
||||
if (point1.x < canvas.chartingSpace.viewport.visibleArea.topRight.x && point1.y < canvas.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > canvas.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > canvas.chartingSpace.viewport.visibleArea.topLeft.y) {
|
||||
if (point1.x < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topRight.x && point1.y < UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomRight.y && point3.x > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.bottomLeft.x && point3.y > UI.projects.superalgos.spaces.chartingSpace.viewport.visibleArea.topLeft.y) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
|
||||
+2
-2
@@ -183,9 +183,9 @@ const _1_MINUTE_IN_MILISECONDS = 1 * 60 * 1000;
|
||||
|
||||
|
||||
|
||||
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the canvas.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the UI.projects.superalgos.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let INITIAL_ZOOM_LEVEL = -28.25 // This is the zoom level at the view port in which the APP starts.
|
||||
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the canvas.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let INITIAL_TIME_PERIOD = ONE_DAY_IN_MILISECONDS // This value will be overwritten at the UI.projects.superalgos.spaces.chartingSpace.viewport.initialize if the user had a prevous session with this same browser.
|
||||
let VERY_LARGE_NUMBER = 100000000000000
|
||||
|
||||
const TOP_MARGIN = 0
|
||||
|
||||
+1
-1
@@ -141,7 +141,7 @@ function newPostLoader() {
|
||||
window.addEventListener('keydown', window.manageBackRefresh)
|
||||
|
||||
function saveWorkspace() {
|
||||
canvas.designSpace.workspace.save()
|
||||
UI.projects.superalgos.spaces.designSpace.workspace.save()
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -54,14 +54,14 @@ function moveToUserPosition(container, currentDate, currentRate, coordinateSyste
|
||||
y: currentRate
|
||||
}
|
||||
|
||||
/* Put this point in the coordinate system of the canvas.chartingSpace.viewport */
|
||||
/* Put this point in the coordinate system of the UI.projects.superalgos.spaces.chartingSpace.viewport */
|
||||
targetPoint = coordinateSystem.transformThisPoint(targetPoint)
|
||||
targetPoint = transformThisPoint(targetPoint, container)
|
||||
|
||||
let displaceVector
|
||||
|
||||
let targetNoZoom = canvas.chartingSpace.viewport.unTransformThisPoint(targetPoint)
|
||||
let mouseNoZoom = canvas.chartingSpace.viewport.unTransformThisPoint(mousePosition)
|
||||
let targetNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(targetPoint)
|
||||
let mouseNoZoom = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(mousePosition)
|
||||
|
||||
displaceVector = {
|
||||
x: mouseNoZoom.x - targetNoZoom.x,
|
||||
|
||||
@@ -3,14 +3,14 @@ function transformThisPoint(point, container) {
|
||||
|
||||
point = container.frame.frameThisPoint(point)
|
||||
|
||||
/* We pass this point through the canvas.chartingSpace.viewport lends, meaning we apply the canvas.chartingSpace.viewport zoom and displacement. */
|
||||
/* We pass this point through the UI.projects.superalgos.spaces.chartingSpace.viewport lends, meaning we apply the UI.projects.superalgos.spaces.chartingSpace.viewport zoom and displacement. */
|
||||
|
||||
point = canvas.chartingSpace.viewport.transformThisPoint(point)
|
||||
point = UI.projects.superalgos.spaces.chartingSpace.viewport.transformThisPoint(point)
|
||||
return point
|
||||
}
|
||||
|
||||
function unTransformThisPoint(point, container) {
|
||||
point = canvas.chartingSpace.viewport.unTransformThisPoint(point)
|
||||
point = UI.projects.superalgos.spaces.chartingSpace.viewport.unTransformThisPoint(point)
|
||||
|
||||
point = container.frame.unframeThisPoint(point)
|
||||
return point
|
||||
|
||||
+19
-19
@@ -20,12 +20,12 @@ function newVideoRecorder() {
|
||||
const DISTANCE_BETWEEN_ICONS = 35
|
||||
const ICON_SIZES = 50
|
||||
|
||||
let mousePointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-pointer')
|
||||
let draggingIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'hand-drag')
|
||||
let mousePointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-pointer')
|
||||
let draggingIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'hand-drag')
|
||||
|
||||
let leftClickIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-left-click')
|
||||
let rightClickIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-right-click')
|
||||
let wheelClickIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-click')
|
||||
let leftClickIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-left-click')
|
||||
let rightClickIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-right-click')
|
||||
let wheelClickIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-click')
|
||||
|
||||
let imagePosition
|
||||
let buttonPressedIcon
|
||||
@@ -45,10 +45,10 @@ function newVideoRecorder() {
|
||||
case 'wheel': {
|
||||
wheelAnimationCounter = 25
|
||||
if (canvas.mouse.event.delta > 0) {
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-up')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-up')
|
||||
lastWheelPointerIcon = pointerIcon
|
||||
} else {
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-down')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'mouse-wheel-down')
|
||||
lastWheelPointerIcon = pointerIcon
|
||||
}
|
||||
|
||||
@@ -65,27 +65,27 @@ function newVideoRecorder() {
|
||||
switch (key.toLowerCase()) {
|
||||
case 'escape':
|
||||
{
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-m')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-m')
|
||||
break
|
||||
}
|
||||
case 'm':
|
||||
{
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-m')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-m')
|
||||
break
|
||||
}
|
||||
case 'a':
|
||||
{
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-a')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-a')
|
||||
break
|
||||
}
|
||||
case 'r':
|
||||
{
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-r')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-r')
|
||||
break
|
||||
}
|
||||
case 'c':
|
||||
{
|
||||
pointerIcon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-r')
|
||||
pointerIcon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-r')
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ function newVideoRecorder() {
|
||||
drawMousePointer(buttonPressedIcon, imagePosition, ICON_SIZES)
|
||||
|
||||
if (canvas.mouse.event.shiftKey === true) {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-shift')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-shift')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x - DISTANCE_BETWEEN_ICONS * 3,
|
||||
y: canvas.mouse.position.y + firstRow
|
||||
@@ -148,7 +148,7 @@ function newVideoRecorder() {
|
||||
}
|
||||
|
||||
if (canvas.mouse.event.ctrlKey === true || canvas.mouse.event.metaKey === true) {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-ctrl')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-ctrl')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x - DISTANCE_BETWEEN_ICONS * 3,
|
||||
y: canvas.mouse.position.y + secondRow
|
||||
@@ -157,7 +157,7 @@ function newVideoRecorder() {
|
||||
}
|
||||
|
||||
if (canvas.mouse.event.altKey === true) {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-alt')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-alt')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x + DISTANCE_BETWEEN_ICONS * 3 + ICON_SIZES * 0,
|
||||
y: canvas.mouse.position.y + secondRow
|
||||
@@ -166,7 +166,7 @@ function newVideoRecorder() {
|
||||
}
|
||||
|
||||
if (canvas.mouse.event.code === 'ArrowUp') {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-up')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-up')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x - 0,
|
||||
y: canvas.mouse.position.y + firstRow
|
||||
@@ -175,7 +175,7 @@ function newVideoRecorder() {
|
||||
}
|
||||
|
||||
if (canvas.mouse.event.code === 'ArrowDown') {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-down')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-down')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x - 0,
|
||||
y: canvas.mouse.position.y + secondRow
|
||||
@@ -184,7 +184,7 @@ function newVideoRecorder() {
|
||||
}
|
||||
|
||||
if (canvas.mouse.event.code === 'ArrowLeft') {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-left')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-left')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x - DISTANCE_BETWEEN_ICONS * 0 - ICON_SIZES * 1,
|
||||
y: canvas.mouse.position.y + secondRow
|
||||
@@ -193,7 +193,7 @@ function newVideoRecorder() {
|
||||
}
|
||||
|
||||
if (canvas.mouse.event.code === 'ArrowRight') {
|
||||
icon = canvas.designSpace.getIconByProjectAndName( 'Superalgos', 'key-right')
|
||||
icon = UI.projects.superalgos.spaces.designSpace.getIconByProjectAndName( 'Superalgos', 'key-right')
|
||||
imagePosition = {
|
||||
x: canvas.mouse.position.x + DISTANCE_BETWEEN_ICONS * 0 + ICON_SIZES * 1,
|
||||
y: canvas.mouse.position.y + secondRow
|
||||
|
||||
Reference in new issue
Block a user