stadarizing refactoring
This commit is contained in:
1 parent
44d0944a56
commit
b5dd022c0f
4 files changed
+29
-29
No files matched your search
@@ -178,7 +178,7 @@ function newTimeMachine () {
|
||||
thisObject.timeScale.payload = thisObject.payload.node.timeScale.payload
|
||||
|
||||
timeScaleEventSuscriptionId = thisObject.timeScale.container.eventHandler.listenToEvent('Lenght Percentage Changed', function (event) {
|
||||
thisObject.container.frame.width = TIME_MACHINE_WIDTH * event.lenghtPercentage / 100
|
||||
thisObject.container.frame.width = TIME_MACHINE_WIDTH * event.value / 100
|
||||
recalculateCoordinateSystem()
|
||||
moveToUserPosition(thisObject.container, timeMachineCoordinateSystem, false, true, event.mousePosition, false, true)
|
||||
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
|
||||
@@ -199,7 +199,7 @@ function newTimeMachine () {
|
||||
thisObject.rateScale.payload = thisObject.payload.node.rateScale.payload
|
||||
|
||||
rateScaleEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('Height Percentage Changed', function (event) {
|
||||
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.heightPercentage / 100
|
||||
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.value / 100
|
||||
recalculateCoordinateSystem()
|
||||
moveToUserPosition(thisObject.container, timeMachineCoordinateSystem, true, false, event.mousePosition, false, true)
|
||||
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
|
||||
|
||||
@@ -166,7 +166,7 @@ function newTimelineChart () {
|
||||
thisObject.rateScale.payload = thisObject.payload.node.rateScale.payload
|
||||
|
||||
rateScaleEventSuscriptionId = thisObject.rateScale.container.eventHandler.listenToEvent('Height Percentage Changed', function (event) {
|
||||
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.heightPercentage / 100
|
||||
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.value / 100
|
||||
recalculateCoordinateSystem()
|
||||
moveToUserPosition(thisObject.container, timelineChartCoordinateSystem, true, false, event.mousePosition, false, true)
|
||||
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
|
||||
|
||||
+13
-13
@@ -6,7 +6,7 @@ function newRateScale () {
|
||||
rate: undefined,
|
||||
fitFunction: undefined,
|
||||
payload: undefined,
|
||||
heightPercentage: undefined,
|
||||
value: undefined,
|
||||
onMouseOverSomeTimeMachineContainer: onMouseOverSomeTimeMachineContainer,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
@@ -73,11 +73,11 @@ function newRateScale () {
|
||||
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
|
||||
|
||||
thisObject.heightPercentage = DEFAULT_VALUE
|
||||
thisObject.value = DEFAULT_VALUE
|
||||
readObjectState()
|
||||
|
||||
let event = {}
|
||||
event.heightPercentage = thisObject.heightPercentage
|
||||
event.value = thisObject.value
|
||||
thisObject.container.eventHandler.raiseEvent('Height Percentage Changed', event)
|
||||
}
|
||||
|
||||
@@ -117,13 +117,13 @@ function newRateScale () {
|
||||
|
||||
delta = event.wheelDelta
|
||||
if (delta < 0) {
|
||||
thisObject.heightPercentage = thisObject.heightPercentage - STEP_SIZE * morePower
|
||||
if (thisObject.heightPercentage < STEP_SIZE * 3) { thisObject.heightPercentage = STEP_SIZE }
|
||||
thisObject.value = thisObject.value - STEP_SIZE * morePower
|
||||
if (thisObject.value < STEP_SIZE * 3) { thisObject.value = STEP_SIZE }
|
||||
} else {
|
||||
thisObject.heightPercentage = thisObject.heightPercentage + STEP_SIZE * morePower
|
||||
if (thisObject.heightPercentage > MAX_VALUE) { thisObject.heightPercentage = MAX_VALUE }
|
||||
thisObject.value = thisObject.value + STEP_SIZE * morePower
|
||||
if (thisObject.value > MAX_VALUE) { thisObject.value = MAX_VALUE }
|
||||
}
|
||||
event.heightPercentage = thisObject.heightPercentage
|
||||
event.value = thisObject.value
|
||||
thisObject.container.eventHandler.raiseEvent('Height Percentage Changed', event)
|
||||
|
||||
saveObjectState()
|
||||
@@ -138,7 +138,7 @@ function newRateScale () {
|
||||
function saveObjectState () {
|
||||
try {
|
||||
let code = JSON.parse(thisObject.payload.node.code)
|
||||
code.value = thisObject.heightPercentage / MAX_VALUE * 100
|
||||
code.value = thisObject.value / MAX_VALUE * 100
|
||||
code.value = code.value.toFixed(2)
|
||||
thisObject.payload.node.code = JSON.stringify(code)
|
||||
} catch (err) {
|
||||
@@ -158,10 +158,10 @@ function newRateScale () {
|
||||
if (code.value < STEP_SIZE) { code.value = STEP_SIZE }
|
||||
if (code.value > MAX_VALUE) { code.value = MAX_VALUE }
|
||||
|
||||
if (code.value !== thisObject.heightPercentage) {
|
||||
thisObject.heightPercentage = code.value
|
||||
if (code.value !== thisObject.value) {
|
||||
thisObject.value = code.value
|
||||
let event = {}
|
||||
event.heightPercentage = thisObject.heightPercentage
|
||||
event.value = thisObject.value
|
||||
thisObject.container.eventHandler.raiseEvent('Height Percentage Changed', event)
|
||||
} else {
|
||||
saveObjectState()
|
||||
@@ -288,7 +288,7 @@ function newRateScale () {
|
||||
const OPACITY = 0.2
|
||||
const DISTANCE_BETWEEN_ARROWS = 10
|
||||
const MIN_DISTANCE_FROM_CENTER = 30
|
||||
const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.heightPercentage
|
||||
const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.value
|
||||
const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 215 + DISTANCE_BETWEEN_ARROWS
|
||||
|
||||
let ARROW_DIRECTION = 0
|
||||
|
||||
+13
-13
@@ -2,7 +2,7 @@ function newTimeScale () {
|
||||
const MODULE_NAME = 'Time Scale'
|
||||
|
||||
let thisObject = {
|
||||
lenghtPercentage: undefined,
|
||||
value: undefined,
|
||||
container: undefined,
|
||||
date: undefined,
|
||||
fitFunction: undefined,
|
||||
@@ -72,11 +72,11 @@ function newTimeScale () {
|
||||
onMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
onMouseNotOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
|
||||
|
||||
thisObject.lenghtPercentage = DEFAULT_VALUE
|
||||
thisObject.value = DEFAULT_VALUE
|
||||
readObjectState()
|
||||
|
||||
let event = {}
|
||||
event.lenghtPercentage = thisObject.lenghtPercentage
|
||||
event.value = thisObject.value
|
||||
thisObject.container.eventHandler.raiseEvent('Lenght Percentage Changed', event)
|
||||
}
|
||||
|
||||
@@ -116,14 +116,14 @@ function newTimeScale () {
|
||||
|
||||
delta = event.wheelDelta
|
||||
if (delta < 0) {
|
||||
thisObject.lenghtPercentage = thisObject.lenghtPercentage - STEP_SIZE * morePower
|
||||
if (thisObject.lenghtPercentage < STEP_SIZE) { thisObject.lenghtPercentage = STEP_SIZE }
|
||||
thisObject.value = thisObject.value - STEP_SIZE * morePower
|
||||
if (thisObject.value < STEP_SIZE) { thisObject.value = STEP_SIZE }
|
||||
} else {
|
||||
thisObject.lenghtPercentage = thisObject.lenghtPercentage + STEP_SIZE * morePower
|
||||
if (thisObject.lenghtPercentage > MAX_VALUE) { thisObject.lenghtPercentage = MAX_VALUE }
|
||||
thisObject.value = thisObject.value + STEP_SIZE * morePower
|
||||
if (thisObject.value > MAX_VALUE) { thisObject.value = MAX_VALUE }
|
||||
}
|
||||
|
||||
event.lenghtPercentage = thisObject.lenghtPercentage
|
||||
event.value = thisObject.value
|
||||
thisObject.container.eventHandler.raiseEvent('Lenght Percentage Changed', event)
|
||||
|
||||
saveObjectState()
|
||||
@@ -138,7 +138,7 @@ function newTimeScale () {
|
||||
function saveObjectState () {
|
||||
try {
|
||||
let code = JSON.parse(thisObject.payload.node.code)
|
||||
code.value = thisObject.lenghtPercentage / MAX_VALUE * 100
|
||||
code.value = thisObject.value / MAX_VALUE * 100
|
||||
code.value = code.value.toFixed(2)
|
||||
thisObject.payload.node.code = JSON.stringify(code)
|
||||
} catch (err) {
|
||||
@@ -158,10 +158,10 @@ function newTimeScale () {
|
||||
if (code.value < STEP_SIZE) { code.value = STEP_SIZE }
|
||||
if (code.value > MAX_VALUE) { code.value = MAX_VALUE }
|
||||
|
||||
if (code.value !== thisObject.lenghtPercentage) {
|
||||
thisObject.lenghtPercentage = code.value
|
||||
if (code.value !== thisObject.value) {
|
||||
thisObject.value = code.value
|
||||
let event = {}
|
||||
event.lenghtPercentage = thisObject.lenghtPercentage
|
||||
event.value = thisObject.value
|
||||
thisObject.container.eventHandler.raiseEvent('Lenght Percentage Changed', event)
|
||||
} else {
|
||||
saveObjectState()
|
||||
@@ -266,7 +266,7 @@ function newTimeScale () {
|
||||
const OPACITY = 0.2
|
||||
const DISTANCE_BETWEEN_ARROWS = 10
|
||||
const MIN_DISTANCE_FROM_CENTER = 110
|
||||
const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.lenghtPercentage
|
||||
const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.value
|
||||
const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + MAX_VALUE + DISTANCE_BETWEEN_ARROWS
|
||||
|
||||
let ARROW_DIRECTION = 0
|
||||
|
||||
Reference in new issue
Block a user