Switch to 24 hs in a clever way
This commit is contained in:
1 parent
a2d49d7b0b
commit
74c9a7de3c
5 files changed
+40
-11
No files matched your search
@@ -301,9 +301,16 @@ function newPlottersManager () {
|
||||
function draw () {
|
||||
if (thisObject.connectors === undefined) { return } // We need to wait
|
||||
/* First the Product Plotters. */
|
||||
let maxElementsPlotted = 0
|
||||
for (let i = 0; i < thisObject.connectors.length; i++) {
|
||||
let connector = thisObject.connectors[thisObject.connectors.length - i - 1]
|
||||
connector.plotter.draw()
|
||||
let elementsPlotted = connector.plotter.draw()
|
||||
if (elementsPlotted !== undefined) {
|
||||
if (elementsPlotted > maxElementsPlotted) {
|
||||
maxElementsPlotted = elementsPlotted
|
||||
}
|
||||
}
|
||||
}
|
||||
return maxElementsPlotted
|
||||
}
|
||||
}
|
||||
@@ -529,9 +529,18 @@ function newTimeMachine () {
|
||||
function drawBackground () {
|
||||
drawChartsBackground()
|
||||
if (thisObject.container.frame.isInViewPort()) {
|
||||
let maxElementsPlotted = 0
|
||||
for (let i = 0; i < thisObject.timelineCharts.length; i++) {
|
||||
let timelineChart = thisObject.timelineCharts[thisObject.timelineCharts.length - i - 1]
|
||||
timelineChart.drawBackground()
|
||||
let elementsPlotted = timelineChart.drawBackground()
|
||||
if (elementsPlotted !== undefined) {
|
||||
if (elementsPlotted > maxElementsPlotted) {
|
||||
maxElementsPlotted = elementsPlotted
|
||||
}
|
||||
}
|
||||
}
|
||||
if (thisObject.timeFrameScale !== undefined) {
|
||||
thisObject.timeFrameScale.adjustTimeFrame(maxElementsPlotted)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +380,12 @@ function newTimelineChart () {
|
||||
if (thisObject.container.frame.isInViewPort()) {
|
||||
drawChartsBackground()
|
||||
if (thisObject.plotterManager !== undefined) {
|
||||
thisObject.plotterManager.draw()
|
||||
let elementsPlotted = thisObject.plotterManager.draw()
|
||||
if (thisObject.timeFrameScale !== undefined) {
|
||||
thisObject.timeFrameScale.adjustTimeFrame(elementsPlotted)
|
||||
} else {
|
||||
return elementsPlotted
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ UI_FONT = {
|
||||
|
||||
const DEBUG = {}
|
||||
const ZOOM_OUT_THRESHOLD_FOR_HIDDING_PANELS = 5 // This regulates some behavious changes that happens when the user zoom out below this level.
|
||||
const ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME = 5 // This help regulate when to change the Time Frame base on the level of zoom out.
|
||||
const ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME = 3 // This help regulate when to change the Time Frame base on the level of zoom out.
|
||||
const ZOOM_OUT_THRESHOLD_FOR_PACKING_OBJECTS_AT_THE_BOTTOM_OR_TOP_OF_VIEWPORT = 2
|
||||
const ZOOM_OUT_THRESHOLD_FOR_PLOTTING_IN_LOW_RESOLUTION = 3
|
||||
const ZOOM_OUT_THRESHOLD_FOR_DISPLAYING_TIME_MACHINES_ICONIZED = 5
|
||||
|
||||
@@ -8,6 +8,7 @@ function newTimeFrameScale () {
|
||||
payload: undefined,
|
||||
isVisible: true,
|
||||
layersOn: undefined,
|
||||
adjustTimeFrame: adjustTimeFrame,
|
||||
onMouseOverSomeTimeMachineContainer: onMouseOverSomeTimeMachineContainer,
|
||||
draw: draw,
|
||||
drawForeground: drawForeground,
|
||||
@@ -21,7 +22,7 @@ function newTimeFrameScale () {
|
||||
const TIME_PERIOD_DEFAULT_VALUE = 0
|
||||
const MIN_HEIGHT = 50
|
||||
|
||||
let previousIsVisible = true
|
||||
let displayingRealTimeFrame = true
|
||||
let greyOutCoverLayer = false
|
||||
let isMouseOver
|
||||
|
||||
@@ -119,21 +120,28 @@ function newTimeFrameScale () {
|
||||
function physics () {
|
||||
readObjectState()
|
||||
positioningPhysics()
|
||||
zoomOutPhysics()
|
||||
}
|
||||
|
||||
function zoomOutPhysics () {
|
||||
if ((thisObject.isVisible === true && previousIsVisible === false) && (canvas.chartingSpace.viewport.zoomTargetLevel >= ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME)) {
|
||||
function adjustTimeFrame (elementsPlotted) {
|
||||
const ELEMENTS_PLOTTED_THREASHOLD = 500
|
||||
if (
|
||||
canvas.chartingSpace.viewport.zoomTargetLevel >= ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME &&
|
||||
displayingRealTimeFrame === false
|
||||
) {
|
||||
let event = {}
|
||||
event.timeFrame = thisObject.timeFrame
|
||||
thisObject.container.eventHandler.raiseEvent('Time Frame Value Changed', event)
|
||||
previousIsVisible = true
|
||||
displayingRealTimeFrame = true
|
||||
}
|
||||
if ((thisObject.isVisible === false && previousIsVisible === true) || (canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME)) {
|
||||
if (
|
||||
elementsPlotted > ELEMENTS_PLOTTED_THREASHOLD &&
|
||||
canvas.chartingSpace.viewport.zoomTargetLevel < ZOOM_OUT_THRESHOLD_FOR_CHANGING_TIME_FRAME &&
|
||||
displayingRealTimeFrame === true
|
||||
) {
|
||||
let event = {}
|
||||
event.timeFrame = ONE_DAY_IN_MILISECONDS
|
||||
thisObject.container.eventHandler.raiseEvent('Time Frame Value Changed', event)
|
||||
previousIsVisible = false
|
||||
displayingRealTimeFrame = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user