From a72115b1d46ce122ea735ba8eff514cdd9af59c1 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Sat, 4 May 2019 23:39:09 +0200 Subject: [PATCH] Cleaning non used code --- Canvas.js | 18 ++++++++-------- FloatingSpace/FloatingLayer.js | 39 ---------------------------------- 2 files changed, 9 insertions(+), 48 deletions(-) diff --git a/Canvas.js b/Canvas.js index 1d73c1032..d74f04d2d 100644 --- a/Canvas.js +++ b/Canvas.js @@ -637,10 +637,10 @@ function newCanvas () { event.mousePosition = point let container - let panelContainer = canvas.panelsSpace.getContainer({ x: point.x, y: point.y }) + container = canvas.panelsSpace.getContainer({ x: point.x, y: point.y }) - if (panelContainer !== undefined && panelContainer.isWheelable === true) { - panelContainer.eventHandler.raiseEvent('Mouse Wheel', event) + if (container !== undefined && container.isWheelable === true) { + container.eventHandler.raiseEvent('Mouse Wheel', event) return false // This instructs the browser not to take the event and scroll the page. } @@ -655,19 +655,19 @@ function newCanvas () { /* We try the Bottom Space. */ - let bottomContainer = canvas.bottomSpace.getContainer({ x: point.x, y: point.y }) + container = canvas.bottomSpace.getContainer({ x: point.x, y: point.y }) - if (bottomContainer !== undefined && bottomContainer.isWheelable === true) { - bottomContainer.eventHandler.raiseEvent('Mouse Wheel', event) + if (container !== undefined && container.isWheelable === true) { + container.eventHandler.raiseEvent('Mouse Wheel', event) return false // This instructs the browser not to take the event and scroll the page. } /* Finally we try the Chart Space. */ - let chartContainer = canvas.chartSpace.getContainer({ x: point.x, y: point.y }, GET_CONTAINER_PURPOSE.MOUSE_WHEEL) + container = canvas.chartSpace.getContainer({ x: point.x, y: point.y }, GET_CONTAINER_PURPOSE.MOUSE_WHEEL) - if (chartContainer !== undefined && chartContainer.isWheelable === true) { - chartContainer.eventHandler.raiseEvent('Mouse Wheel', event) + if (container !== undefined && container.isWheelable === true) { + container.eventHandler.raiseEvent('Mouse Wheel', event) return false // This instructs the browser not to take the event and scroll the page. } else { /* If all the above fails, we fallback into applying zoom to the viewPort */ diff --git a/FloatingSpace/FloatingLayer.js b/FloatingSpace/FloatingLayer.js index 8c344a70a..dd3188f99 100644 --- a/FloatingSpace/FloatingLayer.js +++ b/FloatingSpace/FloatingLayer.js @@ -26,8 +26,6 @@ function newFloatingLayer () { killFloatingObject: killFloatingObject, getFloatingObject: getFloatingObject, physics: physics, - isInside: isInside, - isInsideFloatingObject: isInsideFloatingObject, changeTargetRepulsion: changeTargetRepulsion, draw: draw, getContainer: getContainer, @@ -913,43 +911,6 @@ function newFloatingLayer () { } } - function isInside (x, y) { - try { - /* This function detects weather the point x,y is inside any of the floatingObjects. */ - - for (var i = 0; i < visibleFloatingObjects.length; i++) { - var floatingObject = visibleFloatingObjects[i] - var distance = Math.sqrt(Math.pow(floatingObject.container.frame.position.x - x, 2) + Math.pow(floatingObject.container.frame.position.y - y, 2)) - - if (distance < floatingObject.container.frame.radius) { - return i - } - } - return -1 - } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] isInside -> err.message = ' + err.message) } - } - } - - function isInsideFloatingObject (floatingObjectIndex, x, y) { - try { - if (INTENSIVE_LOG === true) { logger.write('[INFO] isInsideFloatingObject -> Entering function.') } - - /* This function detects weather the point x,y is inside one particular floatingObjects. */ - - var floatingObject = visibleFloatingObjects[floatingObjectIndex] - var distance = Math.sqrt(Math.pow(floatingObject.container.frame.position.x - x, 2) + Math.pow(floatingObject.container.frame.position.y - y, 2)) - - if (distance < floatingObject.container.frame.radius) { - return true - } - - return false - } catch (err) { - if (ERROR_LOG === true) { logger.write('[ERROR] isInsideFloatingObject -> err.message = ' + err.message) } - } - } - function distance (x1, y1, x2, y2) { try { if (INTENSIVE_LOG === true) { logger.write('[INFO] distance -> Entering function.') }