Focus and Shortcut keys working with the APP Schema
This commit is contained in:
1 parent
cf5864017c
commit
01152a729d
2 files changed
+90
No files matched your search
@@ -1061,6 +1061,10 @@ function newOnFocus () {
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeThatIsOnFocus(node.shapes)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.panels.length; m++) {
|
||||
child = getNodeThatIsOnFocus(node.panels[m])
|
||||
if (child !== undefined) {
|
||||
@@ -1085,6 +1089,47 @@ function newOnFocus () {
|
||||
return
|
||||
}
|
||||
}
|
||||
default: {
|
||||
let nodeDefinition = APP_SCHEMA_MAP.get(node.type)
|
||||
if (nodeDefinition !== undefined) {
|
||||
/* First we ask the question to ourself */
|
||||
if (node.payload.uiObject.isOnFocus === true) {
|
||||
return node
|
||||
}
|
||||
|
||||
/* Then we check all of its own children nodes. */
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
for (let i = 0; i < nodeDefinition.properties.length; i++) {
|
||||
let property = nodeDefinition.properties[i]
|
||||
|
||||
switch (property.type) {
|
||||
case 'node': {
|
||||
if (node[property.name] !== undefined) {
|
||||
let child
|
||||
child = getNodeThatIsOnFocus(node[property.name])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'array': {
|
||||
let nodePropertyArray = node[property.name]
|
||||
if (nodePropertyArray !== undefined) {
|
||||
for (let m = 0; m < nodePropertyArray.length; m++) {
|
||||
child = getNodeThatIsOnFocus(nodePropertyArray[m])
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1038,6 +1038,10 @@ function newShortcutKeys () {
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
child = getNodeByShortcutKey(node.shapes, searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
for (let m = 0; m < node.panels.length; m++) {
|
||||
child = getNodeByShortcutKey(node.panels[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
@@ -1063,6 +1067,47 @@ function newShortcutKeys () {
|
||||
}
|
||||
}
|
||||
|
||||
default: {
|
||||
let nodeDefinition = APP_SCHEMA_MAP.get(node.type)
|
||||
if (nodeDefinition !== undefined) {
|
||||
/* Check Self first */
|
||||
if (node.payload.uiObject.shortcutKey === searchingKey) {
|
||||
return node
|
||||
}
|
||||
|
||||
/* Check all of its own children nodes. */
|
||||
if (nodeDefinition.properties !== undefined) {
|
||||
for (let i = 0; i < nodeDefinition.properties.length; i++) {
|
||||
let property = nodeDefinition.properties[i]
|
||||
|
||||
switch (property.type) {
|
||||
case 'node': {
|
||||
if (node[property.name] !== undefined) {
|
||||
let child
|
||||
child = getNodeByShortcutKey(node[property.name], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
case 'array': {
|
||||
let nodePropertyArray = node[property.name]
|
||||
if (nodePropertyArray !== undefined) {
|
||||
for (let m = 0; m < nodePropertyArray.length; m++) {
|
||||
child = getNodeByShortcutKey(nodePropertyArray[m], searchingKey)
|
||||
if (child !== undefined) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user