Merge pull request #77 from AAMasters/develop

Improvements and fixes
This commit is contained in:
benme authored and GitHub committed 2019-07-01 10:08:32 -03:00
commit 52622ed4a3
11 files changed
+82 -25

No files matched your search

+5 -4
View File
@@ -117,18 +117,19 @@ function newCanvas () {
thisObject.animation = animation
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
animation.addCallBackFunction('Floating Space Physics', thisObject.floatingSpace.physics)
animation.addCallBackFunction('Chart Space Physics', thisObject.chartSpace.physics)
animation.addCallBackFunction('CockpitSpace Physics', thisObject.cockpitSpace.physics)
animation.addCallBackFunction('Strategy Space Physics', thisObject.strategySpace.physics)
animation.addCallBackFunction('Floating Space Draw', thisObject.floatingSpace.draw)
animation.addCallBackFunction('Chart Space Background', thisObject.chartSpace.drawBackground)
animation.addCallBackFunction('Chart Space Draw', thisObject.chartSpace.draw)
animation.addCallBackFunction('Chart Space Physics', thisObject.chartSpace.physics)
animation.addCallBackFunction('Panels Space', thisObject.panelsSpace.draw)
animation.addCallBackFunction('ViewPort Animate', viewPort.animate)
animation.addCallBackFunction('CockpitSpace Draw', thisObject.cockpitSpace.draw)
animation.addCallBackFunction('CockpitSpace Physics', thisObject.cockpitSpace.physics)
animation.addCallBackFunction('Top Space Draw', thisObject.topSpace.draw)
animation.addCallBackFunction('Strategy Space Draw', thisObject.strategySpace.draw)
animation.addCallBackFunction('Strategy Space Physics', thisObject.strategySpace.physics)
animation.addCallBackFunction('Splash Screen Draw', splashScreen.draw)
animation.start()
} catch (err) {
+1 -1
View File
@@ -345,7 +345,7 @@ function newTimelineChart () {
let imageHeight = 42
let imageWidth = 150
const MAX_COLUMNS = 16
const MAX_COLUMNS = 32
const MAX_ROWS = 5
const Y_TOP_MARGIN = 30
const MIN_ROW_HIGHT = 100
+25 -5
View File
@@ -90,7 +90,11 @@ function newSpeedometer () {
if (CURRENT_VALUE_ANGLE > INIT_VALUE_ANGLE) { CURRENT_VALUE_ANGLE = INIT_VALUE_ANGLE }
if (thisObject.params.VALUE > 0) {
if (
thisObject.params.VALUE > 0 &&
thisObject.params.ASSET_NAME === thisObject.params.BASE_ASSET &&
thisObject.params.POSITION_TAKEN === false
) {
browserCanvasContext.setLineDash([0, 0])
browserCanvasContext.beginPath()
@@ -174,16 +178,27 @@ function newSpeedometer () {
/* We put the thisObject.params.VALUE in the middle */
fontSize = 22
if (thisObject.params.VALUE > 999) {
fontSize = 18
}
if (thisObject.params.VALUE > 9999) {
fontSize = 14
}
if (thisObject.params.VALUE > 99999) {
fontSize = 10
}
browserCanvasContext.font = 'bold ' + fontSize + 'px ' + UI_FONT.PRIMARY
label = thisObject.params.VALUE
if (isNaN(label) === false) {
label = Number(label)
label = Math.trunc(label * Math.pow(10, thisObject.params.DECIMALS)) / Math.pow(10, thisObject.params.DECIMALS)
if (label === 0) { label = label.toFixed(2) } else { label = label.toLocaleString() }
}
label = label.substring(0, 5)
// label = label.substring(0, 6)
xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO + 7
@@ -220,7 +235,7 @@ function newSpeedometer () {
browserCanvasContext.font = 'bold ' + fontSize + 'px ' + UI_FONT.PRIMARY
label = thisObject.params.ASSET_NAME
label = thisObject.params.ASSET_NAME + ' '
xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO + 3
yOffset = -15
@@ -230,7 +245,12 @@ function newSpeedometer () {
y: centerPoint.y - yOffset
}
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + OPACITY + ')'
if (thisObject.params.ASSET_NAME === thisObject.params.BASE_ASSET) {
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.TITANIUM_YELLOW + ', ' + OPACITY + ')'
} else {
browserCanvasContext.fillStyle = 'rgba(' + UI_COLOR.WHITE + ', ' + OPACITY + ')'
}
browserCanvasContext.fillText(label, labelPoint.x, labelPoint.y)
}
}
+1
View File
@@ -68,6 +68,7 @@ function newCircularMenu () {
menuItem.relatedStrategyPart = menuItemInitialValue.relatedStrategyPart
menuItem.dontShowAtFullscreen = menuItemInitialValue.dontShowAtFullscreen
menuItem.askConfirmation = menuItemInitialValue.askConfirmation
menuItem.confirmationLabel = menuItemInitialValue.confirmationLabel
if (menuItem.label === undefined) {
menuItem.type = 'Icon Only'
+2 -1
View File
@@ -6,6 +6,7 @@ function newCircularMenuItem () {
type: undefined,
isDeployed: undefined,
askConfirmation: undefined,
confirmationLabel: undefined,
iconOn: undefined,
iconOff: undefined,
currentIcon: undefined,
@@ -194,7 +195,7 @@ function newCircularMenuItem () {
}
if (temporaryStatus === 0 && thisObject.askConfirmation === true) {
setTemporaryStatus('Confirm to Delete', UI_COLOR.GREY, 50)
setTemporaryStatus(thisObject.confirmationLabel, UI_COLOR.GREY, 50)
}
}
+1 -1
View File
@@ -625,7 +625,7 @@ function newFloatingLayer () {
pDelta = -1
}
maxTargetRepulsionForce = maxTargetRepulsionForce + pDelta / 10000
maxTargetRepulsionForce = maxTargetRepulsionForce + pDelta / 1000
if (maxTargetRepulsionForce < 0.0001) {
maxTargetRepulsionForce = 0.0001
+5 -4
View File
@@ -79,7 +79,7 @@ function newStrategyPart () {
let errorMessage = ''
let formulaValue = 0
let detachingEnabled = false
let rightDragging = false
return thisObject
@@ -189,6 +189,7 @@ function newStrategyPart () {
if (thisObject.isOnFocus !== true) { return }
if (isDragging !== true) { return }
if (rightDragging !== true) { return }
if (thisObject.payload.chainParent !== undefined) { return }
let nearbyFloatingObjects = thisObject.payload.floatingObject.nearbyFloatingObjects
@@ -374,7 +375,7 @@ function newStrategyPart () {
function detachingPhysics () {
if (isDragging !== true) { return }
if (thisObject.isFrozen === true) { return }
if (detachingEnabled === false) { return }
if (rightDragging === false) { return }
let distanceToChainParent = Math.sqrt(Math.pow(thisObject.payload.position.x - thisObject.payload.targetPosition.x, 2) + Math.pow(thisObject.payload.position.y - thisObject.payload.targetPosition.y, 2))
let ratio = distanceToChainParent / previousDistance
@@ -498,9 +499,9 @@ function newStrategyPart () {
}
isDragging = true
if (event.button === 2) {
detachingEnabled = true
rightDragging = true
} else {
detachingEnabled = false
rightDragging = false
}
}
+23 -2
View File
@@ -187,6 +187,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Trading System',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete Trading System',
visible: false,
@@ -270,6 +271,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Parameters',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete Parameters',
visible: false,
@@ -339,6 +341,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Base Asset',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete Base Asset',
visible: false,
@@ -421,6 +424,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Strategy',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Strategy',
visible: false,
@@ -503,6 +507,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Trigger Stage',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Stage',
visible: false,
@@ -572,6 +577,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Open Stage',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Stage',
visible: false,
@@ -641,6 +647,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Manage Stage',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Stage',
visible: false,
@@ -698,6 +705,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Close Stage',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Stage',
visible: false,
@@ -755,6 +763,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Position Size',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete Trading System',
visible: false,
@@ -838,6 +847,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Event',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Event',
visible: false,
@@ -908,6 +918,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Event',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Event',
visible: false,
@@ -978,6 +989,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Event',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Event',
visible: false,
@@ -1047,6 +1059,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Initial Definition',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Definition',
visible: false,
@@ -1117,6 +1130,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Managed Item',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Item',
visible: false,
@@ -1187,6 +1201,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Managed Item',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Item',
visible: false,
@@ -1270,6 +1285,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Phase',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Phase',
visible: false,
@@ -1345,6 +1361,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Formula',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Formula',
visible: false,
@@ -1415,6 +1432,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Event',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Event',
visible: false,
@@ -1485,6 +1503,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Situation',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Situation',
visible: false,
@@ -1555,6 +1574,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Condition',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Condition',
visible: false,
@@ -1630,6 +1650,7 @@ function newStrategyPartConstructor () {
{
action: 'Delete Code',
askConfirmation: true,
confirmationLabel: 'Confirm to Delete',
actionFunction: payload.onMenuItemClick,
label: 'Delete This Code',
visible: false,
@@ -1765,7 +1786,7 @@ function newStrategyPartConstructor () {
floatingObject.targetFriction = 0.93
floatingObject.friction = INITIAL_FRICTION
floatingObject.initializeMass(500)
floatingObject.initializeMass(400)
floatingObject.initializeRadius(45)
floatingObject.initializeImageSize(80)
floatingObject.initializeFontSize(10)
@@ -1777,7 +1798,7 @@ function newStrategyPartConstructor () {
floatingObject.targetFriction = 0.94
floatingObject.friction = INITIAL_FRICTION
floatingObject.initializeMass(250)
floatingObject.initializeMass(200)
floatingObject.initializeRadius(45)
floatingObject.initializeImageSize(80)
floatingObject.initializeFontSize(10)
+1 -1
View File
@@ -15,7 +15,7 @@ function newRateScale () {
}
const HEIGHT_PERCENTAGE_DEFAULT_VALUE = 50
const STEP_SIZE = 5
const STEP_SIZE = 2
const MIN_WIDTH = 50
thisObject.container = newContainer()
+2 -2
View File
@@ -70,7 +70,7 @@ function newTimeScale () {
if (thisObject.lenghtPercentage < STEP_SIZE) { thisObject.lenghtPercentage = STEP_SIZE }
} else {
thisObject.lenghtPercentage = thisObject.lenghtPercentage + STEP_SIZE
if (thisObject.lenghtPercentage > 100) { thisObject.lenghtPercentage = 100 }
if (thisObject.lenghtPercentage > 200) { thisObject.lenghtPercentage = 200 }
}
event.lenghtPercentage = thisObject.lenghtPercentage
@@ -107,7 +107,7 @@ function newTimeScale () {
const DISTANCE_BETWEEN_ARROWS = 10
const MIN_DISTANCE_FROM_CENTER = 110
const CURRENT_VALUE_DISTANCE = MIN_DISTANCE_FROM_CENTER + thisObject.lenghtPercentage
const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 100 + DISTANCE_BETWEEN_ARROWS
const MAX_DISTANCE_FROM_CENTER = MIN_DISTANCE_FROM_CENTER + 200 + DISTANCE_BETWEEN_ARROWS
let ARROW_DIRECTION = 0
+16 -4
View File
@@ -31,13 +31,16 @@ function newFloatingSpace () {
thisObject.container.isWheelable = true
thisObject.container.detectMouseOver = true
thisObject.container.frame.radius = 0
thisObject.container.frame.width = browserCanvas.width * 10
thisObject.container.frame.height = browserCanvas.height * 10
let devicePixelRatio = window.devicePixelRatio
const SPACE_SIZE = 10
thisObject.container.frame.width = browserCanvas.width * devicePixelRatio * SPACE_SIZE
thisObject.container.frame.height = browserCanvas.height * devicePixelRatio * SPACE_SIZE
thisObject.container.frame.position.x = browserCanvas.width / 2 - thisObject.container.frame.width / 2
thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
let visible = false
return thisObject
function finalize () {
@@ -134,9 +137,19 @@ function newFloatingSpace () {
}
function physics () {
browserZoomPhysics()
thisObject.floatingLayer.physics()
}
function browserZoomPhysics () {
if (devicePixelRatio !== window.devicePixelRatio) {
devicePixelRatio = window.devicePixelRatio
thisObject.container.frame.position.x = browserCanvas.width / 2 - thisObject.container.frame.width / 2
thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
}
}
function draw () {
if (visible === true) {
drawBackground()
@@ -155,4 +168,3 @@ function newFloatingSpace () {
browserCanvasContext.fill()
}
}