From 8b878bbb7458e32a0a9f84088e4e6ceb66504819 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Mon, 1 Apr 2019 08:27:35 +0200 Subject: [PATCH] First steps towards improving scales --- Scales/topScale.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 Scales/topScale.js diff --git a/Scales/topScale.js b/Scales/topScale.js new file mode 100644 index 000000000..bfe552c39 --- /dev/null +++ b/Scales/topScale.js @@ -0,0 +1,56 @@ +function newRigthScale () { + let thisObject = { + container: undefined, + draw: draw, + getContainer: getContainer, + initialize: initialize + } + + const RIGHT_MARGIN = 50 + + let container = newContainer() + container.initialize() + thisObject.container = container + + thisObject.container.frame.width = RIGHT_MARGIN + thisObject.container.frame.height = viewPort.visibleArea.bottomRight.y - viewPort.visibleArea.topRight.y + + container.frame.position.x = viewPort.visibleArea.bottomRight.x + container.frame.position.y = TOP_SPACE_HEIGHT + + container.isDraggeable = false + container.isClickeable = false + container.isWheeleable = true + + return thisObject + + function initialize () { + thisObject.container.eventHandler.listenToEvent('Mouse Wheel', onMouseWheel) + } + + function onMouseWheel (pDelta) { + if (pDelta < 0) { + pDelta = -0.1 + } else { + pDelta = 0.1 + } + } + + function getContainer (point) { + let container + + /* First we check if this point is inside this object UI. */ + + if (thisObject.container.frame.isThisPointHere(point, true) === true) { + return this.container + } else { + /* This point does not belong to this space. */ + + return undefined + } + } + + function draw () { + + } +}