focus
This commit is contained in:
1 parent
b275224cef
commit
68a2bbb86c
2 files changed
+81
-17
No files matched your search
@@ -29,6 +29,10 @@ function newFloatingObject() {
|
||||
isParentCollapsed: false,
|
||||
frozenManually: false,
|
||||
collapsedManually: false,
|
||||
forceFocus: forceFocus,
|
||||
removeForceFocus: removeForceFocus,
|
||||
setFocus: setFocus,
|
||||
removeFocus: removeFocus,
|
||||
unCollapseParent: unCollapseParent,
|
||||
getPinStatus: getPinStatus,
|
||||
getFreezeStatus: getFreezeStatus,
|
||||
@@ -78,6 +82,7 @@ function newFloatingObject() {
|
||||
let spaceMouseOverEventSubscriptionId
|
||||
let spaceFocusAquiredEventSubscriptionId
|
||||
let lastParentAngle
|
||||
let forcedFocusCounter = 0
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -291,6 +296,14 @@ function newFloatingObject() {
|
||||
thisObject.payload.uiObject.physics()
|
||||
}
|
||||
positionContraintsPhysics()
|
||||
focusPhysics()
|
||||
}
|
||||
|
||||
function focusPhysics() {
|
||||
forcedFocusCounter--
|
||||
if (forcedFocusCounter < 0) {
|
||||
forcedFocusCounter = 0
|
||||
}
|
||||
}
|
||||
|
||||
function frozenPhysics() {
|
||||
@@ -551,19 +564,11 @@ function newFloatingObject() {
|
||||
thisObject.payload.position.y = thisObject.container.frame.position.y
|
||||
}
|
||||
|
||||
|
||||
|
||||
function onMouseOver(point) {
|
||||
if (thisObject.isOnFocus === false) {
|
||||
thisObject.targetRadius = thisObject.rawRadius * 6.0
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 2.0
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 2.0
|
||||
thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 8.0
|
||||
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onFocus', point)
|
||||
|
||||
thisObject.positionLocked = true
|
||||
|
||||
canvas.floatingSpace.container.eventHandler.raiseEvent('onFocusAquired', thisObject)
|
||||
thisObject.isOnFocus = true
|
||||
setFocus(point)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -583,7 +588,34 @@ function newFloatingObject() {
|
||||
}
|
||||
}
|
||||
|
||||
function forceFocus() {
|
||||
forcedFocusCounter = 10
|
||||
setFocus()
|
||||
}
|
||||
|
||||
function removeForceFocus() {
|
||||
forcedFocusCounter = 0
|
||||
removeFocus()
|
||||
}
|
||||
|
||||
function setFocus(point) {
|
||||
thisObject.targetRadius = thisObject.rawRadius * 6.0
|
||||
thisObject.targetImageSize = thisObject.rawImageSize * 2.0
|
||||
thisObject.targetFontSize = thisObject.rawFontSize * 2.0
|
||||
thisObject.targetHierarchyRing = thisObject.rawHierarchyRing * 8.0
|
||||
|
||||
thisObject.payload.uiObject.container.eventHandler.raiseEvent('onFocus', point)
|
||||
|
||||
thisObject.positionLocked = true
|
||||
|
||||
canvas.floatingSpace.container.eventHandler.raiseEvent('onFocusAquired', thisObject)
|
||||
thisObject.isOnFocus = true
|
||||
}
|
||||
|
||||
function removeFocus() {
|
||||
if (forcedFocusCounter > 0) {
|
||||
return
|
||||
}
|
||||
if (thisObject.payload === undefined) { return }
|
||||
if (thisObject.isOnFocus === true) {
|
||||
thisObject.targetRadius = thisObject.rawRadius * 1
|
||||
|
||||
@@ -53,6 +53,8 @@ function newTutorialSpace() {
|
||||
let currentDocumentationURL
|
||||
let resumeModeActivated // In this mode, we skip all the node which status is 'Done'
|
||||
let lastExecutedAction = ''
|
||||
let actionCounter = 0
|
||||
let forcingFocus = false
|
||||
|
||||
return thisObject
|
||||
|
||||
@@ -294,12 +296,25 @@ function newTutorialSpace() {
|
||||
) {
|
||||
currentNode.payload.referenceParent.payload.uiObject.setStatus(config.setStatusReferenceParent)
|
||||
}
|
||||
if (
|
||||
config.setFocusReferenceParent === true
|
||||
) {
|
||||
currentNode.payload.referenceParent.payload.floatingObject.forceFocus()
|
||||
forcingFocus = true
|
||||
}
|
||||
if (
|
||||
config.menuActionReferenceParent !== undefined
|
||||
) {
|
||||
if (config.menuActionReferenceParent + currentNode.id !== lastExecutedAction) {
|
||||
currentNode.payload.referenceParent.payload.uiObject.menu.internalClick(config.menuActionReferenceParent)
|
||||
lastExecutedAction = config.menuActionReferenceParent + currentNode.id
|
||||
/*
|
||||
Some actions needs a little delay because they depend on animations to happen.
|
||||
For that reason, we will count until 10 before executing actions from tutorial.
|
||||
*/
|
||||
actionCounter++
|
||||
if (actionCounter > 10) {
|
||||
if (config.menuActionReferenceParent + currentNode.id !== lastExecutedAction) {
|
||||
currentNode.payload.referenceParent.payload.uiObject.menu.internalClick(config.menuActionReferenceParent)
|
||||
lastExecutedAction = config.menuActionReferenceParent + currentNode.id
|
||||
}
|
||||
}
|
||||
} else {
|
||||
lastExecutedAction = ""
|
||||
@@ -392,13 +407,16 @@ function newTutorialSpace() {
|
||||
}
|
||||
|
||||
function stop() {
|
||||
checkForceFocus()
|
||||
resetActions()
|
||||
tutorialRootNode.payload.uiObject.isPlaying = false
|
||||
tutorialRootNode = undefined
|
||||
currentStatus = 'Stopped'
|
||||
}
|
||||
|
||||
function skip() {
|
||||
lastExecutedAction = ""
|
||||
checkForceFocus()
|
||||
resetActions()
|
||||
let tutorial = {
|
||||
status: 'Skipped'
|
||||
}
|
||||
@@ -407,7 +425,8 @@ function newTutorialSpace() {
|
||||
}
|
||||
|
||||
function previous() {
|
||||
lastExecutedAction = ""
|
||||
checkForceFocus()
|
||||
resetActions()
|
||||
if (navigationStack.length > 1) {
|
||||
let previousNode = navigationStack[navigationStack.length - 2]
|
||||
switch (previousNode.type) {
|
||||
@@ -437,7 +456,8 @@ function newTutorialSpace() {
|
||||
}
|
||||
|
||||
function next() {
|
||||
lastExecutedAction = ""
|
||||
checkForceFocus()
|
||||
resetActions()
|
||||
if (ckeckGoingToAnotherTutorial() === true) { return }
|
||||
let tutorial = {
|
||||
status: 'Done'
|
||||
@@ -446,6 +466,18 @@ function newTutorialSpace() {
|
||||
advance()
|
||||
}
|
||||
|
||||
function resetActions() {
|
||||
lastExecutedAction = ""
|
||||
actionCounter = 0
|
||||
}
|
||||
|
||||
function checkForceFocus() {
|
||||
if (forcingFocus === true) {
|
||||
currentNode.payload.referenceParent.payload.floatingObject.removeForceFocus()
|
||||
forcingFocus = false
|
||||
}
|
||||
}
|
||||
|
||||
function ckeckGoingToAnotherTutorial() {
|
||||
if (currentNode.payload !== undefined) {
|
||||
if (currentNode.payload.referenceParent !== undefined) {
|
||||
|
||||
Reference in new issue
Block a user