timeLineCoordinateSystem moved the time machine
This commit is contained in:
1 parent
6f51a6dab1
commit
5bf999829f
2 files changed
+39
-36
No files matched your search
+32
-2
@@ -43,6 +43,8 @@ function newTimeMachine () {
|
||||
let timeScale
|
||||
let rigthScale
|
||||
|
||||
let timeLineCoordinateSystem = newTimeLineCoordinateSystem()
|
||||
|
||||
return thisObject
|
||||
|
||||
function finalize () {
|
||||
@@ -67,6 +69,13 @@ function newTimeMachine () {
|
||||
controlPanelHandle = canvas.panelsSpace.createNewPanel('Time Control Panel', undefined, panelOwner)
|
||||
let controlPanel = canvas.panelsSpace.getPanel(controlPanelHandle, panelOwner)
|
||||
|
||||
recalculateScale()
|
||||
|
||||
thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function (event) {
|
||||
recalculateScale()
|
||||
moveToUserPosition(thisObject.container, timeLineCoordinateSystem, false, false, event.mousePosition)
|
||||
})
|
||||
|
||||
/* First, we initialize the market that we are going to show first on screen. Later all the other markets will be initialized on the background. */
|
||||
|
||||
let position = 0 // This defines the position of each chart respect to each other.
|
||||
@@ -82,7 +91,7 @@ function newTimeMachine () {
|
||||
|
||||
position++
|
||||
|
||||
timelineChart.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, onDefaultInitialized)
|
||||
timelineChart.initialize(DEFAULT_EXCHANGE, DEFAULT_MARKET, timeLineCoordinateSystem, onDefaultInitialized)
|
||||
|
||||
function onDefaultInitialized (err) {
|
||||
if (err.result !== GLOBAL.DEFAULT_OK_RESPONSE.result) {
|
||||
@@ -158,7 +167,7 @@ function newTimeMachine () {
|
||||
|
||||
position++
|
||||
|
||||
timelineChart.initialize(exchange, market, finalSteps)
|
||||
timelineChart.initialize(exchange, market, timeLineCoordinateSystem, finalSteps)
|
||||
|
||||
function finalSteps () {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] initialize -> initializeTheRest -> initializeTimelineChart -> finalSteps -> Entering function.') }
|
||||
@@ -228,4 +237,25 @@ function newTimeMachine () {
|
||||
}
|
||||
return this.container
|
||||
}
|
||||
|
||||
function recalculateScale () {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] recalculateScale -> Entering function.') }
|
||||
|
||||
let minValue = {
|
||||
x: EARLIEST_DATE.valueOf(),
|
||||
y: 0
|
||||
}
|
||||
|
||||
let maxValue = {
|
||||
x: MAX_PLOTABLE_DATE.valueOf(),
|
||||
y: nextPorwerOf10(USDT_BTC_HTH) / 4
|
||||
}
|
||||
|
||||
timeLineCoordinateSystem.initialize(
|
||||
minValue,
|
||||
maxValue,
|
||||
thisObject.container.frame.width,
|
||||
thisObject.container.frame.height
|
||||
)
|
||||
}
|
||||
}
|
||||
+7
-34
@@ -6,7 +6,7 @@
|
||||
const logger = newWebDebugLog()
|
||||
logger.fileName = MODULE_NAME
|
||||
|
||||
let timeLineCoordinateSystem = newTimeLineCoordinateSystem()
|
||||
let timeLineCoordinateSystem
|
||||
|
||||
let timePeriod = INITIAL_TIME_PERIOD
|
||||
let datetime = INITIAL_DATE
|
||||
@@ -60,22 +60,18 @@
|
||||
}
|
||||
}
|
||||
|
||||
function initialize (pExchange, pMarket, callBackFunction) {
|
||||
function initialize (pExchange, pMarket, pTimeLineCoordinateSystem, callBackFunction) {
|
||||
try {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
|
||||
|
||||
thisObject.container.eventHandler.listenToEvent('Dimmensions Changed', function (event) {
|
||||
recalculateScale()
|
||||
moveToUserPosition(thisObject.container, timeLineCoordinateSystem, false, false, event.mousePosition)
|
||||
})
|
||||
|
||||
thisObject.container.eventHandler.listenToEvent('onMouseOver', function (event) {
|
||||
saveUserPosition(thisObject.container, timeLineCoordinateSystem, event)
|
||||
})
|
||||
|
||||
/* We load the logow we will need for the background. */
|
||||
exchange = pExchange
|
||||
market = pMarket
|
||||
timeLineCoordinateSystem = pTimeLineCoordinateSystem
|
||||
|
||||
thisObject.container.eventHandler.listenToEvent('onMouseOver', function (event) {
|
||||
saveUserPosition(thisObject.container, timeLineCoordinateSystem, event)
|
||||
})
|
||||
|
||||
let panelOwner = exchange + ' ' + market.assetB + '/' + market.assetA
|
||||
productsPanelHandle = canvas.panelsSpace.createNewPanel('Products Panel', undefined, panelOwner)
|
||||
@@ -122,8 +118,6 @@
|
||||
breakpointsBar = newBreakpointsBar()
|
||||
breakpointsBar.initialize(thisObject.container, timeLineCoordinateSystem)
|
||||
|
||||
recalculateScale()
|
||||
|
||||
moveToUserPosition(thisObject.container, timeLineCoordinateSystem)
|
||||
timePeriod = INITIAL_TIME_PERIOD
|
||||
datetime = INITIAL_DATE
|
||||
@@ -253,27 +247,6 @@
|
||||
return container
|
||||
}
|
||||
|
||||
function recalculateScale () {
|
||||
if (INFO_LOG === true) { logger.write('[INFO] recalculateScale -> Entering function.') }
|
||||
|
||||
let minValue = {
|
||||
x: EARLIEST_DATE.valueOf(),
|
||||
y: 0
|
||||
}
|
||||
|
||||
let maxValue = {
|
||||
x: MAX_PLOTABLE_DATE.valueOf(),
|
||||
y: nextPorwerOf10(USDT_BTC_HTH) / 4
|
||||
}
|
||||
|
||||
timeLineCoordinateSystem.initialize(
|
||||
minValue,
|
||||
maxValue,
|
||||
thisObject.container.frame.width,
|
||||
thisObject.container.frame.height
|
||||
)
|
||||
}
|
||||
|
||||
function tooTiny () {
|
||||
if (INTENSIVE_LOG === true) { logger.write('[INFO] tooTiny -> Entering function.') }
|
||||
|
||||
|
||||
Reference in new issue
Block a user