Improvements on Menus on Focus

This commit is contained in:
Luis Fernando Molina committed 2020-03-30 13:25:56 +02:00
1 parent b9b0f048c4
commit 14720dbc64
7 files changed
+83 -31

No files matched your search

+6
View File
@@ -111,6 +111,10 @@ function newAnimation () {
}
}
/* Frame per Seconds */
ANIMATION_FRAME_PER_SECONDS = Math.trunc(1000 / totalTimeConsumed)
/* Performance Check */
if (SHOW_ANIMATION_PERFORMACE === true) {
row = 0
@@ -132,6 +136,8 @@ function newAnimation () {
printLabel(DEBUG.variable3, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
row++
printLabel(DEBUG.variable4, 300, 100 + row * 30, 1, 20, UI_COLOR.RED)
row++
printLabel('Animation Frame Per Seconds: ' + ANIMATION_FRAME_PER_SECONDS, 300, 100 + row * 30, 1, 20, UI_COLOR.TITANIUM_YELLOW)
}
} else {
browserCanvas.width = 1
+4 -4
View File
@@ -185,25 +185,25 @@ function newEdgeEditor () {
function onKeyPressed (event) {
const STEP = 10
if (event.shiftKey === false && event.code === 'ArrowLeft') {
if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowLeft') {
thisObject.container.frame.position.x = thisObject.container.frame.position.x + STEP
whatHappened = 'left or right arrow key pressed'
return
}
if (event.shiftKey === false && event.code === 'ArrowRight') {
if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowRight') {
thisObject.container.frame.position.x = thisObject.container.frame.position.x - STEP
whatHappened = 'left or right arrow key pressed'
return
}
if (event.shiftKey === false && event.code === 'ArrowUp') {
if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowUp') {
thisObject.container.frame.position.y = thisObject.container.frame.position.y + STEP
whatHappened = 'up or down arrow key pressed'
return
}
if (event.shiftKey === false && event.code === 'ArrowDown') {
if (event.shiftKey === false && event.ctrlKey === false && event.code === 'ArrowDown') {
thisObject.container.frame.position.y = thisObject.container.frame.position.y - STEP
whatHappened = 'up or down arrow key pressed'
return
+6 -6
View File
@@ -169,19 +169,19 @@ function newCircularMenuItem () {
if (thisObject.type === 'Icon Only') {
switch (thisObject.ring) {
case 1: {
radiusGrowthFactor = 6.5
radiusGrowthFactor = 5.5
break
}
case 2: {
radiusGrowthFactor = 5.0
radiusGrowthFactor = 4.0
break
}
case 3: {
radiusGrowthFactor = 3.5
radiusGrowthFactor = 3.0
break
}
case 4: {
radiusGrowthFactor = 2.5
radiusGrowthFactor = 2.0
break
}
}
@@ -189,8 +189,8 @@ function newCircularMenuItem () {
radiusGrowthFactor = 4
}
thisObject.container.frame.position.x = thisObject.container.frame.radius * radiusGrowthFactor / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5
thisObject.container.frame.position.y = thisObject.container.frame.radius * radiusGrowthFactor / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2
thisObject.container.frame.position.x = thisObject.payload.floatingObject.targetRadius * radiusGrowthFactor / 7 * Math.cos(toRadians(thisObject.angle)) - thisObject.currentRadius * 1.5
thisObject.container.frame.position.y = thisObject.payload.floatingObject.targetRadius * radiusGrowthFactor / 7 * Math.sin(toRadians(thisObject.angle)) - thisObject.container.frame.height / 2
temporaryStatusPhysics()
+20 -16
View File
@@ -345,41 +345,45 @@ function newFloatingObject () {
function thisObjectPhysics () {
// The radius also have a target.
let ANIMATION_STEP = Math.abs(thisObject.targetRadius - thisObject.rawRadius) / 5
if (Math.abs(thisObject.container.frame.radius - thisObject.targetRadius) >= 10) {
if (ANIMATION_STEP === 0) { ANIMATION_STEP = 10 }
if (Math.abs(thisObject.container.frame.radius - thisObject.targetRadius) >= ANIMATION_STEP) {
if (thisObject.container.frame.radius < thisObject.targetRadius) {
thisObject.container.frame.radius = thisObject.container.frame.radius + 10
thisObject.container.frame.radius = thisObject.container.frame.radius + ANIMATION_STEP
} else {
thisObject.container.frame.radius = thisObject.container.frame.radius - 10
thisObject.container.frame.radius = thisObject.container.frame.radius - ANIMATION_STEP
}
thisObject.container.eventHandler.raiseEvent('Dimmensions Changed', event)
}
// The imageSize also have a target.
if (Math.abs(thisObject.currentImageSize - thisObject.targetImageSize) >= 10) {
if (Math.abs(thisObject.currentImageSize - thisObject.targetImageSize) >= ANIMATION_STEP) {
if (thisObject.currentImageSize < thisObject.targetImageSize) {
thisObject.currentImageSize = thisObject.currentImageSize + 10
thisObject.currentImageSize = thisObject.currentImageSize + ANIMATION_STEP
} else {
thisObject.currentImageSize = thisObject.currentImageSize - 10
thisObject.currentImageSize = thisObject.currentImageSize - ANIMATION_STEP
}
}
// The fontSize also have a target.
if (Math.abs(thisObject.currentFontSize - thisObject.targetFontSize) >= 1) {
if (Math.abs(thisObject.currentFontSize - thisObject.targetFontSize) >= ANIMATION_STEP / 10) {
if (thisObject.currentFontSize < thisObject.targetFontSize) {
thisObject.currentFontSize = thisObject.currentFontSize + 1
thisObject.currentFontSize = thisObject.currentFontSize + ANIMATION_STEP / 10
} else {
thisObject.currentFontSize = thisObject.currentFontSize - 1
thisObject.currentFontSize = thisObject.currentFontSize - ANIMATION_STEP / 10
}
}
if (Math.abs(thisObject.currentHierarchyRing - thisObject.targetHierarchyRing) >= 10) {
if (Math.abs(thisObject.currentHierarchyRing - thisObject.targetHierarchyRing) >= ANIMATION_STEP) {
if (thisObject.currentHierarchyRing < thisObject.targetHierarchyRing) {
thisObject.currentHierarchyRing = thisObject.currentHierarchyRing + 10
thisObject.currentHierarchyRing = thisObject.currentHierarchyRing + ANIMATION_STEP
} else {
thisObject.currentHierarchyRing = thisObject.currentHierarchyRing - 10
thisObject.currentHierarchyRing = thisObject.currentHierarchyRing - ANIMATION_STEP
}
}
@@ -409,14 +413,14 @@ function newFloatingObject () {
removeFocus()
}
function someoneAquiredFocus (container) {
if (container === undefined) {
function someoneAquiredFocus (floatingObject) {
if (floatingObject === undefined || floatingObject.container === undefined) {
return
}
if (thisObject.container === undefined) {
return
}
if (container.id !== thisObject.container.id) {
if (floatingObject.container.id !== thisObject.container.id) {
removeFocus()
}
}
@@ -429,7 +433,7 @@ function newFloatingObject () {
thisObject.targetFontSize = thisObject.rawFontSize * 1
thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 1
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus')
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onNotFocus', thisObject.container)
if (thisObject.isPinned !== true) {
thisObject.positionLocked = false
+1 -1
View File
@@ -46,7 +46,7 @@ const ZOOM_OUT_THRESHOLD_FOR_DISPLAYING_TIME_MACHINES_ICONIZED = 5
const ZOOM_OUT_THRESHOLD_FOR_DISPLAYING_SCALES = 3
let FONT_ASPECT_RATIO = 0.32;
let ANIMATION_FRAME_PER_SECONDS
const GET_CONTAINER_PURPOSE = {
MOUSE_OVER: 1,
+38
View File
@@ -57,14 +57,21 @@ function newFloatingSpace () {
thisObject.container.frame.position.y = browserCanvas.height / 2 - thisObject.container.frame.height / 2
let visible = false
let floatingObjetOnFocus
const PERCENTAGE_OF_SCREEN_FOR_DISPLACEMENT = 25
let onDragStartedEventSubscriptionId
let spaceFocusAquiredEventSubscriptionId
let floatingObjetOnFocusEventSubscriptionId
return thisObject
function finalize () {
thisObject.container.eventHandler.stopListening(onDragStartedEventSubscriptionId)
canvas.floatingSpace.container.eventHandler.stopListening(spaceFocusAquiredEventSubscriptionId)
if (floatingObjetOnFocus !== undefined) {
floatingObjetOnFocus.eventHandler.stopListening(floatingObjetOnFocusEventSubscriptionId)
}
thisObject.floatingLayer.finalize()
thisObject.uiObjectConstructor.finalize()
@@ -73,6 +80,8 @@ function newFloatingSpace () {
thisObject.floatingLayer = undefined
thisObject.uiObjectConstructor = undefined
thisObject.container = undefined
floatingObjetOnFocus = undefined
}
function initialize (callBackFunction) {
@@ -83,6 +92,26 @@ function newFloatingSpace () {
thisObject.uiObjectConstructor.initialize(thisObject.floatingLayer)
onDragStartedEventSubscriptionId = thisObject.container.eventHandler.listenToEvent('onDragStarted', onDragStarted)
spaceFocusAquiredEventSubscriptionId = canvas.floatingSpace.container.eventHandler.listenToEvent('onFocusAquired', someoneAquiredFocus)
}
function someoneAquiredFocus (floatingObject) {
if (floatingObject === undefined || floatingObject.container === undefined) {
return
}
floatingObjetOnFocus = floatingObject
floatingObjetOnFocusEventSubscriptionId = floatingObjetOnFocus.container.eventHandler.listenToEvent('onNotFocus', onNotFocus)
}
function onNotFocus (container) {
if (container !== undefined) {
container.eventHandler.stopListening(floatingObjetOnFocusEventSubscriptionId)
}
if (floatingObjetOnFocus !== undefined) {
if (floatingObjetOnFocus.container.id === container.id) {
floatingObjetOnFocus = undefined
}
}
}
function toggleDrawReferenceLines () {
@@ -347,8 +376,17 @@ function newFloatingSpace () {
function getContainer (point) {
if (visible === false) { return }
let container
if (floatingObjetOnFocus !== undefined) {
container = floatingObjetOnFocus.getContainer(point)
if (container !== undefined) {
container.space = 'Floating Space'
return container
}
}
container = thisObject.floatingLayer.getContainer(point)
if (container !== undefined) {
container.space = 'Floating Space'
+8 -4
View File
@@ -332,9 +332,13 @@
if (LOG_FILE_CONTENT === true) { logger.write(MODULE_NAME, "[INFO] start -> processTimeFramesMarketFiles -> periodsLoopBody -> dependencyLoopBody -> getFile -> onFileReceived -> text = " + text); }
if (err.result !== global.DEFAULT_OK_RESPONSE.result) {
logger.write(MODULE_NAME, "[ERROR] start -> processTimeFramesMarketFiles -> periodsLoopBody -> dependencyLoopBody -> getFile -> onFileReceived -> err = " + err.message);
callBackFunction(err);
if (err.message === 'File does not exist.') {
logger.write(MODULE_NAME, "[ERROR] The file " + filePath + '/' + fileName + ' does not exist and it is required to continue. This process will retry to read it in a while. In the meantime make yourself sure that the process that generates it has ran properly.');
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
} else {
logger.write(MODULE_NAME, "[ERROR] start -> processTimeFramesMarketFiles -> periodsLoopBody -> dependencyLoopBody -> getFile -> onFileReceived -> err = " + err.message);
callBackFunction(err);
}
return;
}
@@ -660,7 +664,7 @@
if ((err.result === "Fail Because" && err.message === "File does not exist.") || err.code === 'The specified key does not exist.') {
logger.write(MODULE_NAME, "[ERROR] start -> processTimeFramesDailyFiles -> periodsLoopBody -> dependencyLoopBody -> getCurrentFile -> onFileReceived -> err = " + err.stack);
logger.write(MODULE_NAME, "[ERROR] The file " + filePath + '/' + fileName + ' does not exist and it is required to continue. This process will retry to read it in a while. In the meantime make yourself sure that the process that generates it has ran properly.');
callBackFunction(global.DEFAULT_RETRY_RESPONSE);
return;
}