container connect to events implemented

This commit is contained in:
Luis Fernando Molina committed 2019-05-05 16:06:50 +02:00
1 parent 9b295b8aad
commit 94f80bc686
8 files changed
+21 -17

No files matched your search

+10 -4
View File
@@ -20,6 +20,8 @@ function newContainer () {
let connectedToParentWidth = false
let connectedToParentHeight = false
let connectedToParentRadius = false
let connectedToParentEvents = false
let isConnectedToParent = false
let dimensionsChangedEventSubscriptionId
@@ -53,19 +55,23 @@ function newContainer () {
thisObject.displacement.containerName = pName
}
function connectToParent (parentContainer, onWidth, onHeight, onRadius) {
function connectToParent (parentContainer, onWidth, onHeight, onRadius, onEvents) {
connectedToParentWidth = onWidth
connectedToParentHeight = onHeight
connectedToParentRadius = onRadius
connectedToParentEvents = onEvents
isConnectedToParent = true
thisObject.displacement.parentDisplacement = parentContainer.displacement
thisObject.frame.parentFrame = parentContainer.frame
thisObject.parentContainer = parentContainer
dimensionsChangedEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('Dimmensions Changed', onParentDimmensionsChanged)
onMouseOverEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('onMouseOver', onMouseOver)
onMouseNotOverEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
if (connectedToParentEvents === true) {
dimensionsChangedEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('Dimmensions Changed', onParentDimmensionsChanged)
onMouseOverEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('onMouseOver', onMouseOver)
onMouseNotOverEventSubscriptionId = thisObject.parentContainer.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
}
if (connectedToParentWidth) {
thisObject.frame.width = thisObject.parentContainer.frame.width
+1 -1
View File
@@ -43,7 +43,7 @@ function newCircularMenu () {
menuItem.angle = menuItemInitialValue.angle
menuItem.initialize()
menuItem.container.connectToParent(thisObject.container, false, false, true)
menuItem.container.connectToParent(thisObject.container, false, false, true, true)
menuItems.push(menuItem)
}
+1 -1
View File
@@ -88,7 +88,7 @@ function newFloatingObject () {
case 'Strategy Part': {
thisObject.underlayingObject = newStrategyPart()
thisObject.underlayingObject.initialize(floatingLayer, pSubType)
thisObject.underlayingObject.container.connectToParent(thisObject.container, false, false, true)
thisObject.underlayingObject.container.connectToParent(thisObject.container, false, false, true, true)
break
}
default: {
+1 -1
View File
@@ -240,7 +240,7 @@ function newStrategyPart () {
thisObject.menu = newCircularMenu()
thisObject.menu.initialize(menuItemsInitialValues)
thisObject.menu.container.connectToParent(thisObject.container, false, false, true)
thisObject.menu.container.connectToParent(thisObject.container, false, false, true, true)
/* Load Part Image */
+2 -2
View File
@@ -221,7 +221,7 @@ function newPlottersManager () {
let plotter = getNewPlotter(competition.plotter.host, competition.plotter.codeName, competition.plotter.moduleName)
plotter.container.connectToParent(thisObject.container, true, true)
plotter.container.connectToParent(thisObject.container, true, true, false, true)
plotter.container.frame.position.x = thisObject.container.frame.width / 2 - plotter.container.frame.width / 2
plotter.container.frame.position.y = thisObject.container.frame.height / 2 - plotter.container.frame.height / 2
@@ -463,7 +463,7 @@ function newPlottersManager () {
let plotter = getNewPlotter(pProductCard.product.plotter.devTeam, pProductCard.product.plotter.codeName, pProductCard.product.plotter.moduleName)
plotter.container.connectToParent(thisObject.container, true, true)
plotter.container.connectToParent(thisObject.container, true, true, false, true)
plotter.container.frame.position.x = thisObject.container.frame.width / 2 - plotter.container.frame.width / 2
plotter.container.frame.position.y = thisObject.container.frame.height / 2 - plotter.container.frame.height / 2
-2
View File
@@ -54,8 +54,6 @@ function newChartSpace () {
var timeMachine = newTimeMachine()
// timeMachine.container.connectToParent(thisObject.container, true, true)
/* We make the time machine a little bit smaller than the current space. */
timeMachine.container.frame.position.x = this.container.frame.width / 2 - timeMachine.container.frame.width / 2
+4 -4
View File
@@ -82,7 +82,7 @@ function newTimeMachine () {
let timelineChart = newTimelineChart()
timelineChart.container.connectToParent(thisObject.container, true, true)
timelineChart.container.connectToParent(thisObject.container, true, true, false, true)
timelineChart.container.frame.height = thisObject.container.frame.height
timelineChart.container.frame.position.x = thisObject.container.frame.width / 2 - timelineChart.container.frame.width / 2
@@ -106,7 +106,7 @@ function newTimeMachine () {
/* Each Time Machine has a Time Scale and a Right Scale. */
timeScale = newTimeScale()
timeScale.container.connectToParent(thisObject.container, false, false)
timeScale.container.connectToParent(thisObject.container, false, false, false, true)
timeScale.container.eventHandler.listenToEvent('Lenght Percentage Changed', function (event) {
thisObject.container.frame.width = TIME_MACHINE_WIDTH * event.lenghtPercentage / 100
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
@@ -115,7 +115,7 @@ function newTimeMachine () {
timeScale.initialize(timeLineCoordinateSystem)
rigthScale = newRateScale()
rigthScale.container.connectToParent(thisObject.container, false, false)
rigthScale.container.connectToParent(thisObject.container, false, false, false, true)
rigthScale.container.eventHandler.listenToEvent('Height Percentage Changed', function (event) {
thisObject.container.frame.height = TIME_MACHINE_HEIGHT * event.heightPercentage / 100
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
@@ -157,7 +157,7 @@ function newTimeMachine () {
let timelineChart = newTimelineChart()
timelineChart.container.connectToParent(thisObject.container, true, true)
timelineChart.container.connectToParent(thisObject.container, true, true, false, true)
timelineChart.container.frame.height = thisObject.container.frame.height
+2 -2
View File
@@ -123,7 +123,7 @@
plotterManager = newPlottersManager()
plotterManager.container.connectToParent(thisObject.container, true, true)
plotterManager.container.connectToParent(thisObject.container, true, true, false, true)
plotterManager.container.frame.position.x = 0
plotterManager.container.frame.position.y = 0
@@ -142,7 +142,7 @@
}
timePeriodScale = newTimePeriodScale()
timePeriodScale.container.connectToParent(thisObject.container, false, false)
timePeriodScale.container.connectToParent(thisObject.container, false, false, false, true)
timePeriodScale.container.eventHandler.listenToEvent('Time Period Changed', function (event) {
let currentTimePeriod = timePeriod
timePeriod = event.timePeriod