diff -r 3247fccfbd3f -r e0f6f3c31150 client/js/paper-renderer.js --- a/client/js/paper-renderer.js Mon Jan 14 16:00:07 2013 +0100 +++ b/client/js/paper-renderer.js Thu Jan 31 18:53:08 2013 +0100 @@ -236,6 +236,7 @@ this.circle = new paper.Path.Circle([0, 0], Rkns.Renderer._NODE_RADIUS); this.circle.fillColor = '#ffffff'; this.circle.__representation = this; + this.circle.strokeWidth = 2; this.title = new paper.PointText([0,0]); this.title.characterStyle = { fontSize: Rkns.Renderer._NODE_FONT_SIZE, @@ -256,7 +257,7 @@ this.circle.position = this.paper_coords; this.title.content = this.model.get("title"); this.title.position = this.paper_coords.add([0, Rkns.Renderer._NODE_RADIUS + 1.5 *Rkns.Renderer._NODE_FONT_SIZE]); - this.circle.strokeColor = this.model.get("created_by").get("color"); + this.circle.strokeColor = this.model.get("color") || this.model.get("created_by").get("color") || "#000000"; this.edit_button.moveTo(this.paper_coords); this.remove_button.moveTo(this.paper_coords); this.link_button.moveTo(this.paper_coords); @@ -317,7 +318,7 @@ } Rkns.Renderer.Node.prototype.select = function() { - this.circle.strokeWidth = 3; + this.circle.strokeWidth = 4; this.edit_button.show(); this.remove_button.show(); this.link_button.show(); @@ -335,7 +336,7 @@ this.edit_button.hide(); this.remove_button.hide(); this.link_button.hide(); - this.circle.strokeWidth = 1; + this.circle.strokeWidth = 2; Rkns.$('.Rk-Bin-Item').removeClass("selected"); } } @@ -387,6 +388,7 @@ this.line = new paper.Path(); this.line.add([0,0],[0,0],[0,0]); this.line.__representation = this; + this.line.strokeWidth = 2; this.arrow = new paper.Path(); this.arrow.add([0,0],[Rkns.Renderer._ARROW_LENGTH,Rkns.Renderer._ARROW_WIDTH / 2],[0,Rkns.Renderer._ARROW_WIDTH]); this.arrow.__representation = this; @@ -416,7 +418,7 @@ _p1b = _p1a.add(_delta), /* to differentiate inbound and outbound links */ _a = _v.angle, _handle = _v.divide(3), - _color = this.model.get("created_by").get("color"); + _color = this.model.get("color") || this.model.get("created_by").get("color") || "#000000"; this.paper_coords = _p0b.add(_p1b).divide(2); this.line.strokeColor = _color; this.line.segments[0].point = _p0a; @@ -450,7 +452,7 @@ } Rkns.Renderer.Edge.prototype.select = function() { - this.line.strokeWidth = 3; + this.line.strokeWidth = 4; this.edit_button.show(); this.remove_button.show(); } @@ -459,7 +461,7 @@ if (!_newTarget || _newTarget.edge_representation !== this) { this.edit_button.hide(); this.remove_button.hide(); - this.line.strokeWidth = 1; + this.line.strokeWidth = 2; } } @@ -498,7 +500,7 @@ this.renderer.edge_layer.activate(); this.type = "temp-edge"; - var _color = this.project.get("users").get(this.renderer.renkan.current_user).get("color"); + var _color = this.project.get("users").get(this.renderer.renkan.current_user).get("color") || "#000000"; this.line = new paper.Path(); this.line.strokeColor = _color; this.line.add([0,0],[0,0]); @@ -590,6 +592,8 @@ + '
' + '' + '' + + '<%=node.created_by_title%>
' ); @@ -603,6 +607,7 @@ uri: _model.get("uri"), description: _model.get("description"), image: _model.get("image") || "", + color: _model.get("color") || _model.get("created_by").get("color") || "#000000", created_by_color: _model.get("created_by").get("color"), created_by_title: _model.get("created_by").get("title") }, @@ -632,6 +637,17 @@ _this.redraw(); }) this.editor_$.find(".Rk-Edit-Title")[0].focus(); + this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover( + function() { _this.editor_$.find(".Rk-Edit-ColorPicker").show(); }, + function() { _this.editor_$.find(".Rk-Edit-ColorPicker").hide(); } + ); + this.editor_$.find(".Rk-Edit-ColorPicker li").hover( + function() { _this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); }, + function() { _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || _model.get("created_by").get("color") || "#000000") } + ).click(function() { + _model.set("color", $(this).attr("data-color")); + _this.redraw(); + }); } Rkns.Renderer.NodeEditor.prototype.redraw = function() { @@ -673,6 +689,8 @@ '<%=edge.from_title%>
' + '<%=edge.to_title%>
' + '<%=edge.created_by_title%>
' @@ -686,6 +704,7 @@ title: _model.get("title"), uri: _model.get("uri"), description: _model.get("description"), + color: _model.get("color") || _model.get("created_by").get("color") || "#000000", from_title: _model.get("from").get("title"), to_title: _model.get("to").get("title"), from_created_by_color: _model.get("from").get("created_by").get("color"), @@ -710,6 +729,17 @@ _model.set(_data); _this.redraw(); }); + this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover( + function() { _this.editor_$.find(".Rk-Edit-ColorPicker").show(); }, + function() { _this.editor_$.find(".Rk-Edit-ColorPicker").hide(); } + ); + this.editor_$.find(".Rk-Edit-ColorPicker li").hover( + function() { _this.editor_$.find(".Rk-Edit-Color").css("background", $(this).attr("data-color")); }, + function() { _this.editor_$.find(".Rk-Edit-Color").css("background", _model.get("color") || _model.get("created_by").get("color") || "#000000") } + ).click(function() { + _model.set("color", $(this).attr("data-color")); + _this.redraw(); + }); } Rkns.Renderer.EdgeEditor.prototype.redraw = function() { var _coords = this.edge_representation.paper_coords;