zoom, kind of tunned

This commit is contained in:
Luis Fernando Molina committed 2020-01-19 00:05:15 +01:00
1 parent 60e78f7b63
commit b570f87e0d
4 files changed
+30 -53

No files matched your search

+18 -18
View File
@@ -64,75 +64,75 @@ function getTransparenceFactor (timeFrame) {
function recalculatePeriod (zoomLevel) {
// console.log(" recalculatePeriod > " + zoomLevel);
if (zoomLevel > 90) {
if (zoomLevel > 400) {
return _1_MINUTE_IN_MILISECONDS
}
if (zoomLevel > 85) {
if (zoomLevel > 360) {
return _2_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 80) {
if (zoomLevel > 330) {
return _3_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 75) {
if (zoomLevel > 300) {
return _4_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 70) {
if (zoomLevel > 270) {
return _5_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 65) {
if (zoomLevel > 250) {
return _10_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 60) {
if (zoomLevel > 230) {
return _15_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 55) {
if (zoomLevel > 210) {
return _20_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 50) {
if (zoomLevel > 190) {
return _30_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 45) {
if (zoomLevel > 170) {
return _40_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 50) {
if (zoomLevel > 150) {
return _45_MINUTES_IN_MILISECONDS
}
if (zoomLevel > 35) {
if (zoomLevel > 130) {
return _1_HOUR_IN_MILISECONDS
}
if (zoomLevel > 30) {
if (zoomLevel > 110) {
return _2_HOURS_IN_MILISECONDS
}
if (zoomLevel > 25) {
if (zoomLevel > 90) {
return _3_HOURS_IN_MILISECONDS
}
if (zoomLevel > 20) {
if (zoomLevel > 70) {
return _4_HOURS_IN_MILISECONDS
}
if (zoomLevel > 15) {
if (zoomLevel > 50) {
return _6_HOURS_IN_MILISECONDS
}
if (zoomLevel > 10) {
if (zoomLevel > 30) {
return _8_HOURS_IN_MILISECONDS
}
if (zoomLevel > 5) {
if (zoomLevel > 15) {
return _12_HOURS_IN_MILISECONDS
}
+10 -33
View File
@@ -3,7 +3,7 @@ function newViewport () {
const MODULE_NAME = 'Viewport'
const MIN_ZOOM_LEVEL = 0
const MAX_ZOOM_LEVEL = 100
const MAX_ZOOM_LEVEL = 500
let ANIMATION_INCREMENT = 0.25
let ANIMATION_STEPS = 5
@@ -134,7 +134,6 @@ function newViewport () {
}
function physics () {
console.log(position, thisObject.zoomLevel)
animationPhysics()
positioningphysics()
// readObjectState()
@@ -181,39 +180,17 @@ function newViewport () {
let isMac = navigator.platform.toUpperCase().indexOf('MAC') >= 0
if (isMac) { amount = amount / 5 }
/*
if (amount > 0) {
if (thisObject.zoomTargetLevel > -5) {
amount = amount * 2
}
if (thisObject.zoomTargetLevel > 10) {
amount = amount * 3
}
if (thisObject.zoomTargetLevel > 15) {
amount = amount * 4
}
if (thisObject.zoomTargetLevel > 10) {
amount = amount * 2
}
if (thisObject.zoomTargetLevel > 25) {
amount = amount * 3
}
if (thisObject.zoomTargetLevel > 50) {
amount = amount * 3.5
}
if (amount < 0) {
if (thisObject.zoomTargetLevel > -4) {
amount = amount * 2
}
if (thisObject.zoomTargetLevel > 13) {
amount = amount * 3
}
if (thisObject.zoomTargetLevel > 19) {
amount = amount * 4
}
}
if (thisObject.zoomTargetLevel <= -27 && amount < 0) {
amount = amount / 4
}
if (thisObject.zoomTargetLevel < -27 && amount > 0) {
amount = amount / 4
}
*/
console.log(thisObject.zoomLevel, amount)
if (thisObject.zoomTargetLevel + amount > MAX_ZOOM_LEVEL) {
return false
}
+1 -1
View File
@@ -189,7 +189,7 @@ We define here the size of the chartSpace. It has to bee enough big in order to
*/
const TIME_MACHINE_WIDTH = 1000;
const TIME_MACHINE_HEIGHT = 200;
const TIME_MACHINE_HEIGHT = 50;
function toRadians(angle) {
return angle * (Math.PI / 180);
+1 -1
View File
@@ -180,7 +180,7 @@ function newTimeFrameScale () {
function onViewportZoomChanged (event) {
if (event !== undefined) { // it is undefined when the level is just being animated.
let currentTimeFrame = thisObject.timeFrame
let timeFrame = currentTimeFrame // recalculatePeriod(event.newLevel)
let timeFrame = recalculatePeriod(event.newLevel)
if (timeFrame !== currentTimeFrame) {
for (let i = 0; i < timeFramesMasterArray.length; i++) {
let timeFrameArray = timeFramesMasterArray[i]