# HG changeset patch
# User ymh ' + Rkns.pickerColors.map(function(c) {
+ return '
' + Rkns.pickerColors.map(function(c) {
return _tmpl({
c: c
});
}).join("") + '
';
- })();
+ };
if (this.options.show_editor) {
this.renderer = new Rkns.Renderer.Scene(this);
diff -r e388117572d8 -r 2b9c120dba55 client/js/renderer/basebutton.js
--- a/client/js/renderer/basebutton.js Thu Jan 05 19:34:53 2017 +0100
+++ b/client/js/renderer/basebutton.js Tue Jan 10 17:36:30 2017 +0100
@@ -19,7 +19,7 @@
},
hide: function() {
if (this.sector){
- this.sector.hide();
+ this.sector.hide();
}
},
select: function() {
diff -r e388117572d8 -r 2b9c120dba55 client/js/renderer/edgeeditor.js
--- a/client/js/renderer/edgeeditor.js Thu Jan 05 19:34:53 2017 +0100
+++ b/client/js/renderer/edgeeditor.js Tue Jan 10 17:36:30 2017 +0100
@@ -112,7 +112,7 @@
}
});
- var _picker = _this.editor_$.find(".Rk-Edit-ColorPicker");
+ var _picker = _this.editor_$.find(".Rk-Editor-ColorPicker-Edge");
this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(
function(_e) {
diff -r e388117572d8 -r 2b9c120dba55 client/js/renderer/nodeeditor.js
--- a/client/js/renderer/nodeeditor.js Thu Jan 05 19:34:53 2017 +0100
+++ b/client/js/renderer/nodeeditor.js Tue Jan 10 17:36:30 2017 +0100
@@ -34,6 +34,8 @@
image: _model.get("image") || "",
image_placeholder: _image_placeholder,
color: (_model.has("style") && _model.get("style").color) || _created_by.get("color"),
+ title_size: (_model.has("style") && _model.get("style").title_size) || 1,
+ title_color: (_model.has("style") && _model.get("style").title_color) || this.options.node_title_color,
thickness: (_model.has("style") && _model.get("style").thickness) || 1,
dash: _model.has("style") && _model.get("style").dash ? "checked" : "",
clip_path: _model.get("clip_path") || false,
@@ -203,7 +205,7 @@
}
this.editor_$.find(".Rk-Edit-Title")[0].focus();
- var _picker = _this.editor_$.find(".Rk-Edit-ColorPicker");
+ var _picker = _this.editor_$.find(".Rk-Editor-ColorPicker-Node");
this.editor_$.find(".Rk-Edit-ColorPicker-Wrapper").hover(
function(_e) {
@@ -286,6 +288,76 @@
return false;
});
+ var shiftTitleSize = function(n) {
+ var min = _this.options.node_title_size_min;
+ var max = _this.options.node_title_size_max;
+ if (_this.renderer.isEditable()) {
+ var _oldTitleSize = ((_model.has('style') && _model.get('style').title_size) || 1),
+ _newTitleSize = n + _oldTitleSize;
+ if(_newTitleSize < min ) {
+ _newTitleSize = min;
+ }
+ else if (_newTitleSize > max) {
+ _newTitleSize = max;
+ }
+ if (_newTitleSize !== _oldTitleSize) {
+ _this.editor_$.find("#Rk-Edit-Title-Size-Value").text(_newTitleSize.toFixed(1));
+ _model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {title_size: _newTitleSize}));
+ paper.view.draw();
+ }
+ }
+ else {
+ closeEditor();
+ }
+ };
+
+
+ var _pickerTitle = _this.editor_$.find(".Rk-Editor-ColorPicker-Title");
+
+ this.editor_$.find(".Rk-Editor-p-title-color").hover(
+ function(_e) {
+ _e.preventDefault();
+ _pickerTitle.show();
+ },
+ function(_e) {
+ _e.preventDefault();
+ _pickerTitle.hide();
+ }
+ );
+
+ _pickerTitle.find("li").hover(
+ function(_e) {
+ _e.preventDefault();
+ _this.editor_$.find(".Rk-Editor-p-title-color .Rk-Edit-Color").css("background", $(this).attr("data-color"));
+ },
+ function(_e) {
+ _e.preventDefault();
+ var title_color = (_model.has("style") && _model.get("style").title_color) || _this.options.node_fill_color;
+ _this.editor_$.find(".Rk-Editor-p-title-color .Rk-Edit-Color").css("background", title_color);
+ }
+ ).click(function(_e) {
+ _e.preventDefault();
+ if (_this.renderer.isEditable()) {
+ _model.set("style", _.assign( ((_model.has("style") && _.clone(_model.get("style"))) || {}), {title_color: $(this).attr("data-color")}));
+ _pickerTitle.hide();
+ paper.view.draw();
+ } else {
+ closeEditor();
+ }
+ });
+
+
+ this.editor_$.find("#Rk-Edit-Title-Size-Down").click(function() {
+ var step = _this.options.node_title_size_step;
+ shiftTitleSize(-step);
+ return false;
+ });
+ this.editor_$.find("#Rk-Edit-Title-Size-Up").click(function() {
+ var step = _this.options.node_title_size_step;
+ shiftTitleSize(step);
+ return false;
+ });
+
this.editor_$.find(".Rk-Edit-Image-Del").click(function() {
_this.editor_$.find(".Rk-Edit-Image").val('');
onFieldChange();
diff -r e388117572d8 -r 2b9c120dba55 client/js/renderer/noderepr.js
--- a/client/js/renderer/noderepr.js Thu Jan 05 19:34:53 2017 +0100
+++ b/client/js/renderer/noderepr.js Tue Jan 10 17:36:30 2017 +0100
@@ -153,12 +153,34 @@
var _text = clean_title || this.renkan.translate(this.options.label_untitled_nodes) || "";
_text = Utils.shortenText(_text, this.options.node_label_max_length);
+ //_formatedText = _text;
+
+
if (typeof this.highlighted === "object") {
- this.title.html(this.highlighted.replace(_(_text).escape(),'$1'));
- } else {
- this.title.text(_text);
+ _text = this.highlighted.replace(_(_text).escape(),'$1');
}
+ //TODO: default text node color
+ var node_style = (this.model.get("style") || {'title_size': 1, 'title-color': '#00000' });
+ var text_size = node_style.title_size || 1;
+ var text_color = node_style.title_color || this.options.node_title_color;
+
+ var text_style = {
+ 'line-height': "1em"
+ };
+
+ if(text_size !== 1) {
+ text_style['font-size'] = text_size.toFixed(1)+"em";
+ }
+ //TODO: compare with default value
+ if(text_color !== "#000000") {
+ text_style.color = text_color;
+ }
+
+ var text_node = $("").css(text_style).html(_text);
+
+ this.title.empty().append(text_node);
+
var _strokeWidth = this._getStrokeWidth();
this.title.css({
left: this.paper_coords.x,
diff -r e388117572d8 -r 2b9c120dba55 client/js/renderer/scene.js
--- a/client/js/renderer/scene.js Thu Jan 05 19:34:53 2017 +0100
+++ b/client/js/renderer/scene.js Tue Jan 10 17:36:30 2017 +0100
@@ -438,7 +438,7 @@
if (_renkan.options.show_user_list && _renkan.options.user_color_editable) {
var $cpwrapper = this.$.find(".Rk-Users .Rk-Edit-ColorPicker-Wrapper"),
- $cplist = this.$.find(".Rk-Users .Rk-Edit-ColorPicker");
+ $cplist = this.$.find(".Rk-Users .Rk-Editor-ColorPicker-User");
$cpwrapper.hover(
function(_e) {
diff -r e388117572d8 -r 2b9c120dba55 client/templates/edgeeditor.html
--- a/client/templates/edgeeditor.html Thu Jan 05 19:34:53 2017 +0100
+++ b/client/templates/edgeeditor.html Tue Jan 10 17:36:30 2017 +0100
@@ -38,7 +38,7 @@
- <%= renkan.colorPicker %>
+ <%= renkan.colorPicker('Rk-Editor-ColorPicker-Edge') %>
<%- renkan.translate("Choose color") %>
diff -r e388117572d8 -r 2b9c120dba55 client/templates/nodeeditor.html
--- a/client/templates/nodeeditor.html Thu Jan 05 19:34:53 2017 +0100
+++ b/client/templates/nodeeditor.html Tue Jan 10 17:36:30 2017 +0100
@@ -10,7 +10,23 @@
<% } %>
@@ -53,7 +69,7 @@ - <%= renkan.colorPicker %> + <%= renkan.colorPicker('Rk-Editor-ColorPicker-Node') %> <%- renkan.translate("Choose color") %> diff -r e388117572d8 -r 2b9c120dba55 client/templates/scene.html --- a/client/templates/scene.html Thu Jan 05 19:34:53 2017 +0100 +++ b/client/templates/scene.html Tue Jan 10 17:36:30 2017 +0100 @@ -18,7 +18,7 @@ <% } %> - <% if (options.user_color_editable) { print(colorPicker) } %> + <% if (options.user_color_editable) { print(colorPicker('Rk-Editor-ColorPicker-User')) } %> <% } %> <unknown user>