From 5fc32f9afde42bcb9a74c6c785cd9d6816309dfa Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Wed, 2 Sep 2020 18:47:38 +0200 Subject: [PATCH] Values --- FloatingSpace/CircularProgressBar.js | 1 + FloatingSpace/UiObject.js | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/FloatingSpace/CircularProgressBar.js b/FloatingSpace/CircularProgressBar.js index 348411ea0..4b3d26888 100644 --- a/FloatingSpace/CircularProgressBar.js +++ b/FloatingSpace/CircularProgressBar.js @@ -68,6 +68,7 @@ function newCircularProgressBar() { if (thisObject.payload.uiObject === undefined) { return } opacityCounters[message.event.seconds] = 2000 if (message.event.processingDate !== undefined) { + thisObject.payload.uiObject.valueAtAngle = false thisObject.payload.uiObject.setValue(message.event.processingDate, 2000) } if (message.event.percentage !== undefined) { diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index f15923f03..fd3cf1fa0 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -26,6 +26,7 @@ function newUiObject() { hasError: undefined, hasWarning: undefined, hasInfo: undefined, + valueAtAngle: true, run: run, stop: stop, heartBeat: heartBeat, @@ -1658,21 +1659,17 @@ function newUiObject() { fontSize = fontSize * 2 / 3 } - labelPoint = { - x: position.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 10, - y: position.y - } - - /* We will try to put this value according to the angle to the parent node*/ - if (thisObject.payload !== undefined) { - if (thisObject.payload.angle !== undefined) { - labelPoint.x = labelPoint.x + radius * 7 / 3 * Math.cos(toRadians(thisObject.payload.angle)) - labelPoint.y = labelPoint.y + radius * 7 / 3 * Math.sin(toRadians(thisObject.payload.angle)) - } else { - labelPoint = { - x: position.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 10, - y: position.y + radius * 7 / 5 + fontSize * FONT_ASPECT_RATIO + 15 - } + if (thisObject.valueAtAngle === true && thisObject.payload.angle !== undefined) { + labelPoint = { + x: position.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 10, + y: position.y + } + labelPoint.x = labelPoint.x + radius * 7 / 3 * Math.cos(toRadians(thisObject.payload.angle)) + labelPoint.y = labelPoint.y + radius * 7 / 3 * Math.sin(toRadians(thisObject.payload.angle)) + } else { + labelPoint = { + x: position.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 10, + y: position.y + radius * 7 / 5 + fontSize * FONT_ASPECT_RATIO + 15 } }