X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/6ec6461eaba0dfa50a065dac18eb7cc6455cb827..97033d5ba70b7f85b1594deef72bda77e82fe869:/modules/rng/rng.js diff --git a/modules/rng/rng.js b/modules/rng/rng.js index 42c71ec..1ecdc4e 100644 --- a/modules/rng/rng.js +++ b/modules/rng/rng.js @@ -50,26 +50,30 @@ return function(sandbox) { }; var commands = { - highlightDocumentNode: function(canvasNode, origin) { - ['documentCanvas', 'nodeBreadCrumbs', 'nodeFamilyTree'].forEach(function(moduleName) { + highlightDocumentElement: function(element, origin) { + ///'nodeBreadCrumbs', 'nodeFamilyTree' + ['documentCanvas', ].forEach(function(moduleName) { if(!origin || moduleName != origin) - sandbox.getModule(moduleName).highlightNode(canvasNode); + sandbox.getModule(moduleName).highlightElement(element); }); }, - dimDocumentNode: function(canvasNode, origin) { - ['documentCanvas', 'nodeBreadCrumbs', 'nodeFamilyTree'].forEach(function(moduleName) { + dimDocumentElement: function(element, origin) { + //'nodeBreadCrumbs', 'nodeFamilyTree' + ['documentCanvas'].forEach(function(moduleName) { if(!origin || moduleName != origin) - sandbox.getModule(moduleName).dimNode(canvasNode); + sandbox.getModule(moduleName).dimElement(element); }); }, - selectNode: function(canvasNode, origin) { - sandbox.getModule('documentCanvas').selectNode(canvasNode); - this.updateNodesModules(canvasNode); + jumpToDocumentElement: function(element) { + sandbox.getModule('documentCanvas').jumpToElement(element); }, - updateNodesModules: function(canvasNode) { - sandbox.getModule('nodePane').setNode(canvasNode); - sandbox.getModule('nodeFamilyTree').setNode(canvasNode); - sandbox.getModule('nodeBreadCrumbs').setNode(canvasNode); + updateCurrentNodeElement: function(nodeElement) { + sandbox.getModule('nodePane').setNodeElement(nodeElement); + sandbox.getModule('nodeFamilyTree').setElement(nodeElement); + sandbox.getModule('nodeBreadCrumbs').setNodeElement(nodeElement); + }, + updateCurrentTextElement: function(textElement) { + sandbox.getModule('nodeFamilyTree').setElement(textElement); }, resetDocument: function(document, reason) { var modules = []; @@ -193,17 +197,21 @@ return function(sandbox) { dirty.documentCanvas = false; }, - nodeSelected: function(canvasNode) { - commands.selectNode(canvasNode); + currentTextElementSet: function(textElement) { + commands.updateCurrentTextElement(textElement); + }, + + currentNodeElementSet: function(nodeElement) { + commands.updateCurrentNodeElement(nodeElement); }, + currentNodeElementChanged: function(nodeElement) { + commands.updateCurrentNodeElement(nodeElement); + }, + contentChanged: function() { dirty.documentCanvas = true; }, - - currentNodeChanged: function(canvasNode) { - commands.updateNodesModules(canvasNode); - }, nodeHovered: function(canvasNode) { commands.highlightDocumentNode(canvasNode); @@ -219,8 +227,8 @@ return function(sandbox) { views.currentNodePaneLayout.appendView(sandbox.getModule('nodePane').getView()); }, - nodeChanged: function(attr, value) { - sandbox.getModule('documentCanvas').modifyCurrentNode(attr, value); + nodeElementChange: function(attr, value) { + sandbox.getModule('documentCanvas').modifyCurrentNodeElement(attr, value); } }; @@ -241,14 +249,14 @@ return function(sandbox) { ready: function() { views.currentNodePaneLayout.appendView(sandbox.getModule('nodeFamilyTree').getView()); }, - nodeEntered: function(canvasNode) { - commands.highlightDocumentNode(canvasNode, 'nodeFamilyTree'); + elementEntered: function(element) { + commands.highlightDocumentElement(element, 'nodeFamilyTree'); }, - nodeLeft: function(canvasNode) { - commands.dimDocumentNode(canvasNode, 'nodeFamilyTree'); + elementLeft: function(element) { + commands.dimDocumentElement(element, 'nodeFamilyTree'); }, - nodeSelected: function(canvasNode) { - commands.selectNode(canvasNode); + elementClicked: function(element) { + commands.jumpToDocumentElement(element); } }; @@ -256,17 +264,8 @@ return function(sandbox) { ready: function() { views.visualEditing.setView('toolbar', sandbox.getModule('documentToolbar').getView()); }, - toggleGrid: function(toggle) { - sandbox.getModule('documentCanvas').toggleGrid(toggle); - }, - toggleList: function(toggle) { - sandbox.getModule('documentCanvas').toggleList(toggle); - }, - newNodeRequested: function(wlxmlTag, wlxmlClass) { - sandbox.getModule('documentCanvas').insertNewNode(wlxmlTag, wlxmlClass); - }, - command: function(cmd, meta) { - sandbox.getModule('documentCanvas').command(cmd, meta); + command: function(cmd, params) { + sandbox.getModule('documentCanvas').command(cmd, params); } }; @@ -274,14 +273,14 @@ return function(sandbox) { ready: function() { views.visualEditing.setView('statusBar', sandbox.getModule('nodeBreadCrumbs').getView()); }, - nodeHighlighted: function(canvasNode) { - commands.highlightDocumentNode(canvasNode, 'nodeBreadCrumbs'); + elementEntered: function(element) { + commands.highlightDocumentElement(element, 'nodeBreadCrumbs'); }, - nodeDimmed: function(canvasNode) { - commands.dimDocumentNode(canvasNode, 'nodeBreadCrumbs'); + elementLeft: function(element) { + commands.dimDocumentElement(element, 'nodeBreadCrumbs'); }, - nodeSelected: function(canvasNode) { - commands.selectNode(canvasNode); + elementClicked: function(element) { + commands.jumpToDocumentElement(element); } };