Added Cinecard template
authorveltr
Thu, 04 Apr 2013 15:45:09 +0200
changeset 6 92160118bd31
parent 5 a01b1649c26d
child 7 84f000d09bd4
Added Cinecard template
integ/img/stickers/pourquoi-j-ai-aime.png
integ/img/stickers/pourquoi-le-voir.png
integ/img/stickers/secrets-et-bonus.png
integ/iri-creation-cinecard.html
integ/js/iri.js
integ/renkan/img/enlarge.png
integ/renkan/img/shrink.png
integ/renkan/js/defaults.js
integ/renkan/js/i18n.js
integ/renkan/js/main.js
integ/renkan/js/paper-renderer.js
Binary file integ/img/stickers/pourquoi-j-ai-aime.png has changed
Binary file integ/img/stickers/pourquoi-le-voir.png has changed
Binary file integ/img/stickers/secrets-et-bonus.png has changed
--- a/integ/iri-creation-cinecard.html	Wed Apr 03 19:02:12 2013 +0200
+++ b/integ/iri-creation-cinecard.html	Thu Apr 04 15:45:09 2013 +0200
@@ -194,6 +194,52 @@
 <script src="renkan/js/i18n.js"></script>
 <script src="renkan/js/paper-renderer.js"></script>
 <script>
+	var _renkan, _posterData;
+	
+	function showRenkanPoster() {
+		if (_renkan && _posterData) {
+			var _posterProps = {
+					position: {
+						x: 0,
+						y: 0
+					},
+					description: "Affiche du film",
+					size: 4
+				},
+				_stickers = [
+					"img/stickers/pourquoi-j-ai-aime.png",
+					"img/stickers/pourquoi-le-voir.png",
+					"img/stickers/secrets-et-bonus.png"
+				],
+				_stickerDistance = 220,
+				_filmNode = _renkan.project.addNode(_(_posterData).extend(_posterProps));
+				
+			_(_stickers).each(function(v, k) {
+				var _a = 2 * Math.PI * k / _stickers.length,
+					_stickerData = {
+						title: " ",
+						position: {
+							x: - _stickerDistance * Math.cos(_a),
+							y: _stickerDistance * Math.sin(_a)
+						},
+						image: v,
+						size: 0
+					}
+				_stickerNode = _renkan.project.addNode(_stickerData);
+				var _edgeData = {
+					from: _filmNode,
+					to: _stickerNode
+				}
+				_renkan.project.addEdge(_edgeData);
+			});
+		}
+	}
+	
+	function setRenkanPoster(_data) {
+		_posterData = _data;
+		showRenkanPoster();
+	}
+	
 	$(function() {
         _renkan = new Rkns.Renkan({
             user_id: "u-iri",
@@ -204,9 +250,11 @@
             show_minimap: false,
             show_node_circles: false,
             clip_node_images: false,
+            node_size_base: 40,
             default_user_color: "#808080",
             static_url: "renkan/"
         });
+		showRenkanPoster();
 	});
 </script>
 
--- a/integ/js/iri.js	Wed Apr 03 19:02:12 2013 +0200
+++ b/integ/js/iri.js	Thu Apr 04 15:45:09 2013 +0200
@@ -60,6 +60,13 @@
 		$('#stars-more').append(itemStar);
 	});	
 
+	/* Initializing Renkan */
+	
+	setRenkanPoster({
+		title: movie.title,
+		image: movie.poster.href,
+		uri: _(movie.link).find(function(l) { return l.rel === "aco:web" }).href
+	});
 
 
 });
Binary file integ/renkan/img/enlarge.png has changed
Binary file integ/renkan/img/shrink.png has changed
--- a/integ/renkan/js/defaults.js	Wed Apr 03 19:02:12 2013 +0200
+++ b/integ/renkan/js/defaults.js	Thu Apr 04 15:45:09 2013 +0200
@@ -22,6 +22,7 @@
     	/* In snapshot mode, clicking on the floppy will save a snapshot. Otherwise, it will show the connection status */
 	show_top_bar: true,
 		/* Show the top bar, (title, buttons, users) */
+	default_user_color: "#303030",
 	
 	/* MINI-MAP OPTIONS */
 	
@@ -46,6 +47,7 @@
     	/* Show circles for nodes */
 	clip_node_images: true,
 		/* Constraint node images to circles */
+	node_size_base: 25,
 	node_stroke_width: 2,
 	selected_node_stroke_width: 4,
 	node_fill_color: "#ffffff",
--- a/integ/renkan/js/i18n.js	Wed Apr 03 19:02:12 2013 +0200
+++ b/integ/renkan/js/i18n.js	Thu Apr 04 15:45:09 2013 +0200
@@ -22,6 +22,8 @@
         "Edit": "Éditer",
         "Remove": "Supprimer",
         "Link to another node": "Créer un lien",
+        "Enlarge": "Agrandir",
+        "Shrink": "Rétrécir",
         "Click on the background canvas to add a node": "Cliquer sur le fond du graphe pour rajouter un nœud",
         "Click on a first node to start the edge": "Cliquer sur un premier nœud pour commencer le lien",
         "Click on a second node to complete the edge": "Cliquer sur un second nœud pour terminer le lien",
--- a/integ/renkan/js/main.js	Wed Apr 03 19:02:12 2013 +0200
+++ b/integ/renkan/js/main.js	Thu Apr 04 15:45:09 2013 +0200
@@ -288,6 +288,13 @@
         }
         return _base + this._ID_BASE + '-' + _n;
     },
+    getFullURL : function(url) {
+    	var img = new Image();
+    	img.src = url;
+    	var res = img.src;
+    	img.src = null;
+    	return res;
+    },
     inherit : function(_baseClass, _callbefore) {
         var _class = function() {
             if (typeof _callbefore === "function") {
--- a/integ/renkan/js/paper-renderer.js	Wed Apr 03 19:02:12 2013 +0200
+++ b/integ/renkan/js/paper-renderer.js	Thu Apr 04 15:45:09 2013 +0200
@@ -1,7 +1,6 @@
 Rkns.Renderer = {
     _MINIMAP_MARGIN: 20,
     _MIN_DRAG_DISTANCE: 2,
-    _NODE_SIZE_BASE: 25,
     _NODE_BUTTON_WIDTH: 40,
     _EDGE_BUTTON_INNER: 2,
     _EDGE_BUTTON_OUTER: 40,
@@ -82,9 +81,6 @@
             _endRads = _endAngle * Math.PI / 180,
             _img = new Image(),
             _span = _endRads - _startRads,
-            _k = .0879 * _span,
-            _kin = _k * _inR,
-            _kout = _k * _outR,
             _startdx = - Math.sin(_startRads),
             _startdy = Math.cos(_startRads),
             _startXIn = Math.cos(_startRads) * _inR + _padding * _startdx,
@@ -106,7 +102,7 @@
             _centerYIn = Math.sin(_centerRads) * _inR,
             _centerYOut = Math.sin(_centerRads) * _outR,
             _textX = Math.cos(_centerRads) * (_outR + 3),
-            _textY = Math.sin(_centerRads) * (_outR + 3),
+            _textY = Math.sin(_centerRads) * (_outR + _options.buttons_label_font_size) + _options.buttons_label_font_size / 2,
             _segments = [];
     	_repr.renderer.buttons_layer.activate();
         var _path = new paper.Path();
@@ -118,11 +114,6 @@
         _path.opacity = .5;
         _path.closed = true;
         _path.__representation = _repr;
-        if (_textX >= -2 && _textX <= 2) {
-            if (_textY > 0) {
-                _textY += 6;
-            }
-        }
         var _text = new paper.PointText(_textX,_textY);
         _text.characterStyle = {
             fontSize: _options.buttons_label_font_size,
@@ -238,6 +229,39 @@
     }
 }
 
+/* */
+
+Rkns.Renderer._BaseButton = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
+
+Rkns.Renderer._BaseButton.prototype.moveTo = function(_pos) {
+    this.sector.moveTo(_pos);
+}
+
+Rkns.Renderer._BaseButton.prototype.show = function() {
+    this.sector.show();
+}
+
+Rkns.Renderer._BaseButton.prototype.hide = function() {
+    this.sector.hide();
+}
+
+Rkns.Renderer._BaseButton.prototype.select = function() {
+    this.sector.select();
+}
+
+Rkns.Renderer._BaseButton.prototype.unselect = function(_newTarget) {
+    this.sector.unselect();
+    if (!_newTarget || (_newTarget !== this.source_representation && _newTarget.source_representation !== this.source_representation)) {
+        this.source_representation.unselect();
+    }
+}
+
+Rkns.Renderer._BaseButton.prototype.destroy = function() {
+    this.sector.destroy();
+}
+
+/* */
+
 Rkns.Renderer.Node = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
 
 Rkns.Renderer.Node.prototype._init = function() {
@@ -260,12 +284,18 @@
         fillColor: this.options.node_label_color
     };
     if (this.options.editor_mode) {
-        this.edit_button = new Rkns.Renderer.NodeEditButton(this.renderer, null);
-        this.edit_button.node_representation = this;
-        this.remove_button = new Rkns.Renderer.NodeRemoveButton(this.renderer, null);
-        this.remove_button.node_representation = this;
-        this.link_button = new Rkns.Renderer.NodeLinkButton(this.renderer, null);
-        this.link_button.node_representation = this;
+    	this.buttons = [
+    		new Rkns.Renderer.NodeEditButton(this.renderer, null),
+    		new Rkns.Renderer.NodeRemoveButton(this.renderer, null),
+    		new Rkns.Renderer.NodeLinkButton(this.renderer, null),
+    		new Rkns.Renderer.NodeEnlargeButton(this.renderer, null),
+    		new Rkns.Renderer.NodeShrinkButton(this.renderer, null)
+    	];
+    	for (var i = 0; i < this.buttons.length; i++) {
+    		this.buttons[i].source_representation = this;
+    	}
+    } else {
+    	this.buttons = [];
     }
     this.last_circle_radius = 1;
     this.title.paragraphStyle.justification = 'center';
@@ -279,17 +309,15 @@
 
 Rkns.Renderer.Node.prototype.redraw = function(_dontRedrawEdges) {
     var _model_coords = new paper.Point(this.model.get("position")),
-    	_baseRadius = Rkns.Renderer._NODE_SIZE_BASE * Math.exp((this.model.get("size") || 0) * Rkns.Renderer._NODE_SIZE_STEP);
+    	_baseRadius = this.options.node_size_base * Math.exp((this.model.get("size") || 0) * Rkns.Renderer._NODE_SIZE_STEP);
     if (!this.is_dragging || !this.paper_coords) {
         this.paper_coords = this.renderer.toPaperCoords(_model_coords);
     }
     this.circle_radius = _baseRadius * this.renderer.scale;
     if (this.last_circle_radius !== this.circle_radius) {
-    	if (this.options.editor_mode) {
-	    	this.edit_button.setSectorSize();
-	    	this.remove_button.setSectorSize();
-	    	this.link_button.setSectorSize();
-	    }
+    	this.buttons.forEach(function(b) {
+    		b.setSectorSize();
+    	});
 	    var square = new paper.Size(this.circle_radius, this.circle_radius),
 	    	topleft = this.paper_coords.subtract(square),
 	    	bounds = new paper.Rectangle(topleft, square.multiply(2));
@@ -314,11 +342,10 @@
 	]);
     var _color = this.model.get("color") || (this.model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(this.renkan)).get("color");
     this.circle.strokeColor = _color;
-    if (this.options.editor_mode) {
-    	this.edit_button.moveTo(this.paper_coords);
-	    this.remove_button.moveTo(this.paper_coords);
-	    this.link_button.moveTo(this.paper_coords);
-    }
+    var _pc = this.paper_coords;
+	this.buttons.forEach(function(b) {
+		b.moveTo(_pc);
+	});
     var _img = this.model.get("image");
     if (_img && _img !== this.img) {
         var _image = new Image(),
@@ -352,6 +379,7 @@
 		    	bounds = new paper.Rectangle(topleft, square.multiply(2));
 		    _this.node_image.fitBounds(bounds);
             _this.redraw();
+    		paper.view.draw();
         }
         _image.src = _img;
     }
@@ -395,16 +423,16 @@
 Rkns.Renderer.Node.prototype.openEditor = function() {
     this.renderer.removeRepresentationsOfType("editor");
     var _editor = this.renderer.addRepresentation("NodeEditor",null);
-    _editor.node_representation = this;
+    _editor.source_representation = this;
     _editor.draw();
 }
 
 Rkns.Renderer.Node.prototype.select = function() {
     this.circle.strokeWidth = this.options.selected_node_stroke_width;
     if (this.renderer.isEditable()) {
-	    this.edit_button.show();
-	    this.remove_button.show();
-	    this.link_button.show();
+    	this.buttons.forEach(function(b) {
+    		b.show();
+    	});
     }
     var _uri = this.model.get("uri");
     if (_uri) {
@@ -426,12 +454,10 @@
 }
 
 Rkns.Renderer.Node.prototype.unselect = function(_newTarget) {
-    if (!_newTarget || _newTarget.node_representation !== this) {
-	    if (this.options.editor_mode) {
-	        this.edit_button.hide();
-	        this.remove_button.hide();
-	        this.link_button.hide();
-	   	}
+    if (!_newTarget || _newTarget.source_representation !== this) {
+    	this.buttons.forEach(function(b) {
+    		b.hide();
+    	});
     	this.circle.strokeWidth = this.options.node_stroke_width;
         Rkns.$('.Rk-Bin-Item').removeClass("selected");
     	if (this.renderer.minimap) {
@@ -481,11 +507,9 @@
 
 Rkns.Renderer.Node.prototype.destroy = function(_event) {
     this.super("destroy");
-    if (this.options.editor_mode) {
-	    this.edit_button.destroy();
-	    this.remove_button.destroy();
-	    this.link_button.destroy();
-    }
+	this.buttons.forEach(function(b) {
+		b.destroy();
+	});
     this.circle.remove();
     this.title.remove();
     if (this.renderer.minimap) {
@@ -528,9 +552,9 @@
     this.arrow_angle = 0;
     if (this.options.editor_mode) {
         this.edit_button = new Rkns.Renderer.EdgeEditButton(this.renderer, null);
-        this.edit_button.edge_representation = this;
+        this.edit_button.source_representation = this;
         this.remove_button = new Rkns.Renderer.EdgeRemoveButton(this.renderer, null);
-        this.remove_button.edge_representation = this;
+        this.remove_button.source_representation = this;
     }
     
     if (this.renderer.minimap) {
@@ -600,7 +624,7 @@
 Rkns.Renderer.Edge.prototype.openEditor = function() {
     this.renderer.removeRepresentationsOfType("editor");
     var _editor = this.renderer.addRepresentation("EdgeEditor",null);
-    _editor.edge_representation = this;
+    _editor.source_representation = this;
     _editor.draw();
 }
 
@@ -616,7 +640,7 @@
 }
 
 Rkns.Renderer.Edge.prototype.unselect = function(_newTarget) {
-    if (!_newTarget || _newTarget.edge_representation !== this) {
+    if (!_newTarget || _newTarget.source_representation !== this) {
     	if (this.options.editor_mode) {
 	        this.edit_button.hide();
 	        this.remove_button.hide();
@@ -732,7 +756,7 @@
             	this.project.addEdge(_data);
             }
         }
-        if (_model === _target.model || (_target.node_representation && _target.node_representation.model === _model)) {
+        if (_model === _target.model || (_target.source_representation && _target.source_representation.model === _model)) {
             _endDrag = false;
             this.renderer.is_dragging = true;
         }
@@ -795,7 +819,7 @@
 );
 
 Rkns.Renderer.NodeEditor.prototype.draw = function() {
-    var _model = this.node_representation.model,
+    var _model = this.source_representation.model,
         _created_by = _model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(this.renkan),
         _template = (this.renderer.isEditable() ? this.template : this.readOnlyTemplate ),
         _image_placeholder = this.options.static_url + "img/image-placeholder.png",
@@ -914,8 +938,8 @@
 }
 
 Rkns.Renderer.NodeEditor.prototype.redraw = function() {
-    var _coords = this.node_representation.paper_coords;
-    Rkns.Renderer.Utils.drawEditBox(this.options, _coords, this.editor_block, this.node_representation.circle_radius * .75, this.editor_$);
+    var _coords = this.source_representation.paper_coords;
+    Rkns.Renderer.Utils.drawEditBox(this.options, _coords, this.editor_block, this.source_representation.circle_radius * .75, this.editor_$);
     this.editor_$.show();
     paper.view.draw();
 }
@@ -975,7 +999,7 @@
 );
 
 Rkns.Renderer.EdgeEditor.prototype.draw = function() {
-    var _model = this.edge_representation.model,
+    var _model = this.source_representation.model,
         _from_model = _model.get("from"),
         _to_model = _model.get("to"),
         _created_by = _model.get("created_by") || Rkns.Renderer._USER_PLACEHOLDER(this.renkan),
@@ -1065,7 +1089,7 @@
 }
 
 Rkns.Renderer.EdgeEditor.prototype.redraw = function() {
-    var _coords = this.edge_representation.paper_coords;
+    var _coords = this.source_representation.paper_coords;
     Rkns.Renderer.Utils.drawEditBox(this.options, _coords, this.editor_block, 5, this.editor_$);
     this.editor_$.show();
     paper.view.draw();
@@ -1078,242 +1102,152 @@
 
 /* */
 
-Rkns.Renderer.NodeEditButton = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
+Rkns.Renderer._NodeButton = Rkns.Utils.inherit(Rkns.Renderer._BaseButton);
 
-Rkns.Renderer.NodeEditButton.prototype._init = function() {
-    this.type = "Node-edit-button";
-    this.lastSectorInner = 0;
-}
-
-Rkns.Renderer.NodeEditButton.prototype.setSectorSize = function() {
-	var sectorInner = this.node_representation.circle_radius;
+Rkns.Renderer._NodeButton.prototype.setSectorSize = function() {
+	var sectorInner = this.source_representation.circle_radius;
 	if (sectorInner !== this.lastSectorInner) {
 		if (this.sector) {
 			this.sector.destroy();
 		}
-		this.sector = Rkns.Renderer.Utils.sector(this, 1 + sectorInner, Rkns.Renderer._NODE_BUTTON_WIDTH + sectorInner, - 90, 30, 1, this.options.static_url+'img/edit.png', this.renkan.translate("Edit"));
-		this.lastSectorInner = sectorInner;
-	}
-}
-
-Rkns.Renderer.NodeEditButton.prototype.moveTo = function(_pos) {
-    this.sector.moveTo(_pos);
-}
-
-Rkns.Renderer.NodeEditButton.prototype.show = function() {
-    this.sector.show();
-}
-
-Rkns.Renderer.NodeEditButton.prototype.hide = function() {
-    this.sector.hide();
-}
-
-Rkns.Renderer.NodeEditButton.prototype.select = function() {
-    this.sector.select();
-}
-
-Rkns.Renderer.NodeEditButton.prototype.unselect = function(_newTarget) {
-    this.sector.unselect();
-    if (!_newTarget || (_newTarget !== this.node_representation && _newTarget.node_representation !== this.node_representation)) {
-        this.node_representation.unselect();
-    }
-}
-
-Rkns.Renderer.NodeEditButton.prototype.mouseup = function() {
-    if (!this.renderer.is_dragging) {
-        this.node_representation.openEditor();
-    }
-}
-
-Rkns.Renderer.NodeEditButton.prototype.destroy = function() {
-    this.sector.destroy();
-}
-
-/* */
-
-Rkns.Renderer.NodeRemoveButton = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
-
-Rkns.Renderer.NodeRemoveButton.prototype._init = function() {
-    this.type = "Node-remove-button";
-    this.lastSectorInner = 0;
-}
-
-Rkns.Renderer.NodeRemoveButton.prototype.setSectorSize = function() {
-	var sectorInner = this.node_representation.circle_radius;
-	if (sectorInner !== this.lastSectorInner) {
-		if (this.sector) {
-			this.sector.destroy();
-		}
-		this.sector = Rkns.Renderer.Utils.sector(this, 1 + sectorInner, Rkns.Renderer._NODE_BUTTON_WIDTH + sectorInner, - 210, - 90, 1, this.options.static_url+'img/remove.png', this.renkan.translate("Remove"));
+		this.sector = Rkns.Renderer.Utils.sector(
+			this, 1 + sectorInner,
+			Rkns.Renderer._NODE_BUTTON_WIDTH + sectorInner,
+			this.startAngle,
+			this.endAngle,
+			1,
+			this.options.static_url + this.imageFile,
+			this.renkan.translate(this.text)
+		);
 		this.lastSectorInner = sectorInner;
 	}
 }
 
-Rkns.Renderer.NodeRemoveButton.prototype.moveTo = function(_pos) {
-    this.sector.moveTo(_pos);
-}
+/* */
+
+Rkns.Renderer.NodeEditButton = Rkns.Utils.inherit(Rkns.Renderer._NodeButton);
 
-Rkns.Renderer.NodeRemoveButton.prototype.show = function() {
-    this.sector.show();
+Rkns.Renderer.NodeEditButton.prototype._init = function() {
+    this.type = "Node-edit-button";
+    this.lastSectorInner = 0;
+    this.startAngle = -225;
+    this.endAngle = -135;
+    this.imageFile = 'img/edit.png';
+    this.text = "Edit";
 }
 
-Rkns.Renderer.NodeRemoveButton.prototype.hide = function() {
-    this.sector.hide();
+Rkns.Renderer.NodeEditButton.prototype.mouseup = function() {
+    if (!this.renderer.is_dragging) {
+        this.source_representation.openEditor();
+    }
 }
 
-Rkns.Renderer.NodeRemoveButton.prototype.select = function() {
-    this.sector.select();
-}
+/* */
+
+Rkns.Renderer.NodeRemoveButton = Rkns.Utils.inherit(Rkns.Renderer._NodeButton);
 
-Rkns.Renderer.NodeRemoveButton.prototype.unselect = function(_newTarget) {
-    this.sector.unselect();
-    if (!_newTarget || (_newTarget !== this.node_representation && _newTarget.node_representation !== this.node_representation)) {
-        this.node_representation.unselect();
-    }
+Rkns.Renderer.NodeRemoveButton.prototype._init = function() {
+    this.type = "Node-remove-button";
+    this.lastSectorInner = 0;
+    this.startAngle = -45;
+    this.endAngle = 45;
+    this.imageFile = 'img/remove.png';
+    this.text = "Remove";
 }
 
 Rkns.Renderer.NodeRemoveButton.prototype.mouseup = function() {
     this.renderer.removeRepresentationsOfType("editor");
-    if (this.renderer.isEditable() && confirm(this.renkan.translate('Do you really wish to remove node ') + '"' + this.node_representation.model.get("title") + '"?')) {
-        this.project.removeNode(this.node_representation.model);
+    if (this.renderer.isEditable() && confirm(this.renkan.translate('Do you really wish to remove node ') + '"' + this.source_representation.model.get("title") + '"?')) {
+        this.project.removeNode(this.source_representation.model);
     }
 }
 
-Rkns.Renderer.NodeRemoveButton.prototype.destroy = function() {
-    this.sector.destroy();
-}
-
 /* */
 
-Rkns.Renderer.NodeLinkButton = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
+Rkns.Renderer.NodeLinkButton = Rkns.Utils.inherit(Rkns.Renderer._NodeButton);
 
 Rkns.Renderer.NodeLinkButton.prototype._init = function() {
     this.type = "Node-link-button";
     this.lastSectorInner = 0;
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.setSectorSize = function() {
-	var sectorInner = this.node_representation.circle_radius;
-	if (sectorInner !== this.lastSectorInner) {
-		if (this.sector) {
-			this.sector.destroy();
-		}
-		this.sector = Rkns.Renderer.Utils.sector(this, 1 + sectorInner, Rkns.Renderer._NODE_BUTTON_WIDTH + sectorInner, 30, 150, 1, this.options.static_url+'img/link.png', this.renkan.translate("Link to another node"));
-		this.lastSectorInner = sectorInner;
-	}
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.moveTo = function(_pos) {
-    this.sector.moveTo(_pos);
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.show = function() {
-    this.sector.show();
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.hide = function() {
-    this.sector.hide();
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.select = function() {
-    this.sector.select();
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.unselect = function(_newTarget) {
-    this.sector.unselect();
-    if (!_newTarget || (_newTarget !== this.node_representation && _newTarget.node_representation !== this.node_representation)) {
-        this.node_representation.unselect();
-    }
-}
-
-Rkns.Renderer.NodeLinkButton.prototype.destroy = function() {
-    this.sector.destroy();
+    this.startAngle = -135;
+    this.endAngle = -45;
+    this.imageFile = 'img/link.png';
+    this.text = "Link to another node";
 }
 
 /* */
 
-Rkns.Renderer.EdgeEditButton = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
+Rkns.Renderer.NodeEnlargeButton = Rkns.Utils.inherit(Rkns.Renderer._NodeButton);
+
+Rkns.Renderer.NodeEnlargeButton.prototype._init = function() {
+    this.type = "Node-enlarge-button";
+    this.lastSectorInner = 0;
+    this.startAngle = 45;
+    this.endAngle = 90;
+    this.imageFile = 'img/enlarge.png';
+    this.text = "Enlarge";
+}
+
+Rkns.Renderer.NodeEnlargeButton.prototype.mouseup = function() {
+	var _newsize = 1 + (this.source_representation.model.get("size") || 0);
+	this.source_representation.model.set("size", _newsize);
+	this.source_representation.select();
+	this.select();
+	paper.view.draw();
+}
+
+/* */
+
+Rkns.Renderer.NodeShrinkButton = Rkns.Utils.inherit(Rkns.Renderer._NodeButton);
+
+Rkns.Renderer.NodeShrinkButton.prototype._init = function() {
+    this.type = "Node-shrink-button";
+    this.lastSectorInner = 0;
+    this.startAngle = 90;
+    this.endAngle = 135;
+    this.imageFile = 'img/shrink.png';
+    this.text = "Shrink";
+}
+
+Rkns.Renderer.NodeShrinkButton.prototype.mouseup = function() {
+	var _newsize = -1 + (this.source_representation.model.get("size") || 0);
+	this.source_representation.model.set("size", _newsize);
+	this.source_representation.select();
+	this.select();
+	paper.view.draw();
+}
+
+/* */
+
+Rkns.Renderer.EdgeEditButton = Rkns.Utils.inherit(Rkns.Renderer._BaseButton);
 
 Rkns.Renderer.EdgeEditButton.prototype._init = function() {
     this.type = "Edge-edit-button";
     this.sector = Rkns.Renderer.Utils.sector(this, Rkns.Renderer._EDGE_BUTTON_INNER, Rkns.Renderer._EDGE_BUTTON_OUTER, - 90, 90, 1, this.options.static_url+'img/edit.png', this.renkan.translate("Edit"));
 }
 
-Rkns.Renderer.EdgeEditButton.prototype.moveTo = function(_pos) {
-    this.sector.moveTo(_pos);
-}
-
-Rkns.Renderer.EdgeEditButton.prototype.show = function() {
-    this.sector.show();
-}
-
-Rkns.Renderer.EdgeEditButton.prototype.hide = function() {
-    this.sector.hide();
-}
-
-Rkns.Renderer.EdgeEditButton.prototype.select = function() {
-    this.sector.select();
-}
-
-Rkns.Renderer.EdgeEditButton.prototype.unselect = function(_newTarget) {
-    this.sector.unselect();
-    if (!_newTarget || (_newTarget !== this.edge_representation && _newTarget.edge_representation !== this.edge_representation)) {
-        this.edge_representation.unselect();
-    }
-}
-
 Rkns.Renderer.EdgeEditButton.prototype.mouseup = function() {
     if (!this.renderer.is_dragging) {
-        this.edge_representation.openEditor();
+        this.source_representation.openEditor();
     }
 }
 
-Rkns.Renderer.EdgeEditButton.prototype.destroy = function() {
-    this.sector.destroy();
-}
-
 /* */
 
-Rkns.Renderer.EdgeRemoveButton = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
+Rkns.Renderer.EdgeRemoveButton = Rkns.Utils.inherit(Rkns.Renderer._BaseButton);
 
 Rkns.Renderer.EdgeRemoveButton.prototype._init = function() {
     this.type = "Edge-remove-button";
     this.sector = Rkns.Renderer.Utils.sector(this, Rkns.Renderer._EDGE_BUTTON_INNER, Rkns.Renderer._EDGE_BUTTON_OUTER, - 270, -90, 1, this.options.static_url+'img/remove.png', this.renkan.translate("Remove"));
 }
-Rkns.Renderer.EdgeRemoveButton.prototype.moveTo = function(_pos) {
-    this.sector.moveTo(_pos);
-}
-
-Rkns.Renderer.EdgeRemoveButton.prototype.show = function() {
-    this.sector.show();
-}
-
-Rkns.Renderer.EdgeRemoveButton.prototype.hide = function() {
-    this.sector.hide();
-}
-
-Rkns.Renderer.EdgeRemoveButton.prototype.select = function() {
-    this.sector.select();
-}
-
-Rkns.Renderer.EdgeRemoveButton.prototype.unselect = function(_newTarget) {
-    this.sector.unselect();
-    if (!_newTarget || (_newTarget !== this.edge_representation && _newTarget.edge_representation !== this.edge_representation)) {
-        this.edge_representation.unselect();
-    }
-}
 
 Rkns.Renderer.EdgeRemoveButton.prototype.mouseup = function() {
     this.renderer.removeRepresentationsOfType("editor");
-    if (this.renderer.isEditable() && confirm(this.renkan.translate('Do you really wish to remove edge ') + '"' + this.edge_representation.model.get("title") + '"?')) {
-        this.project.removeEdge(this.edge_representation.model);
+    if (this.renderer.isEditable() && confirm(this.renkan.translate('Do you really wish to remove edge ') + '"' + this.source_representation.model.get("title") + '"?')) {
+        this.project.removeEdge(this.source_representation.model);
     }
 }
 
-Rkns.Renderer.EdgeRemoveButton.prototype.destroy = function() {
-    this.sector.destroy();
-}
-
 /* */
 
 Rkns.Renderer.MiniFrame = Rkns.Utils.inherit(Rkns.Renderer._BaseRepresentation);
@@ -1974,7 +1908,7 @@
             this.click_target = _hitResult.item.__representation;
             if (this.click_target.type === "Node-link-button") {
                 this.removeRepresentationsOfType("editor");
-                this.addTempEdge(this.click_target.node_representation, _event.point);
+                this.addTempEdge(this.click_target.source_representation, _event.point);
             }
         } else {
             this.click_target = null;