diff --git a/FloatingSpace/UiObject.js b/FloatingSpace/UiObject.js index 8f1c99445..f15923f03 100644 --- a/FloatingSpace/UiObject.js +++ b/FloatingSpace/UiObject.js @@ -1245,7 +1245,7 @@ function newUiObject() { } function drawMiddleground() { - if (thisObject.isOnFocus === false) { + if (thisObject.isOnFocus === false) { drawErrorMessage() drawWarningMessage() drawInfoMessage() @@ -1660,7 +1660,20 @@ function newUiObject() { labelPoint = { x: position.x - label.length / 2 * fontSize * FONT_ASPECT_RATIO - 10, - y: position.y + radius * 7 / 5 + fontSize * FONT_ASPECT_RATIO + 15 + 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 + } + } } browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY