getContainer added across floating space

This commit is contained in:
Luis Fernando Molina committed 2019-05-04 18:06:21 +02:00
1 parent 7115daf686
commit 276db501b6
7 files changed
+118 -9

No files matched your search

+2 -2
View File
@@ -33,11 +33,11 @@ function newContainer () {
}
}
function initialize (pName) {
function initialize (pName, pType) {
thisObject.name = pName
thisObject.frame = newFrame()
thisObject.frame.initialize()
thisObject.frame.initialize(pType)
thisObject.frame.containerName = pName
thisObject.frame.container = thisObject
+13
View File
@@ -30,6 +30,7 @@ function newFloatingLayer () {
isInside: isInside,
isInsideFloatingObject: isInsideFloatingObject,
changeTargetRepulsion: changeTargetRepulsion,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
}
@@ -85,6 +86,18 @@ function newFloatingLayer () {
/* We dont need to initialize anything right now. */
}
function getContainer (point) {
let container
for (let i = 0; i < visibleFloatingObjects.length; i++) {
let floatingObject = visibleFloatingObjects[i]
container = floatingObject.getContainer(point)
if (container !== undefined) { return container }
}
return container
}
function addFloatingObject (pFloatingObject, callBackFunction) {
/*
As you can see here, even though the floating objects are created outside this layer, its creator it is not supossed to keep
+24 -1
View File
@@ -54,11 +54,21 @@ function newFloatingObject () {
linkedObject: undefined, // This is a reference to the object that this floating object is representing.
linkedObjectType: '', // Since there might be floating objects for different types of objects, here we store the type of object we are linking to.
container: undefined, // This is a pointer to the object where the floating object belongs to.
getContainer: getContainer,
container: undefined,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize('Circle')
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.frame.radius = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
thisObject.eventHandler = newEventHandler()
return thisObject
@@ -110,6 +120,19 @@ function newFloatingObject () {
}
}
function getContainer (point) {
let container
container = thisObject.underlayingObject.getContainer(point)
if (container !== undefined) { return container }
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physicsLoop (callBackFunction) {
try {
if (INFO_LOG === true) { logger.write('[INFO] initialize -> Entering function.') }
+23 -2
View File
@@ -1,23 +1,44 @@

function newNote () {
let thisObject = {
const MODULE_NAME = 'Note'
let thisObject = {
container: undefined,
physicsLoop: physicsLoop,
onMouseOver: onMouseOver,
onMouseClick: onMouseClick,
onMouseNotOver: onMouseNotOver,
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize('Circle')
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.frame.radius = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
return thisObject
function initialize () {
}
function getContainer (point) {
let container
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physicsLoop () {
}
+23 -2
View File
@@ -1,17 +1,28 @@
function newProfileBall () {
let thisObject = {
const MODULE_NAME = 'Profile Ball'
let thisObject = {
container: undefined,
physicsLoop: physicsLoop,
onMouseOver: onMouseOver,
onMouseClick: onMouseClick,
onMouseNotOver: onMouseNotOver,
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
initialize: initialize
}
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize('Circle')
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.frame.radius = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
let ballStringMenu = [
{
visible: false,
@@ -79,6 +90,16 @@ function newProfileBall () {
}
}
function getContainer (point) {
let container
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physicsLoop () {
// The menuItems also have a target.
+23 -2
View File
@@ -1,19 +1,30 @@
function newStrategyPart () {
const MODULE_NAME = 'Strategy Part'
let thisObject = {
type: undefined,
container: undefined,
physicsLoop: physicsLoop,
onMouseOver: onMouseOver,
onMouseClick: onMouseClick,
onMouseNotOver: onMouseNotOver,
drawBackground: drawBackground,
drawForeground: drawForeground,
getContainer: getContainer,
initialize: initialize
}
let ballStringMenu = []
thisObject.container = newContainer()
thisObject.container.name = MODULE_NAME
thisObject.container.initialize('Circle')
thisObject.container.isClickeable = true
thisObject.container.isDraggeable = false
thisObject.container.frame.radius = 0
thisObject.container.frame.position.x = 0
thisObject.container.frame.position.y = 0
let ballStringMenu = []
let floatingLayer
let isMouseOver = false
let image
@@ -263,6 +274,16 @@ function newStrategyPart () {
}
}
function getContainer (point) {
let container
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
return thisObject.container
} else {
return undefined
}
}
function physicsLoop () {
// The menuItems also have a target.
+10
View File
@@ -12,6 +12,7 @@ function newFloatingSpace () {
profileBalls: undefined,
strategyParts: undefined,
noteSets: undefined,
getContainer: getContainer,
initialize: initialize,
finalize: finalize
}
@@ -38,5 +39,14 @@ function newFloatingSpace () {
thisObject.strategyParts = newStrategyParts()
thisObject.strategyParts.initialize(thisObject.floatingLayer)
}
function getContainer (point) {
let container
container = thisObject.floatingLayer.getContainer(point)
if (container !== undefined) { return container }
return container
}
}