Removed events as direct calls

This commit is contained in:
Luis Fernando Molina committed 2019-05-04 18:48:43 +02:00
1 parent b56f1bba59
commit 10ca03678c
4 files changed
+29 -17

No files matched your search

+7 -3
View File
@@ -142,7 +142,7 @@ function newFloatingObject () {
thisObject.targetImageSize = thisObject.rawImageSize * 2.0
thisObject.targetFontSize = thisObject.rawFontSize * 2.0
thisObject.underlayingObject.onMouseOver()
thisObject.underlayingObject.container.eventHandler.raiseEvent('onMouseOver')
}
function onMouseNotOver () {
@@ -150,11 +150,15 @@ function newFloatingObject () {
thisObject.targetImageSize = thisObject.rawImageSize * 1
thisObject.targetFontSize = thisObject.rawFontSize * 1
thisObject.underlayingObject.onMouseNotOver()
thisObject.underlayingObject.container.eventHandler.raiseEvent('onMouseNotOver')
}
function onMouseClick (pPoint) {
thisObject.underlayingObject.onMouseClick(pPoint, thisObject)
let event = {
point: pPoint,
parent: thisObject
}
thisObject.underlayingObject.container.eventHandler.raiseEvent('onMouseClick', event)
}
function drawBackground () {
+6 -6
View File
@@ -5,9 +5,6 @@ function newNote () {
let thisObject = {
container: undefined,
physicsLoop: physicsLoop,
onMouseOver: onMouseOver,
onMouseClick: onMouseClick,
onMouseNotOver: onMouseNotOver,
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
@@ -26,7 +23,9 @@ function newNote () {
return thisObject
function initialize () {
thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
}
function getContainer (point) {
@@ -51,8 +50,9 @@ function newNote () {
}
function onMouseClick (pPoint, pFloatingObject) {
function onMouseClick (event) {
pPoint = event.point
pFloatingObject = event.parent
}
function drawBackground (pFloatingObject) {
+8 -4
View File
@@ -5,9 +5,6 @@ function newProfileBall () {
let thisObject = {
container: undefined,
physicsLoop: physicsLoop,
onMouseOver: onMouseOver,
onMouseClick: onMouseClick,
onMouseNotOver: onMouseNotOver,
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
@@ -80,6 +77,10 @@ function newProfileBall () {
menuItem.iconOn.src = window.canvasApp.urlPrefix + menuItem.imagePathOn
menuItem.icon = menuItem.iconOn // The default value is ON.
}
thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
}
function getContainer (point) {
@@ -124,9 +125,12 @@ function newProfileBall () {
}
}
function onMouseClick (pPoint, pFloatingObject) {
function onMouseClick (event) {
/* What we need to do here is to check which menu item was clicked, if any. */
pPoint = event.point
pFloatingObject = event.parent
let menuItemIndex
for (let i = 0; i < ballStringMenu.length; i++) {
+8 -4
View File
@@ -6,9 +6,6 @@ function newStrategyPart () {
type: undefined,
container: undefined,
physicsLoop: physicsLoop,
onMouseOver: onMouseOver,
onMouseClick: onMouseClick,
onMouseNotOver: onMouseNotOver,
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
@@ -272,6 +269,10 @@ function newStrategyPart () {
menuItem.iconOn.src = window.canvasApp.urlPrefix + menuItem.imagePathOn
menuItem.icon = menuItem.iconOn // The default value is ON.
}
thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
thisObject.container.eventHandler.listenToEvent('onMouseNotOver', onMouseNotOver)
}
function getContainer (point) {
@@ -320,9 +321,12 @@ function newStrategyPart () {
isMouseOver = false
}
function onMouseClick (pPoint, pFloatingObject) {
function onMouseClick (event) {
/* What we need to do here is to check which menu item was clicked, if any. */
pPoint = event.point
pFloatingObject = event.parent
let menuItemIndex
for (let i = 0; i < ballStringMenu.length; i++) {