Big reorg of where things are, departure from Profile Balls and Notes
This commit is contained in:
1 parent
e10425f852
commit
8bad750210
11 files changed
+64
-82
No files matched your search
@@ -22,7 +22,7 @@ function newFloatingLayer () {
|
||||
|
||||
let thisObject = {
|
||||
addFloatingObject: addFloatingObject,
|
||||
killFloatingObject: killFloatingObject,
|
||||
removeFloatingObject: removeFloatingObject,
|
||||
getFloatingObject: getFloatingObject,
|
||||
physics: physics,
|
||||
changeTargetRepulsion: changeTargetRepulsion,
|
||||
@@ -91,7 +91,7 @@ function newFloatingLayer () {
|
||||
invisibleFloatingObjects.push(pFloatingObject)
|
||||
}
|
||||
|
||||
function killFloatingObject (pFloatingObjectHandle) {
|
||||
function removeFloatingObject (pFloatingObjectHandle) {
|
||||
try {
|
||||
/*
|
||||
The floting object to be killed can be either at the visible or the invisible array. What we do here is look for it
|
||||
@@ -121,11 +121,11 @@ function newFloatingLayer () {
|
||||
}
|
||||
}
|
||||
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] killFloatingObject -> Floating Object Not Found.') }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] killFloatingObject -> Floating Object cannot be killed.') }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] killFloatingObject -> pFloatingObjectHandle = ' + pFloatingObjectHandle) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] removeFloatingObject -> Floating Object Not Found.') }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] removeFloatingObject -> Floating Object cannot be killed.') }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] removeFloatingObject -> pFloatingObjectHandle = ' + pFloatingObjectHandle) }
|
||||
} catch (err) {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] killFloatingObject -> err= ' + err.stack) }
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] removeFloatingObject -> err= ' + err.stack) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ function newFloatingObject () {
|
||||
isOnFocus: false,
|
||||
payload: undefined, // This is a reference to an object controlled by a Plotter. The plotter can change its internal value and we will see them from here.
|
||||
type: undefined, // Currently there are two types of Floating Objects: Profile Balls, and Notes.
|
||||
underlayingObject: undefined,
|
||||
currentSpeed: 0, // This is the current speed of the floating object.
|
||||
currentMass: 0, // This is the current mass of the floating object, including its zoom applied.
|
||||
friction: 0, // This is a factor that will ultimatelly desacelerate the floating object.
|
||||
@@ -62,38 +61,11 @@ function newFloatingObject () {
|
||||
thisObject.container.finalize()
|
||||
thisObject.container = undefined
|
||||
thisObject.payload = undefined
|
||||
thisObject.underlayingObject.finalize()
|
||||
thisObject.underlayingObject = undefined
|
||||
}
|
||||
|
||||
function initialize (pType, floatingLayer) {
|
||||
switch (pType) {
|
||||
|
||||
case 'Profile Ball': {
|
||||
thisObject.underlayingObject = newProfileBall()
|
||||
thisObject.underlayingObject.initialize()
|
||||
break
|
||||
}
|
||||
case 'Note': {
|
||||
thisObject.underlayingObject = newNote()
|
||||
thisObject.underlayingObject.initialize()
|
||||
break
|
||||
}
|
||||
|
||||
case 'Strategy Part': {
|
||||
thisObject.underlayingObject = newStrategyPart()
|
||||
thisObject.underlayingObject.initialize(floatingLayer, thisObject.payload)
|
||||
thisObject.underlayingObject.container.connectToParent(thisObject.container, false, false, true, true, false, false, true, true)
|
||||
break
|
||||
}
|
||||
default: {
|
||||
if (ERROR_LOG === true) { logger.write('[ERROR] initialize -> Unsopported type received -> pType = ' + pType) }
|
||||
callBackFunction(GLOBAL.DEFAULT_FAIL_RESPONSE)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
thisObject.type = pType
|
||||
function initialize (type, payload) {
|
||||
thisObject.payload = payload
|
||||
thisObject.type = type
|
||||
|
||||
selfMouseOverEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseOver', onMouseOver)
|
||||
selfMouseClickEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onMouseClick', onMouseClick)
|
||||
@@ -111,7 +83,7 @@ function newFloatingObject () {
|
||||
function getContainer (point) {
|
||||
let container
|
||||
|
||||
container = thisObject.underlayingObject.getContainer(point)
|
||||
container = thisObject.payload.uiObject.getContainer(point)
|
||||
if (container !== undefined) { return container }
|
||||
|
||||
if (thisObject.container.frame.isThisPointHere(point, true) === true) {
|
||||
@@ -123,7 +95,7 @@ function newFloatingObject () {
|
||||
|
||||
function physics () {
|
||||
thisObjectPhysics()
|
||||
thisObject.underlayingObject.physics()
|
||||
thisObject.payload.uiObject.physics()
|
||||
}
|
||||
|
||||
function thisObjectPhysics () {
|
||||
@@ -176,7 +148,7 @@ function newFloatingObject () {
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 2.0
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 2.0
|
||||
|
||||
thisObject.underlayingObject.container.eventHandler.raiseEvent('onFocus', point)
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onFocus', point)
|
||||
|
||||
thisObject.positionLocked = true
|
||||
|
||||
@@ -201,7 +173,7 @@ function newFloatingObject () {
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 1
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 1
|
||||
|
||||
thisObject.underlayingObject.container.eventHandler.raiseEvent('onNotFocus')
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus')
|
||||
|
||||
thisObject.positionLocked = false
|
||||
thisObject.isOnFocus = false
|
||||
@@ -213,23 +185,23 @@ function newFloatingObject () {
|
||||
point: pPoint,
|
||||
parent: thisObject
|
||||
}
|
||||
thisObject.underlayingObject.container.eventHandler.raiseEvent('onMouseClick', event)
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onMouseClick', event)
|
||||
}
|
||||
|
||||
function drawBackground () {
|
||||
thisObject.underlayingObject.drawBackground(thisObject)
|
||||
thisObject.payload.uiObject.drawBackground(thisObject)
|
||||
}
|
||||
|
||||
function drawMiddleground () {
|
||||
thisObject.underlayingObject.drawMiddleground(thisObject)
|
||||
thisObject.payload.uiObject.drawMiddleground(thisObject)
|
||||
}
|
||||
|
||||
function drawForeground () {
|
||||
thisObject.underlayingObject.drawForeground(thisObject)
|
||||
thisObject.payload.uiObject.drawForeground(thisObject)
|
||||
}
|
||||
|
||||
function drawOnFocus () {
|
||||
thisObject.underlayingObject.drawOnFocus(thisObject)
|
||||
thisObject.payload.uiObject.drawOnFocus(thisObject)
|
||||
}
|
||||
|
||||
function initializeMass (suggestedValue) {
|
||||
|
||||
@@ -124,7 +124,7 @@ function newNoteSets () {
|
||||
Each time we identify a floatingObject that is not at the raw data anymore, we request the floatinglayer to kill it.
|
||||
*/
|
||||
|
||||
floatingLayer.killFloatingObject(floatingNote.floatingHandle)
|
||||
floatingLayer.removeFloatingObject(floatingNote.floatingHandle)
|
||||
} else {
|
||||
newFloatingNotes.push(floatingNote)
|
||||
|
||||
@@ -299,7 +299,7 @@ function newNoteSets () {
|
||||
for (let j = 0; j < noteSet.floatingNotes.length; j++) {
|
||||
let floatingNote = noteSet.floatingNotes[j]
|
||||
|
||||
floatingLayer.killFloatingObject(floatingNote.floatingHandle)
|
||||
floatingLayer.removeFloatingObject(floatingNote.floatingHandle)
|
||||
}
|
||||
|
||||
noteSets.splice(i, 1) // Delete item from array.
|
||||
|
||||
@@ -306,7 +306,7 @@ function newProfileBall () {
|
||||
|
||||
let label
|
||||
|
||||
label = pFloatingObject.payload.profile.upLabel
|
||||
label = pFloatingObject.payload.profile.subTitle
|
||||
|
||||
if (label !== undefined) {
|
||||
labelPoint = {
|
||||
@@ -319,7 +319,7 @@ function newProfileBall () {
|
||||
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
|
||||
}
|
||||
|
||||
label = pFloatingObject.payload.profile.downLabel
|
||||
label = pFloatingObject.payload.profile.title
|
||||
|
||||
if (label !== undefined) {
|
||||
labelPoint = {
|
||||
|
||||
@@ -56,7 +56,7 @@ function newProfileBalls () {
|
||||
}
|
||||
|
||||
function destroyProfileBall (pFloatingObjectHandle) {
|
||||
floatingLayer.killFloatingObject(pFloatingObjectHandle)
|
||||
floatingLayer.removeFloatingObject(pFloatingObjectHandle)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,6 @@ function newStrategyPart () {
|
||||
thisObject.container.frame.position.x = 0
|
||||
thisObject.container.frame.position.y = 0
|
||||
|
||||
let floatingLayer
|
||||
let image
|
||||
let imagePath
|
||||
|
||||
@@ -60,14 +59,12 @@ function newStrategyPart () {
|
||||
thisObject.codeEditor = undefined
|
||||
}
|
||||
|
||||
floatingLayer = undefined
|
||||
image = undefined
|
||||
imagePath = undefined
|
||||
}
|
||||
|
||||
function initialize (pFloatingLayer, payload) {
|
||||
function initialize (payload) {
|
||||
thisObject.payload = payload
|
||||
floatingLayer = pFloatingLayer
|
||||
|
||||
let menuItemsInitialValues = []
|
||||
switch (thisObject.payload.node.type) {
|
||||
@@ -497,7 +494,7 @@ function newStrategyPart () {
|
||||
if (radius > 6) {
|
||||
const MAX_LABEL_LENGTH = 30
|
||||
|
||||
label = params.payload.upLabel
|
||||
label = params.payload.subTitle
|
||||
label = addIndexNumber(label)
|
||||
|
||||
if (label !== undefined) {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
|
||||
function newStrategyPartConstructor () {
|
||||
const MODULE_NAME = 'Strategy Parts'
|
||||
const MODULE_NAME = 'Strategy Part Constructor'
|
||||
const ERROR_LOG = true
|
||||
const logger = newWebDebugLog()
|
||||
logger.fileName = MODULE_NAME
|
||||
|
||||
let thisObject = {
|
||||
|
||||
createNewStrategyPart: createNewStrategyPart,
|
||||
createStrategyPart: createStrategyPart,
|
||||
destroyStrategyPart: destroyStrategyPart,
|
||||
initialize: initialize,
|
||||
finalize: finalize
|
||||
@@ -20,16 +20,24 @@ function newStrategyPartConstructor () {
|
||||
|
||||
function finalize () {
|
||||
floatingLayer = undefined
|
||||
|
||||
payload.uiObject.finalize()
|
||||
payload.uiObject = undefined
|
||||
}
|
||||
|
||||
function initialize (pFloatingLayer) {
|
||||
floatingLayer = pFloatingLayer
|
||||
}
|
||||
|
||||
function createNewStrategyPart (payload) {
|
||||
function createStrategyPart (payload) {
|
||||
let floatingObject = newFloatingObject()
|
||||
floatingObject.payload = payload
|
||||
floatingObject.initialize('Strategy Part', payload.node.type, floatingLayer)
|
||||
floatingObject.initialize('Strategy Part', payload)
|
||||
payload.floatingObject = floatingObject
|
||||
|
||||
let strategyPart = newStrategyPart()
|
||||
strategyPart.initialize(payload)
|
||||
strategyPart.container.connectToParent(floatingObject.container, false, false, true, true, false, false, true, true)
|
||||
payload.uiObject = strategyPart
|
||||
|
||||
const FRICTION = 0.97
|
||||
|
||||
@@ -139,10 +147,16 @@ function newStrategyPartConstructor () {
|
||||
|
||||
floatingLayer.addFloatingObject(floatingObject)
|
||||
|
||||
return floatingObject.handle
|
||||
return
|
||||
}
|
||||
|
||||
function destroyStrategyPart (pFloatingObjectHandle) {
|
||||
floatingLayer.killFloatingObject(pFloatingObjectHandle)
|
||||
function destroyStrategyPart (payload) {
|
||||
floatingLayer.removeFloatingObject(payload.floatingObject.handle)
|
||||
|
||||
payload.floatingObject.finalize()
|
||||
payload.floatingObject = undefined
|
||||
|
||||
payload.uiObject.finalize()
|
||||
payload.uiObject = undefined
|
||||
}
|
||||
}
|
||||
@@ -93,8 +93,8 @@ function newStrategyPartTitle () {
|
||||
thisObject.container.frame.position.x = 0 - label.length / 2 * fontSize * FONT_ASPECT_RATIO * 1.2
|
||||
thisObject.container.frame.position.y = 0 - radius * 1 / 2 - fontSize * FONT_ASPECT_RATIO - 10
|
||||
|
||||
thisObject.container.frame.width = thisObject.container.frame.radius
|
||||
thisObject.container.frame.height = 20
|
||||
// thisObject.container.frame.width = thisObject.container.frame.radius
|
||||
// thisObject.container.frame.height = 20
|
||||
}
|
||||
|
||||
function onFocus () {
|
||||
@@ -149,7 +149,7 @@ function newStrategyPartTitle () {
|
||||
|
||||
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
|
||||
|
||||
label = params.payload.downLabel
|
||||
label = params.payload.title
|
||||
|
||||
if (label !== undefined) {
|
||||
if (label.length > MAX_LABEL_LENGTH) {
|
||||
@@ -168,4 +168,3 @@ function newStrategyPartTitle () {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -285,7 +285,7 @@ function newPlottersManager () {
|
||||
|
||||
botAvatar.src = window.canvasApp.context.fbProfileImages.get(TEAM + '-' + BOT)
|
||||
|
||||
competitionPlotter.plotter.payload[k].profile.downLabel = bot.displayName
|
||||
competitionPlotter.plotter.payload[k].profile.title = bot.displayName
|
||||
competitionPlotter.plotter.payload[k].profile.imageId = imageId
|
||||
competitionPlotter.plotter.payload[k].profile.botAvatar = botAvatar
|
||||
|
||||
@@ -525,8 +525,8 @@ function newPlottersManager () {
|
||||
if (productPlotter.plotter.payload !== undefined) {
|
||||
let imageId = pProductCard.bot.devTeam + '.' + pProductCard.bot.profilePicture
|
||||
|
||||
productPlotter.plotter.payload.profile.upLabel = pProductCard.product.shortDisplayName
|
||||
productPlotter.plotter.payload.profile.downLabel = pProductCard.bot.displayName
|
||||
productPlotter.plotter.payload.profile.subTitle = pProductCard.product.shortDisplayName
|
||||
productPlotter.plotter.payload.profile.title = pProductCard.bot.displayName
|
||||
productPlotter.plotter.payload.profile.imageId = imageId
|
||||
productPlotter.plotter.payload.profile.botAvatar = pProductCard.bot.avatar
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ function newFloatingSpace () {
|
||||
let thisObject = {
|
||||
floatingLayer: undefined, // This is the array of floatingObjects being displayed
|
||||
profileBalls: undefined,
|
||||
strategyParts: undefined,
|
||||
strategyPartConstructor: undefined,
|
||||
noteSets: undefined,
|
||||
container: undefined,
|
||||
makeVisible: makeVisible,
|
||||
@@ -41,7 +41,7 @@ function newFloatingSpace () {
|
||||
function finalize () {
|
||||
thisObject.floatingLayer.finalize()
|
||||
thisObject.profileBalls.finalize()
|
||||
thisObject.strategyParts.finalize()
|
||||
thisObject.strategyPartConstructor.finalize()
|
||||
thisObject.noteSets.finalize()
|
||||
}
|
||||
|
||||
@@ -55,8 +55,8 @@ function newFloatingSpace () {
|
||||
thisObject.noteSets = newNoteSets()
|
||||
thisObject.noteSets.initialize(thisObject.floatingLayer)
|
||||
|
||||
thisObject.strategyParts = newStrategyPartConstructor()
|
||||
thisObject.strategyParts.initialize(thisObject.floatingLayer)
|
||||
thisObject.strategyPartConstructor = newStrategyPartConstructor()
|
||||
thisObject.strategyPartConstructor.initialize(thisObject.floatingLayer)
|
||||
|
||||
thisObject.container.eventHandler.listenToEvent('onMouseWheel', onMouseWheel)
|
||||
}
|
||||
|
||||
@@ -52,13 +52,13 @@ function newStrategy () {
|
||||
}
|
||||
|
||||
if (title !== undefined) {
|
||||
payload.upLabel = title
|
||||
payload.subTitle = title
|
||||
} else {
|
||||
payload.upLabel = partType
|
||||
payload.subTitle = partType
|
||||
}
|
||||
|
||||
payload.visible = true
|
||||
payload.downLabel = name
|
||||
payload.title = name
|
||||
payload.node = node
|
||||
payload.parentNode = parentNode
|
||||
payload.chainParent = chainParent
|
||||
@@ -69,11 +69,11 @@ function newStrategy () {
|
||||
}
|
||||
node.payload = payload
|
||||
node.type = partType
|
||||
node.handle = canvas.floatingSpace.strategyParts.createNewStrategyPart(payload)
|
||||
canvas.floatingSpace.strategyPartConstructor.createStrategyPart(payload)
|
||||
}
|
||||
|
||||
function destroyPart (node) {
|
||||
canvas.floatingSpace.strategyParts.destroyStrategyPart(node.handle)
|
||||
canvas.floatingSpace.strategyPartConstructor.destroyStrategyPart(payload)
|
||||
}
|
||||
|
||||
function generateStrategyParts () {
|
||||
@@ -379,8 +379,8 @@ function newStrategy () {
|
||||
node.payload.targetPosition.x = undefined
|
||||
node.payload.targetPosition.y = undefined
|
||||
node.payload.visible = undefined
|
||||
node.payload.upLabel = undefined
|
||||
node.payload.downLabel = undefined
|
||||
node.payload.subTitle = undefined
|
||||
node.payload.title = undefined
|
||||
node.payload.node = undefined
|
||||
node.payload.parentNode = undefined
|
||||
node.payload.chainParent = undefined
|
||||
|
||||
Reference in new issue
Block a user