Viewport inside the Chartspace

This commit is contained in:
Luis Fernando Molina committed 2020-01-17 18:46:20 +01:00
1 parent d370306e23
commit 3389c1c64c
18 files changed
+96 -110

No files matched your search

+21 -10
View File
@@ -125,7 +125,7 @@ function newCanvas () {
animation.addCallBackFunction('Chart Space Physics', thisObject.chartSpace.physics)
animation.addCallBackFunction('Strategy Space Physics', thisObject.designerSpace.physics)
animation.addCallBackFunction('Panels Space Physics', thisObject.panelsSpace.physics)
animation.addCallBackFunction('ViewPort physics', viewPort.physics)
animation.addCallBackFunction('ViewPort physics', canvas.chartSpace.viewport.physics)
/* Spcaces Drawing */
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
@@ -146,7 +146,7 @@ function newCanvas () {
browserCanvasContext = browserCanvas.getContext('2d')
browserCanvasContext.font = 'Saira Condensed'
viewPort.initialize()
canvas.chartSpace.viewport.initialize()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] initializeBrowserCanvas -> err = ' + err.stack) }
}
@@ -154,11 +154,12 @@ function newCanvas () {
function addCanvasEvents () {
try {
canvas.eventHandler.listenToEvent('Browser Resized', browserResized)
/* Keyboard events */
window.addEventListener('keydown', onKeyDown, true)
/* Mouse Events */
browserCanvas.addEventListener('mousedown', onMouseDown, false)
browserCanvas.addEventListener('mouseup', onMouseUp, false)
browserCanvas.addEventListener('mousemove', onMouseMove, false)
@@ -171,7 +172,6 @@ function newCanvas () {
} else browserCanvas.attachEvent('onmousewheel', onMouseWheel)// IE 6/7/8
/* Dragging Files Over the Canvas */
browserCanvas.addEventListener('dragenter', onDragEnter, false)
browserCanvas.addEventListener('dragleave', onDragLeave, false)
browserCanvas.addEventListener('dragover', onDragOver, false)
@@ -186,6 +186,17 @@ function newCanvas () {
}
}
function browserResized () {
try {
browserCanvas = document.getElementById('canvas')
browserCanvas.width = window.innerWidth
browserCanvas.height = window.innerHeight - CURRENT_TOP_MARGIN
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] browserResized -> err = ' + err.stack) }
}
}
function onKeyDown (event) {
let nodeOnFocus = canvas.designerSpace.workspace.getNodeThatIsOnFocus()
if (nodeOnFocus !== undefined) {
@@ -623,8 +634,8 @@ function newCanvas () {
y: event.pageY - CURRENT_TOP_MARGIN
}
viewPort.mousePosition.x = point.x
viewPort.mousePosition.y = point.y
canvas.chartSpace.viewport.mousePosition.x = point.x
canvas.chartSpace.viewport.mousePosition.y = point.y
if (containerDragStarted === true || floatingObjectDragStarted === true || viewPortBeingDragged === true) {
if (floatingObjectDragStarted === true) {
@@ -794,7 +805,7 @@ function newCanvas () {
}
if (container !== undefined) {
viewPort.applyZoom(delta)
canvas.chartSpace.viewport.applyZoom(delta)
return false
}
@@ -862,7 +873,7 @@ function newCanvas () {
}
let downNoZoom
downNoZoom = viewPort.unzoomThisPoint(downCopy)
downNoZoom = canvas.chartSpace.viewport.unzoomThisPoint(downCopy)
let upCopy = {
x: dragVector.upX,
@@ -870,7 +881,7 @@ function newCanvas () {
}
let upNoZoom
upNoZoom = viewPort.unzoomThisPoint(upCopy)
upNoZoom = canvas.chartSpace.viewport.unzoomThisPoint(upCopy)
displaceVector = {
x: upNoZoom.x - downNoZoom.x,
@@ -879,7 +890,7 @@ function newCanvas () {
}
if (viewPortBeingDragged) {
viewPort.displace(displaceVector)
canvas.chartSpace.viewport.displace(displaceVector)
}
if (containerBeingDragged !== undefined) {
+8 -8
View File
@@ -72,8 +72,8 @@ function newTimelineChart () {
finalizeTimeFrameScale()
}
viewPort.eventHandler.stopListening(onViewportPositionChangedEventSuscriptionId)
viewPort.eventHandler.stopListening(onViewportZoomChangedEventSuscriptionId)
canvas.chartSpace.viewport.eventHandler.stopListening(onViewportPositionChangedEventSuscriptionId)
canvas.chartSpace.viewport.eventHandler.stopListening(onViewportZoomChangedEventSuscriptionId)
thisObject.container.eventHandler.stopListening(onMouseOverEventSuscriptionId)
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSuscriptionId)
@@ -132,8 +132,8 @@ function newTimelineChart () {
datetime = NEW_SESSION_INITIAL_DATE
/* Event Subscriptions - we need this events to be fired first here and then in active Plotters. */
onViewportPositionChangedEventSuscriptionId = viewPort.eventHandler.listenToEvent('Position Changed', onViewportPositionChanged)
onViewportZoomChangedEventSuscriptionId = viewPort.eventHandler.listenToEvent('Zoom Changed', onViewportZoomChanged)
onViewportPositionChangedEventSuscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent('Position Changed', onViewportPositionChanged)
onViewportZoomChangedEventSuscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent('Zoom Changed', onViewportZoomChanged)
onMouseOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
onMouseNotOverEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
@@ -267,8 +267,8 @@ function newTimelineChart () {
*/
let center = {
x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.bottomLeft.x) / 2,
y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) / 2
x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.bottomLeft.x) / 2,
y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) / 2
}
center = unTransformThisPoint(center, thisObject.container)
@@ -365,7 +365,7 @@ function newTimelineChart () {
}
function tooTiny () {
if (viewPort.zoomLevel < Math.trunc(-28.25 * 100) / 100) {
if (canvas.chartSpace.viewport.zoomLevel < Math.trunc(-28.25 * 100) / 100) {
return true
} else {
return false
@@ -373,7 +373,7 @@ function newTimelineChart () {
}
function tooSmall () {
if (viewPort.zoomLevel < Math.trunc(-27.25 * 100) / 100) {
if (canvas.chartSpace.viewport.zoomLevel < Math.trunc(-27.25 * 100) / 100) {
return true
} else {
return false
+1 -1
View File
@@ -439,7 +439,7 @@ function newViewPort () {
let frame = {}
frame.position = position
saveFrame(thisObject.payload, frame)
// saveFrame(thisObject.payload, frame)
}
function readObjectState () {
+1 -1
View File
@@ -26,7 +26,7 @@ function newSidePanel () {
thisObject.sidePanelTab.container.connectToParent(thisObject.container, false, false)
thisObject.sidePanelTab.initialize()
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
canvas.eventHandler.listenToEvent('Browser Resized', resize)
isInitialized = true
}
+1 -33
View File
@@ -2,7 +2,7 @@ let canvas
let markets
let ecosystem = newEcosystem()
let systemEventHandler
let viewPort
let APP_SCHEMA_MAP = new Map()
let APP_SCHEMA_ARRAY = []
@@ -19,17 +19,12 @@ function newDashboard () {
const DEBUG_START_UP_DELAY = 0 // 3000; // This is a waiting time in case there is a need to debug the very first steps of initialization, to be able to hit F12 on time.
let userProfileChangedEventSubscriptionId
let browserResizedEventSubscriptionId
return thisObject
function start () {
try {
setBrowserEvents()
viewPort = newViewPort()
systemEventHandler = newSystemEventHandler()
systemEventHandler.initialize(setUpAppSchema)
@@ -61,12 +56,6 @@ function newDashboard () {
window.localStorage.setItem(LOGGED_IN_USER_LOCAL_STORAGE_KEY, '{"authId":"x|x","alias":"user"}') // Dummy Local User
}
/* Here we will setup the global eventHandler that will enable the Canvas App to react to events happening outside its execution scope. */
window.canvasApp.eventHandler = newEventHandler()
userProfileChangedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('User Profile Changed', userProfileChanged)
browserResizedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('Browser Resized', browserResized)
/* Here we used to have a call to the DataMines Module to get the profile pictures. That was removed but to keep things working, we do this: */
window.canvasApp.context.dataMineProfileImages = new Map()
@@ -100,27 +89,6 @@ function newDashboard () {
}
}
function userProfileChanged () {
try {
canvas.topSpace.initialize()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] userProfileChanged -> err = ' + err.stack) }
}
}
function browserResized () {
try {
browserCanvas = document.getElementById('canvas')
browserCanvas.width = window.innerWidth
browserCanvas.height = window.innerHeight - CURRENT_TOP_MARGIN
viewPort.initialize()
} catch (err) {
if (ERROR_LOG === true) { logger.write('[ERROR] browserResized -> err = ' + err.stack) }
}
}
function setBrowserEvents () {
window.onbeforeunload = onBrowserClosed
function onBrowserClosed () {
+2 -2
View File
@@ -41,7 +41,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 viewPort */
/* This function is usefull to know if the object who has this frame is currently appearing at least in part at the canvas.chartSpace.viewport */
point1 = {
x: 0,
@@ -58,7 +58,7 @@ function newFrame () {
point1 = transformThisPoint(point1, thisObject.container)
point3 = transformThisPoint(point3, thisObject.container)
if (point1.x < viewPort.visibleArea.topRight.x && point1.y < viewPort.visibleArea.bottomRight.y && point3.x > viewPort.visibleArea.bottomLeft.x && point3.y > viewPort.visibleArea.topLeft.y) {
if (point1.x < canvas.chartSpace.viewport.visibleArea.topRight.x && point1.y < canvas.chartSpace.viewport.visibleArea.bottomRight.y && point3.x > canvas.chartSpace.viewport.visibleArea.bottomLeft.x && point3.y > canvas.chartSpace.viewport.visibleArea.topLeft.y) {
return true
} else {
return false
+2 -2
View File
@@ -143,9 +143,9 @@ const _3_MINUTES_IN_MILISECONDS = 3 * 60 * 1000;
const _2_MINUTES_IN_MILISECONDS = 2 * 60 * 1000;
const _1_MINUTE_IN_MILISECONDS = 1 * 60 * 1000;
let NEW_SESSION_INITIAL_DATE = new Date(); // This value will be overwritten at the 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 canvas.chartSpace.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 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 canvas.chartSpace.viewport.initialize if the user had a prevous session with this same browser.
let VERY_LARGE_NUMBER = 100000000000
let CURRENT_TOP_MARGIN = window.canvasApp.topMargin
+3 -3
View File
@@ -61,8 +61,8 @@ function newProductsPanel () {
thisObject.container.frame.height = heatherHeight
let position = {
x: viewPort.visibleArea.topLeft.x,
y: viewPort.visibleArea.topLeft.y// viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height
x: canvas.chartSpace.viewport.visibleArea.topLeft.x,
y: canvas.chartSpace.viewport.visibleArea.topLeft.y// canvas.chartSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height
}
thisObject.container.frame.position = position
@@ -136,7 +136,7 @@ function newProductsPanel () {
}
function panelSizePhysics () {
let viewPortHeight = viewPort.visibleArea.bottomLeft.y - viewPort.visibleArea.topLeft.y
let viewPortHeight = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - canvas.chartSpace.viewport.visibleArea.topLeft.y
if (viewPortHeight < heatherHeight) {
visible = false
+2 -2
View File
@@ -55,7 +55,7 @@ function newPanelTabButton () {
visiblePosition.y = thisObject.parentContainer.frame.position.y
hiddenPosition.x = thisObject.parentContainer.frame.position.x
hiddenPosition.y = viewPort.visibleArea.bottomRight.y
hiddenPosition.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y
transitionPosition.x = visiblePosition.x
transitionPosition.y = visiblePosition.y
@@ -72,7 +72,7 @@ function newPanelTabButton () {
visiblePosition.y = thisObject.parentContainer.frame.position.y
hiddenPosition.x = thisObject.parentContainer.frame.position.x
hiddenPosition.y = viewPort.visibleArea.bottomRight.y
hiddenPosition.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y
transitionPosition.x = visiblePosition.x
transitionPosition.y = visiblePosition.y
+2 -2
View File
@@ -45,8 +45,8 @@ function newPlotterPanel () {
thisObject.container.frame.width = UI_PANEL.WIDTH.NORMAL
thisObject.container.frame.height = UI_PANEL.HEIGHT.NORMAL
thisObject.container.frame.position.x = viewPort.visibleArea.topRight.x - thisObject.container.frame.width - thisObject.container.frame.width * Math.random() * 8
thisObject.container.frame.position.y = viewPort.visibleArea.bottomLeft.y - thisObject.container.frame.height - thisObject.container.frame.height * Math.random() * 1.5
thisObject.container.frame.position.x = canvas.chartSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width - thisObject.container.frame.width * Math.random() * 8
thisObject.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height - thisObject.container.frame.height * Math.random() * 1.5
panelTabButton = newPanelTabButton()
panelTabButton.parentContainer = thisObject.container
+12 -12
View File
@@ -34,7 +34,7 @@ function newPlotter () {
let coordinateSystem = newCoordinateSystem() // Needed to be able to plot on the timeline.
let slotCoordinateSystem // Needed to be able to plot on a slot over the timeline.
let plotterModuleConfig
let slotHeight = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 10 // This is the amount of slots available
let slotHeight = (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y) / 10 // This is the amount of slots available
let mustRecalculateDataPoints = false
let atMousePositionFillStyles = new Map()
let atMousePositionStrokeStyles = new Map()
@@ -66,8 +66,8 @@ function newPlotter () {
function finalize () {
try {
/* Stop listening to the necesary events. */
viewPort.eventHandler.stopListening(zoomChangedEventSubscriptionId)
viewPort.eventHandler.stopListening(offsetChangedEventSubscriptionId)
canvas.chartSpace.viewport.eventHandler.stopListening(zoomChangedEventSubscriptionId)
canvas.chartSpace.viewport.eventHandler.stopListening(offsetChangedEventSubscriptionId)
canvas.eventHandler.stopListening(dragFinishedEventSubscriptionId)
thisObject.container.eventHandler.stopListening(dimmensionsChangedEventSubscriptionId)
marketFiles.eventHandler.stopListening(marketFilesUpdatedEventSubscriptionId)
@@ -117,8 +117,8 @@ function newPlotter () {
fileCursor = dailyFiles.getFileCursor(pTimeFrame)
/* Listen to the necesary events. */
zoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent('Zoom Changed', onViewportZoomChanged)
offsetChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent('Position Changed', onViewportPositionChanged)
zoomChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent('Zoom Changed', onViewportZoomChanged)
offsetChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent('Position Changed', onViewportPositionChanged)
dragFinishedEventSubscriptionId = canvas.eventHandler.listenToEvent('Drag Finished', onDragFinished)
marketFilesUpdatedEventSubscriptionId = marketFiles.eventHandler.listenToEvent('Files Updated', onMarketFilesUpdated)
dailyFilesUpdatedEventSubscriptionId = dailyFiles.eventHandler.listenToEvent('Files Updated', onDailyFilesUpdated)
@@ -353,8 +353,8 @@ function newPlotter () {
let daysOnSides = getSideDays(timeFrame)
let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem)
let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem)
let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem)
let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem)
let dateDiff = rightDate.valueOf() - leftDate.valueOf()
@@ -406,8 +406,8 @@ function newPlotter () {
let daysOnSides = getSideDays(timeFrame)
let leftDate = getDateFromPoint(viewPort.visibleArea.topLeft, thisObject.container, coordinateSystem)
let rightDate = getDateFromPoint(viewPort.visibleArea.topRight, thisObject.container, coordinateSystem)
let leftDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topLeft, thisObject.container, coordinateSystem)
let rightDate = getDateFromPoint(canvas.chartSpace.viewport.visibleArea.topRight, thisObject.container, coordinateSystem)
let dateDiff = rightDate.valueOf() - leftDate.valueOf()
@@ -517,7 +517,7 @@ function newPlotter () {
beginPoint = transformThisPoint(beginPoint, thisObject.container)
endPoint = transformThisPoint(endPoint, thisObject.container)
if (endPoint.x < viewPort.visibleArea.bottomLeft.x || beginPoint.x > viewPort.visibleArea.bottomRight.x) {
if (endPoint.x < canvas.chartSpace.viewport.visibleArea.bottomLeft.x || beginPoint.x > canvas.chartSpace.viewport.visibleArea.bottomRight.x) {
continue
}
@@ -580,7 +580,7 @@ function newPlotter () {
if (plotterModuleConfig !== undefined) {
if (plotterModuleConfig.slot !== undefined) {
/* We reset the y coordinate since it will be transformed with another coordinate system to fit into a slot. */
dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + viewPort.visibleArea.topLeft.y
dataPoint.y = (-1) * y * slotCoordinateSystem.scale.y + (plotterModuleConfig.slot.number - 1) * slotHeight + canvas.chartSpace.viewport.visibleArea.topLeft.y
}
}
}
@@ -720,7 +720,7 @@ function newPlotter () {
y: dataPointObject.y
}
/* We make sure the points do not fall outside the viewport visible area. This step allways need to be done. */
dataPoint = viewPort.fitIntoVisibleArea(dataPoint)
dataPoint = canvas.chartSpace.viewport.fitIntoVisibleArea(dataPoint)
if (k === 0) {
browserCanvasContext.moveTo(dataPoint.x, dataPoint.y)
} else {
+2 -2
View File
@@ -59,7 +59,7 @@ function newTimeFrameScale () {
function finalize () {
thisObject.container.eventHandler.stopListening(onMouseWheelEventSubscriptionId)
viewPort.eventHandler.stopListening(onViewportZoomChangedEventSubscriptionId)
canvas.chartSpace.viewport.eventHandler.stopListening(onViewportZoomChangedEventSubscriptionId)
thisObject.container.eventHandler.stopListening(onMouseOverEventSubscriptionId)
thisObject.container.eventHandler.stopListening(onMouseNotOverEventSubscriptionId)
@@ -77,7 +77,7 @@ function newTimeFrameScale () {
newTimeFrame()
onMouseWheelEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
onViewportZoomChangedEventSubscriptionId = viewPort.eventHandler.listenToEvent('Zoom Changed', onViewportZoomChanged)
onViewportZoomChangedEventSubscriptionId = canvas.chartSpace.viewport.eventHandler.listenToEvent('Zoom Changed', onViewportZoomChanged)
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
}
+14 -7
View File
@@ -17,6 +17,7 @@ function newChartSpace () {
container: undefined,
inViewport: undefined,
timeMachines: undefined,
viewport: undefined,
reset: reset,
oneScreenUp: oneScreenUp,
oneScreenDown: oneScreenDown,
@@ -74,10 +75,15 @@ function newChartSpace () {
thisObject.container.finalize()
thisObject.container = undefined
thisObject.viewport.finalize()
thisObject.viewport = undefined
}
function initialize () {
canvasBrowserResizedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
thisObject.viewport = newViewPort()
thisObject.viewport.initialize()
canvasBrowserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
}
function getContainer (point, purpose) {
@@ -119,6 +125,7 @@ function newChartSpace () {
}
function resize () {
thisObject.viewport.resize()
thisObject.container.frame.width = browserCanvas.width
thisObject.container.frame.height = COCKPIT_SPACE_POSITION
}
@@ -129,7 +136,7 @@ function newChartSpace () {
y: +browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
}
viewPort.displace(displaceVector)
canvas.chartSpace.viewport.displace(displaceVector)
}
function oneScreenDown () {
@@ -138,7 +145,7 @@ function newChartSpace () {
y: -browserCanvas.height * PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT / 100
}
viewPort.displace(displaceVector)
canvas.chartSpace.viewport.displace(displaceVector)
}
function oneScreenLeft () {
@@ -147,7 +154,7 @@ function newChartSpace () {
y: 0
}
viewPort.displace(displaceVector, true)
canvas.chartSpace.viewport.displace(displaceVector, true)
}
function oneScreenRight () {
@@ -156,7 +163,7 @@ function newChartSpace () {
y: 0
}
viewPort.displace(displaceVector, true)
canvas.chartSpace.viewport.displace(displaceVector, true)
}
function fitFunction (point, fullVisible) {
@@ -279,7 +286,7 @@ function newChartSpace () {
thisObject.timeMachines.push(timeMachine)
timeMachine.payload.uiObject.setValue('')
viewPort.raiseEvents() // These events will impacts on objects just initialized.
canvas.chartSpace.viewport.raiseEvents() // These events will impacts on objects just initialized.
}
}
}
@@ -293,7 +300,7 @@ function newChartSpace () {
thisObject.visible = true
}
viewPort.resize()
canvas.chartSpace.viewport.resize()
}
function childrenPhysics () {
+2 -2
View File
@@ -62,7 +62,7 @@
thisObject.container.frame.position.y = browserCanvas.height * INITIAL_POSITION / 100 - COCKPIT_SPACE_HEIGHT
}
canvasBrowserResizedEventSubscriptionId = window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
canvasBrowserResizedEventSubscriptionId = canvas.eventHandler.listenToEvent('Browser Resized', resize)
selfMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
thisObject.assetBalances = newQuotedAssetalances()
@@ -150,7 +150,7 @@
spacePosition: COCKPIT_SPACE_POSITION
}
window.localStorage.setItem(MODULE_NAME, JSON.stringify(storage))
viewPort.resize()
canvas.chartSpace.viewport.resize()
}
function getContainer (point) {
+7 -7
View File
@@ -146,8 +146,8 @@ function newPanelsSpace () {
centerPoint.y = centerPoint.y + panel.container.frame.height / 2
/* Lets see which quadrant the panel is at */
let verticalLine = (viewPort.visibleArea.topRight.x - viewPort.visibleArea.topLeft.x) / 2 + viewPort.visibleArea.topLeft.x
let horizontalLine = (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) * 2 / 3 + viewPort.visibleArea.topRight.y
let verticalLine = (canvas.chartSpace.viewport.visibleArea.topRight.x - canvas.chartSpace.viewport.visibleArea.topLeft.x) / 2 + canvas.chartSpace.viewport.visibleArea.topLeft.x
let horizontalLine = (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) * 2 / 3 + canvas.chartSpace.viewport.visibleArea.topRight.y
/* According to the quadrant we push the panels to the sides */
if (centerPoint.x < verticalLine) {
@@ -173,7 +173,7 @@ function newPanelsSpace () {
panel.container.frame.position.x = browserCanvas.width - panel.container.frame.width
}
}
if (panel.container.frame.height <= viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y) {
if (panel.container.frame.height <= canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topRight.y) {
if (centerPoint.y < horizontalLine) {
panel.container.frame.position.y = panel.container.frame.position.y - panel.container.speed.y
if (isOverlapping(i, panel.container) === true) {
@@ -182,8 +182,8 @@ function newPanelsSpace () {
} else {
desAccelerateOnY()
}
if (panel.container.frame.position.y < viewPort.visibleArea.topLeft.y) {
panel.container.frame.position.y = viewPort.visibleArea.topLeft.y
if (panel.container.frame.position.y < canvas.chartSpace.viewport.visibleArea.topLeft.y) {
panel.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.topLeft.y
}
} else {
panel.container.frame.position.y = panel.container.frame.position.y + panel.container.speed.y
@@ -193,8 +193,8 @@ function newPanelsSpace () {
} else {
desAccelerateOnY()
}
if (panel.container.frame.position.y + panel.container.frame.height > viewPort.visibleArea.bottomRight.y) {
panel.container.frame.position.y = viewPort.visibleArea.bottomRight.y - panel.container.frame.height
if (panel.container.frame.position.y + panel.container.frame.height > canvas.chartSpace.viewport.visibleArea.bottomRight.y) {
panel.container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomRight.y - panel.container.frame.height
}
}
}
+2 -2
View File
@@ -18,7 +18,7 @@ function newTopSpace () {
return thisObject
function initialize () {
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
canvas.eventHandler.listenToEvent('Browser Resized', resize)
}
function resize () {
@@ -27,7 +27,7 @@ function newTopSpace () {
container.frame.position.x = 0
try {
container.frame.position.y = viewPort.visibleArea.bottomLeft.y
container.frame.position.y = canvas.chartSpace.viewport.visibleArea.bottomLeft.y
} catch (e) { }
}
+1 -1
View File
@@ -45,7 +45,7 @@ function newSplashScreen () {
logo.src = window.canvasApp.urlPrefix + 'Images/Superalgos-logo-horz-sm-t.png'
window.canvasApp.eventHandler.listenToEvent('Browser Resized', resize)
canvas.eventHandler.listenToEvent('Browser Resized', resize)
}
function resize () {
+13 -13
View File
@@ -55,15 +55,15 @@ function transformThisPoint (point, container) {
point = container.frame.frameThisPoint(point)
/* We pass this point through the viewPort lends, meaning we apply the viewPort zoom and displacement. */
/* We pass this point through the canvas.chartSpace.viewport lends, meaning we apply the canvas.chartSpace.viewport zoom and displacement. */
point = viewPort.zoomThisPoint(point)
point = canvas.chartSpace.viewport.zoomThisPoint(point)
return point
}
function unTransformThisPoint (point, container) {
point = viewPort.unzoomThisPoint(point)
point = canvas.chartSpace.viewport.unzoomThisPoint(point)
point = container.frame.unframeThisPoint(point)
return point
@@ -108,8 +108,8 @@ function getMilisecondsFromPoint (point, container, timeLineCoordinateSystem) {
function saveUserPosition (container, timeLineCoordinateSystem, position) {
if (position === undefined) {
position = {
x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x) / 2,
y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 2
x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.topLeft.x) / 2,
y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y) / 2
}
}
@@ -117,7 +117,7 @@ function saveUserPosition (container, timeLineCoordinateSystem, position) {
date: getDateFromPoint(position, container, timeLineCoordinateSystem),
rate: getRateFromPoint(position, container, timeLineCoordinateSystem),
market: DEFAULT_MARKET,
zoom: viewPort.zoomTargetLevel
zoom: canvas.chartSpace.viewport.zoomTargetLevel
}
window.localStorage.setItem('userPosition', JSON.stringify(userPosition))
@@ -150,7 +150,7 @@ function moveToUserPosition (container, timeLineCoordinateSystem, ignoreX, ignor
let userPosition = getUserPosition(timeLineCoordinateSystem)
if (considerZoom === true) {
viewPort.newZoomLevel(userPosition.zoom)
canvas.chartSpace.viewport.newZoomLevel(userPosition.zoom)
}
INITIAL_TIME_PERIOD = recalculatePeriod(userPosition.zoom)
@@ -161,7 +161,7 @@ function moveToUserPosition (container, timeLineCoordinateSystem, ignoreX, ignor
y: userPosition.rate
}
/* Put this po int in the coordinate system of the viewPort */
/* Put this po int in the coordinate system of the canvas.chartSpace.viewport */
targetPoint = timeLineCoordinateSystem.transformThisPoint(targetPoint)
targetPoint = transformThisPoint(targetPoint, container)
@@ -174,8 +174,8 @@ function moveToUserPosition (container, timeLineCoordinateSystem, ignoreX, ignor
}
} else {
centerPoint = {
x: (viewPort.visibleArea.bottomRight.x - viewPort.visibleArea.topLeft.x) / 2,
y: (viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topLeft.y) / 2
x: (canvas.chartSpace.viewport.visibleArea.bottomRight.x - canvas.chartSpace.viewport.visibleArea.topLeft.x) / 2,
y: (canvas.chartSpace.viewport.visibleArea.bottomRight.y - canvas.chartSpace.viewport.visibleArea.topLeft.y) / 2
}
}
@@ -190,7 +190,7 @@ function moveToUserPosition (container, timeLineCoordinateSystem, ignoreX, ignor
}
let targetNoZoom
targetNoZoom = viewPort.unzoomThisPoint(targetCopy)
targetNoZoom = canvas.chartSpace.viewport.unzoomThisPoint(targetCopy)
let centerCopy = {
x: centerPoint.x,
@@ -198,7 +198,7 @@ function moveToUserPosition (container, timeLineCoordinateSystem, ignoreX, ignor
}
let centerNoZoom
centerNoZoom = viewPort.unzoomThisPoint(centerCopy)
centerNoZoom = canvas.chartSpace.viewport.unzoomThisPoint(centerCopy)
displaceVector = {
x: centerNoZoom.x - targetNoZoom.x,
@@ -218,7 +218,7 @@ function moveToUserPosition (container, timeLineCoordinateSystem, ignoreX, ignor
if (ignoreX) { displaceVector.x = 0 }
if (ignoreY) { displaceVector.y = 0 }
viewPort.displace(displaceVector)
canvas.chartSpace.viewport.displace(displaceVector)
}
}