fnp
/
fnpeditor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e923d17
)
Refactor
author
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 11 Jun 2013 09:56:27 +0000
(11:56 +0200)
committer
Aleksander Łukasz
<aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 11 Jun 2013 09:56:27 +0000
(11:56 +0200)
modules/documentCanvas/documentCanvas.js
patch
|
blob
|
history
modules/documentCanvas/wlxmlNode.js
patch
|
blob
|
history
modules/nodeBreadCrumbs/nodeBreadCrumbs.js
patch
|
blob
|
history
modules/nodeFamilyTree/nodeFamilyTree.js
patch
|
blob
|
history
modules/rng/rng.js
patch
|
blob
|
history
diff --git
a/modules/documentCanvas/documentCanvas.js
b/modules/documentCanvas/documentCanvas.js
index
05fbcdd
..
8f3a3c6
100644
(file)
--- a/
modules/documentCanvas/documentCanvas.js
+++ b/
modules/documentCanvas/documentCanvas.js
@@
-245,7
+245,8
@@
return function(sandbox) {
view.dimNode(wlxmlNode);
\r
},
\r
selectNode: function(wlxmlNode) {
\r
view.dimNode(wlxmlNode);
\r
},
\r
selectNode: function(wlxmlNode) {
\r
- view.selectNode(wlxmlNode, {moveCarret: true});
\r
+ if(!wlxmlNode.is(view.currentNode))
\r
+ view.selectNode(wlxmlNode, {moveCarret: true});
\r
},
\r
toggleGrid: function(toggle) {
\r
view.toggleGrid(toggle);
\r
},
\r
toggleGrid: function(toggle) {
\r
view.toggleGrid(toggle);
\r
diff --git
a/modules/documentCanvas/wlxmlNode.js
b/modules/documentCanvas/wlxmlNode.js
index
f5ada52
..
6bd0c35
100644
(file)
--- a/
modules/documentCanvas/wlxmlNode.js
+++ b/
modules/documentCanvas/wlxmlNode.js
@@
-29,6
+29,9
@@
var Node = function(domNode) {
list.push(new Node($(this)));
\r
});
\r
return $(list);
\r
list.push(new Node($(this)));
\r
});
\r
return $(list);
\r
+ },
\r
+ is: function(wlxmlNode) {
\r
+ return wlxmlNode && (wlxmlNode.id === this.id);
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
diff --git
a/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
b/modules/nodeBreadCrumbs/nodeBreadCrumbs.js
index
cefe7b4
..
517f45b
100644
(file)
--- a/
modules/nodeBreadCrumbs/nodeBreadCrumbs.js
+++ b/
modules/nodeBreadCrumbs/nodeBreadCrumbs.js
@@
-31,6
+31,7
@@
return function(sandbox) {
setNode: function(node) {
\r
this.dom.empty();
\r
var nodes = this.nodes = {};
\r
setNode: function(node) {
\r
this.dom.empty();
\r
var nodes = this.nodes = {};
\r
+ this.currentNode = node;
\r
this.nodes[node.id] = node;
\r
var parents = node.parents();
\r
parents.each(function() {
\r
this.nodes[node.id] = node;
\r
var parents = node.parents();
\r
parents.each(function() {
\r
@@
-53,7
+54,11
@@
return function(sandbox) {
return {
\r
start: function() { sandbox.publish('ready'); },
\r
getView: function() { return view.dom; },
\r
return {
\r
start: function() { sandbox.publish('ready'); },
\r
getView: function() { return view.dom; },
\r
- setNode: function(node) { view.setNode(node); },
\r
+ setNode: function(wlxmlNode) {
\r
+ if(!wlxmlNode.is(view.currentNode)) {
\r
+ view.setNode(wlxmlNode);
\r
+ }
\r
+ },
\r
highlightNode: function(id) { view.highlightNode(id); },
\r
dimNode: function(id) { view.dimNode(id); }
\r
}
\r
highlightNode: function(id) { view.highlightNode(id); },
\r
dimNode: function(id) { view.dimNode(id); }
\r
}
\r
diff --git
a/modules/nodeFamilyTree/nodeFamilyTree.js
b/modules/nodeFamilyTree/nodeFamilyTree.js
index
3c78bd1
..
7415b2d
100644
(file)
--- a/
modules/nodeFamilyTree/nodeFamilyTree.js
+++ b/
modules/nodeFamilyTree/nodeFamilyTree.js
@@
-31,6
+31,7
@@
return function(sandbox) {
setNode: function(node) {
\r
console.log('familyTree sets node');
\r
var nodes = this.nodes = {};
\r
setNode: function(node) {
\r
console.log('familyTree sets node');
\r
var nodes = this.nodes = {};
\r
+ this.currentNode = node;
\r
var parentNode = node.parent();
\r
var parent = undefined;
\r
\r
var parentNode = node.parent();
\r
var parent = undefined;
\r
\r
@@
-65,8
+66,9
@@
return function(sandbox) {
start: function() {
\r
sandbox.publish('ready');
\r
},
\r
start: function() {
\r
sandbox.publish('ready');
\r
},
\r
- setNode: function(node) {
\r
- view.setNode(node);
\r
+ setNode: function(wlxmlNode) {
\r
+ if(!wlxmlNode.is(view.currentNode))
\r
+ view.setNode(wlxmlNode);
\r
},
\r
getView: function() {
\r
return view.dom;
\r
},
\r
getView: function() {
\r
return view.dom;
\r
diff --git
a/modules/rng/rng.js
b/modules/rng/rng.js
index
5edc7ac
..
6f65c19
100644
(file)
--- a/
modules/rng/rng.js
+++ b/
modules/rng/rng.js
@@
-25,6
+25,13
@@
return function(sandbox) {
if(!origin || moduleName != origin)
\r
sandbox.getModule(moduleName).dimNode(wlxmlNode)
\r
});
\r
if(!origin || moduleName != origin)
\r
sandbox.getModule(moduleName).dimNode(wlxmlNode)
\r
});
\r
+ },
\r
+ selectNode: function(wlxmlNode, origin) {
\r
+ sandbox.getModule('documentCanvas').selectNode(wlxmlNode);
\r
+ sandbox.getModule('nodePane').setNode(wlxmlNode);
\r
+ sandbox.getModule('nodeFamilyTree').setNode(wlxmlNode);
\r
+ sandbox.getModule('nodeBreadCrumbs').setNode(wlxmlNode);
\r
+
\r
}
\r
}
\r
\r
}
\r
}
\r
\r
@@
-101,10
+108,8
@@
return function(sandbox) {
views.visualEditing.setView('leftColumn', sandbox.getModule('documentCanvas').getView());
\r
},
\r
\r
views.visualEditing.setView('leftColumn', sandbox.getModule('documentCanvas').getView());
\r
},
\r
\r
- nodeSelected: function(node) {
\r
- sandbox.getModule('nodePane').setNode(node);
\r
- sandbox.getModule('nodeFamilyTree').setNode(node);
\r
- sandbox.getModule('nodeBreadCrumbs').setNode(node);
\r
+ nodeSelected: function(wlxmlNode) {
\r
+ commands.selectNode(wlxmlNode);
\r
},
\r
\r
contentChanged: function() {
\r
},
\r
\r
contentChanged: function() {
\r
@@
-148,7
+153,7
@@
return function(sandbox) {
commands.dimDocumentNode(wlxmlNode, 'nodeFamilyTree');
\r
},
\r
nodeSelected: function(wlxmlNode) {
\r
commands.dimDocumentNode(wlxmlNode, 'nodeFamilyTree');
\r
},
\r
nodeSelected: function(wlxmlNode) {
\r
-
sandbox.getModule('documentCanvas')
.selectNode(wlxmlNode);
\r
+
commands
.selectNode(wlxmlNode);
\r
}
\r
};
\r
\r
}
\r
};
\r
\r
@@
-179,7
+184,7
@@
return function(sandbox) {
commands.dimDocumentNode(wlxmlNode, 'nodeBreadCrumbs');
\r
},
\r
nodeSelected: function(wlxmlNode) {
\r
commands.dimDocumentNode(wlxmlNode, 'nodeBreadCrumbs');
\r
},
\r
nodeSelected: function(wlxmlNode) {
\r
-
sandbox.getModule('documentCanvas')
.selectNode(wlxmlNode);
\r
+
commands
.selectNode(wlxmlNode);
\r
}
\r
}
\r
\r
}
\r
}
\r
\r