add hide_nodes option to allow or node the hiding behavior on nodes
- rescale node buttons if no hide/show button
- hide the show-all-hidden-nodes button
- prevent from hidding node when loading a view
- add new test template to try the new options
--- a/client/js/defaults.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/defaults.js Thu Jun 18 16:50:54 2015 +0200
@@ -114,6 +114,8 @@
/* Maximum displayed text length */
label_untitled_nodes: "(untitled)",
/* Label to display on untitled nodes */
+ hide_nodes: true,
+ /* allow hide/show nodes */
change_shapes: true,
/* Change shapes enabled */
change_types: true,
--- a/client/js/renderer/nodeeditbutton.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/nodeeditbutton.js Thu Jun 18 16:50:54 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-edit-button";
this.lastSectorInner = 0;
- this.startAngle = -125;
- this.endAngle = -55;
+ this.startAngle = this.options.hide_nodes ? -125 : -135;
+ this.endAngle = this.options.hide_nodes ? -55 : -45;
this.imageName = "edit";
this.text = "Edit";
},
--- a/client/js/renderer/nodeenlargebutton.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/nodeenlargebutton.js Thu Jun 18 16:50:54 2015 +0200
@@ -14,8 +14,8 @@
_init: function() {
this.type = "Node-enlarge-button";
this.lastSectorInner = 0;
- this.startAngle = -55;
- this.endAngle = -10;
+ this.startAngle = this.options.hide_nodes ? -55 : -45;
+ this.endAngle = this.options.hide_nodes ? -10 : 0;
this.imageName = "enlarge";
this.text = "Enlarge";
},
--- a/client/js/renderer/nodelinkbutton.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/nodelinkbutton.js Thu Jun 18 16:50:54 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-link-button";
this.lastSectorInner = 0;
- this.startAngle = 135;
- this.endAngle = 190;
+ this.startAngle = this.options.hide_nodes ? 135 : 90;
+ this.endAngle = this.options.hide_nodes ? 190 : 180;
this.imageName = "link";
this.text = "Link to another node";
},
--- a/client/js/renderer/noderemovebutton.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/noderemovebutton.js Thu Jun 18 16:50:54 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-remove-button";
this.lastSectorInner = 0;
- this.startAngle = -10;
- this.endAngle = 45;
+ this.startAngle = this.options.hide_nodes ? -10 : 0;
+ this.endAngle = this.options.hide_nodes ? 45 : 90;
this.imageName = "remove";
this.text = "Remove";
},
--- a/client/js/renderer/noderepr.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/noderepr.js Thu Jun 18 16:50:54 2015 +0200
@@ -32,12 +32,16 @@
this.normal_buttons = [
new Renderer.NodeEditButton(this.renderer, null),
new Renderer.NodeRemoveButton(this.renderer, null),
- new Renderer.NodeHideButton(this.renderer, null),
- new Renderer.NodeShowButton(this.renderer, null),
new Renderer.NodeLinkButton(this.renderer, null),
new Renderer.NodeEnlargeButton(this.renderer, null),
new Renderer.NodeShrinkButton(this.renderer, null)
];
+ if (this.options.hide_nodes){
+ this.normal_buttons.push(
+ new Renderer.NodeHideButton(this.renderer, null),
+ new Renderer.NodeShowButton(this.renderer, null)
+ );
+ }
this.pending_delete_buttons = [
new Renderer.NodeRevertButton(this.renderer, null)
];
--- a/client/js/renderer/nodeshrinkbutton.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/nodeshrinkbutton.js Thu Jun 18 16:50:54 2015 +0200
@@ -13,8 +13,8 @@
_init: function() {
this.type = "Node-shrink-button";
this.lastSectorInner = 0;
- this.startAngle = -170;
- this.endAngle = -125;
+ this.startAngle = this.options.hide_nodes ? -170 : -180;
+ this.endAngle = this.options.hide_nodes ? -125 : -135;
this.imageName = "shrink";
this.text = "Shrink";
},
--- a/client/js/renderer/scene.js Thu Jun 18 16:25:21 2015 +0200
+++ b/client/js/renderer/scene.js Thu Jun 18 16:50:54 2015 +0200
@@ -246,8 +246,10 @@
if(view){
_this.showNodes(false);
_this.setScale(view.get("zoom_level"), new paper.Point(view.get("offset")));
- _this.hiddenNodes = (view.get("hidden_nodes") || []).concat();
- _this.hideNodes();
+ if (_this.renkan.options.hide_nodes){
+ _this.hiddenNodes = (view.get("hidden_nodes") || []).concat();
+ _this.hideNodes();
+ }
}
});
this.$.find(".Rk-ShowHiddenNodes").mouseenter( function() {
--- a/client/templates/scene.html Thu Jun 18 16:25:21 2015 +0200
+++ b/client/templates/scene.html Thu Jun 18 16:50:54 2015 +0200
@@ -145,7 +145,9 @@
<% } %>
<% if (options.save_view) { %>
<div class="Rk-ZoomSetSaved" title="<%-translate('View saved view')%>"></div>
- <div class="Rk-ShowHiddenNodes" title="<%-translate('Show hidden nodes')%>"></div>
+ <% if (options.hide_nodes) { %>
+ <div class="Rk-ShowHiddenNodes" title="<%-translate('Show hidden nodes')%>"></div>
+ <% } %>
<% } %>
</div>
<% } %>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/client/test/test-writable-simple-no-hide.html Thu Jun 18 16:50:54 2015 +0200
@@ -0,0 +1,49 @@
+<!DOCTYPE html>
+<html lang="fr">
+ <head>
+ <meta charset="utf-8" />
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
+ <title>Test de Rendu RENKAN</title>
+ <meta name="description" content="" />
+ <meta name="author" content="Institut de Recherche et d'Innovation" />
+ <script src="../lib/jquery/jquery.js"></script>
+ <script src="../lib/jquery-mousewheel/jquery.mousewheel.js"></script>
+ <script src="../lib/lodash/lodash.js"></script>
+ <script src="../lib/backbone/backbone.js"></script>
+ <script src="../lib/backbone-relational/backbone-relational.js"></script>
+ <script src="../lib/paper/paper-full.js"></script>
+ <script src="../js/main.js"></script>
+ <script src="../js/dataloader.js"></script>
+ <script src="../js/router.js"></script>
+ <script src="../js/models.js"></script>
+ <script src="../js/defaults.js"></script>
+ <script src="../js/i18n.js"></script>
+ <script src="../dist/js/templates.js"></script>
+ <script src="../js/full-json.js"></script>
+ <script src="../js/ldtjson-bin.js"></script>
+ <script src="../js/list-bin.js"></script>
+ <script src="../js/wikipedia-bin.js"></script>
+ <script data-main="../js/main-renderer" src="../lib/requirejs/require.js"></script>
+ <script type="text/javascript">
+ function startRenkan(){
+ var _renkan = new Rkns.Renkan({
+ property_files: [ "../data/properties.json" ],
+ hide_nodes: false,
+ /*user_id: "u-iri",
+ language: "fr",
+ node_fill_color: false*/
+ show_bins: false,
+ static_url: "../"
+ });
+ Rkns.jsonIO(_renkan, {
+ url: "/simple-persist"
+ });
+ };
+ </script>
+ <link rel="stylesheet" href="../css/renkan.css" />
+ </head>
+
+ <body>
+ <div id="renkan"></div>
+ </body>
+</html>