Refactoring
This commit is contained in:
1 parent
e23e426b15
commit
6076c7d4b2
4 files changed
+27
-27
No files matched your search
+13
-13
@@ -6,7 +6,7 @@ function newLayersPanel () {
|
||||
layers: [],
|
||||
payload: undefined,
|
||||
isVisible: true,
|
||||
panelTabButton: undefined,
|
||||
upDownButton: undefined,
|
||||
physics: physics,
|
||||
draw: draw,
|
||||
getContainer: getContainer,
|
||||
@@ -43,8 +43,8 @@ function newLayersPanel () {
|
||||
function finalize () {
|
||||
thisObject.container.eventHandler.stopListening(onMouseWheelEventSuscriptionId)
|
||||
|
||||
thisObject.panelTabButton.finalize()
|
||||
thisObject.panelTabButton = undefined
|
||||
thisObject.upDownButton.finalize()
|
||||
thisObject.upDownButton = undefined
|
||||
layersMap = undefined
|
||||
visibleLayers = undefined
|
||||
|
||||
@@ -69,11 +69,11 @@ function newLayersPanel () {
|
||||
thisObject.container.frame.position = position
|
||||
loadFrame(thisObject.payload, thisObject.container.frame)
|
||||
|
||||
thisObject.panelTabButton = newPanelTabButton()
|
||||
thisObject.panelTabButton.parentContainer = thisObject.container
|
||||
thisObject.panelTabButton.container.frame.parentFrame = thisObject.container.frame
|
||||
thisObject.panelTabButton.fitFunction = thisObject.fitFunction
|
||||
thisObject.panelTabButton.initialize()
|
||||
thisObject.upDownButton = newUpDownButton()
|
||||
thisObject.upDownButton.parentContainer = thisObject.container
|
||||
thisObject.upDownButton.container.frame.parentFrame = thisObject.container.frame
|
||||
thisObject.upDownButton.fitFunction = thisObject.fitFunction
|
||||
thisObject.upDownButton.initialize()
|
||||
|
||||
onMouseWheelEventSuscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
|
||||
|
||||
@@ -87,7 +87,7 @@ function newLayersPanel () {
|
||||
}
|
||||
|
||||
function saveObjectStatePanelLocation () {
|
||||
savePropertyAtNodeConfig(thisObject.payload, 'panelLocation', thisObject.panelTabButton.status)
|
||||
savePropertyAtNodeConfig(thisObject.payload, 'panelLocation', thisObject.upDownButton.status)
|
||||
}
|
||||
|
||||
function readObjectState () {
|
||||
@@ -123,7 +123,7 @@ function newLayersPanel () {
|
||||
saveObjectStatePanelLocation() // this overrides any invalid value at the config.
|
||||
return
|
||||
}
|
||||
thisObject.panelTabButton.setStatus(storedValue)
|
||||
thisObject.upDownButton.setStatus(storedValue)
|
||||
saveObjectStatePanelLocation()
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ function newLayersPanel () {
|
||||
if (isInitialized === false || thisObject.visible === false || thisObject.isHidden === true) { return }
|
||||
let container
|
||||
|
||||
container = thisObject.panelTabButton.getContainer(point)
|
||||
container = thisObject.upDownButton.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
/* First we check if thisObject point is inside thisObject space. */
|
||||
@@ -301,7 +301,7 @@ function newLayersPanel () {
|
||||
if (isInitialized === false) { return }
|
||||
if (thisObject.payload.node === undefined) { return }
|
||||
|
||||
thisObject.panelTabButton.physics()
|
||||
thisObject.upDownButton.physics()
|
||||
saveFrame(thisObject.payload, thisObject.container.frame)
|
||||
syncWithConfigPhysics()
|
||||
|
||||
@@ -387,7 +387,7 @@ function newLayersPanel () {
|
||||
visibleLayers[i].draw()
|
||||
}
|
||||
drawScrollBar()
|
||||
thisObject.panelTabButton.draw()
|
||||
thisObject.upDownButton.draw()
|
||||
}
|
||||
|
||||
function drawHeader () {
|
||||
|
||||
+10
-10
@@ -22,7 +22,7 @@ function newPlotterPanel () {
|
||||
|
||||
let heightFactor = 1
|
||||
let currentRecord
|
||||
let panelTabButton
|
||||
let upDownButton
|
||||
let panelNode
|
||||
|
||||
return thisObject
|
||||
@@ -35,8 +35,8 @@ function newPlotterPanel () {
|
||||
|
||||
heightFactor = undefined
|
||||
currentRecord = undefined
|
||||
panelTabButton.finalize()
|
||||
panelTabButton = undefined
|
||||
upDownButton.finalize()
|
||||
upDownButton = undefined
|
||||
panelNode = undefined
|
||||
}
|
||||
|
||||
@@ -50,18 +50,18 @@ function newPlotterPanel () {
|
||||
thisObject.container.frame.position.x = canvas.chartingSpace.viewport.visibleArea.topRight.x - thisObject.container.frame.width - thisObject.container.frame.width * Math.random() * 8
|
||||
thisObject.container.frame.position.y = canvas.chartingSpace.viewport.visibleArea.bottomLeft.y - thisObject.container.frame.height - thisObject.container.frame.height * Math.random() * 1.5
|
||||
|
||||
panelTabButton = newPanelTabButton()
|
||||
panelTabButton.parentContainer = thisObject.container
|
||||
panelTabButton.container.frame.parentFrame = thisObject.container.frame
|
||||
panelTabButton.fitFunction = thisObject.fitFunction
|
||||
panelTabButton.initialize()
|
||||
upDownButton = newUpDownButton()
|
||||
upDownButton.parentContainer = thisObject.container
|
||||
upDownButton.container.frame.parentFrame = thisObject.container.frame
|
||||
upDownButton.fitFunction = thisObject.fitFunction
|
||||
upDownButton.initialize()
|
||||
}
|
||||
|
||||
function getContainer (point) {
|
||||
if (thisObject.isVisible !== true) { return }
|
||||
let container
|
||||
|
||||
container = panelTabButton.getContainer(point)
|
||||
container = upDownButton.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
@@ -87,7 +87,7 @@ function newPlotterPanel () {
|
||||
|
||||
thisObject.container.frame.draw(false, false, true, thisObject.fitFunction)
|
||||
plotCurrentRecordData()
|
||||
panelTabButton.draw()
|
||||
upDownButton.draw()
|
||||
}
|
||||
|
||||
function plotCurrentRecordData () {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
function newPanelTabButton () {
|
||||
function newUpDownButton () {
|
||||
let thisObject = {
|
||||
container: undefined,
|
||||
fitFunction: undefined,
|
||||
@@ -48,7 +48,7 @@ function newPanelTabButton () {
|
||||
thisObject.container.frame.width = 10
|
||||
thisObject.container.frame.height = 10
|
||||
|
||||
var position = {
|
||||
let position = {
|
||||
x: thisObject.parentContainer.frame.width - 14,
|
||||
y: 1
|
||||
}
|
||||
@@ -165,8 +165,8 @@ function newPanelsSpace () {
|
||||
let verticalLine = (canvas.chartingSpace.viewport.visibleArea.topRight.x - canvas.chartingSpace.viewport.visibleArea.topLeft.x) / 2 + canvas.chartingSpace.viewport.visibleArea.topLeft.x
|
||||
let horizontalLine = (canvas.chartingSpace.viewport.visibleArea.bottomRight.y - canvas.chartingSpace.viewport.visibleArea.topRight.y) / 2 + canvas.chartingSpace.viewport.visibleArea.topRight.y
|
||||
|
||||
if (panel.panelTabButton !== undefined) {
|
||||
if (panel.panelTabButton.status === 'up') {
|
||||
if (panel.upDownButton !== undefined) {
|
||||
if (panel.upDownButton.status === 'up') {
|
||||
if (centerPoint.x < verticalLine) {
|
||||
panel.gravitatesTowards = 'topLeft'
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user