Code Cleaning

This commit is contained in:
Luis Fernando Molina committed 2019-05-04 09:03:59 +02:00
1 parent 4d2e9dcf63
commit a87a9b58da
4 files changed
+11 -30

No files matched your search

+2 -11
View File
@@ -81,22 +81,13 @@ function newFloatingObject () {
}
case 'Note': {
thisObject.underlayingObject = newNote()
thisObject.underlayingObject.initialize(onInitialized)
function onInitialized (err) {
}
thisObject.underlayingObject.initialize()
break
}
case 'Strategy Part': {
thisObject.underlayingObject = newStrategyPart()
thisObject.underlayingObject.initialize(floatingLayer, pSubType, onInitialized)
function onInitialized (err) {
}
thisObject.underlayingObject.initialize(floatingLayer, pSubType)
break
}
default: {
+4 -4
View File
@@ -14,8 +14,8 @@ function newNote () {
return thisObject
function initialize (callBackFunction) {
callBackFunction()
function initialize () {
}
function physicsLoop () {
@@ -214,7 +214,7 @@ function newNote () {
if (label !== undefined) {
if (SIZE_PERCENTAGE > 0.9) {
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
let xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO
let yOffset = (TITLE_BAR_HEIGHT - fontSize) / 2 + 2
@@ -292,7 +292,7 @@ function newNote () {
y: startingPosition.y + (i + 1) * (fontSize * FONT_ASPECT_RATIO + 10)
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = 'rgba(60, 60, 60, ' + ALPHA + ')'
browserCanvasContext.fillText(labelRow, labelPoint.x, labelPoint.y)
}
+4 -6
View File
@@ -53,7 +53,7 @@ function newProfileBall () {
return thisObject
function initialize (callBackFunction) {
function initialize () {
for (let i = 0; i < ballStringMenu.length; i++) {
let menuItem = ballStringMenu[i]
@@ -77,8 +77,6 @@ function newProfileBall () {
menuItem.icon = menuItem.iconOn // The default value is ON.
}
callBackFunction()
}
function physicsLoop () {
@@ -278,7 +276,7 @@ function newProfileBall () {
let labelPoint
let fontSize = pFloatingObject.currentFontSize
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
let label
@@ -290,7 +288,7 @@ function newProfileBall () {
y: pFloatingObject.currentPosition.y - pFloatingObject.currentImageSize / 2 - fontSize * FONT_ASPECT_RATIO - 10
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = pFloatingObject.labelStrokeStyle
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
}
@@ -303,7 +301,7 @@ function newProfileBall () {
y: pFloatingObject.currentPosition.y + pFloatingObject.currentImageSize / 2 + fontSize * FONT_ASPECT_RATIO + 15
}
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.font = fontSize + 'px ' + UI_FONT.PRIMARY
browserCanvasContext.fillStyle = pFloatingObject.labelStrokeStyle
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
}
+1 -9
View File
@@ -19,7 +19,7 @@ function newStrategyPart () {
return thisObject
function initialize (pFloatingLayer, pType, callBackFunction) {
function initialize (pFloatingLayer, pType) {
floatingLayer = pFloatingLayer
switch (pType) {
@@ -97,29 +97,21 @@ function newStrategyPart () {
for (let i = 0; i < ballStringMenu.length; i++) {
let menuItem = ballStringMenu[i]
menuItem.iconOn = new Image()
menuItem.iconOn.onload = onImageLoad
function onImageLoad () {
menuItem.iconOff = new Image()
menuItem.iconOff.onload = onImageLoad
function onImageLoad () {
menuItem.canDrawIcon = true
}
menuItem.iconOff.src = window.canvasApp.urlPrefix + menuItem.imagePathOff
}
menuItem.iconOn.src = window.canvasApp.urlPrefix + menuItem.imagePathOn
menuItem.icon = menuItem.iconOn // The default value is ON.
}
callBackFunction()
}
function physicsLoop () {