Commit 6ab996cf authored by techird's avatar techird

Merge branch 'dev' into ui-for-1.2.0

parents d84392fd 38b96851
...@@ -6,7 +6,12 @@ KityMinder.LANG['zh-cn'] = { ...@@ -6,7 +6,12 @@ KityMinder.LANG['zh-cn'] = {
'theme': { 'theme': {
'default': '脑图经典', 'default': '脑图经典',
'snow': '温柔冷光', 'snow': '温柔冷光',
'fresh': '文艺小清新' 'fresh-red': '清新红',
'fresh-soil': '泥土',
'fresh-green': '自然',
'fresh-blue': '天空',
'fresh-purple': '浪漫',
'fresh-pink': '可爱'
}, },
'maintopic': '中心主题', 'maintopic': '中心主题',
'topic': '分支主题', 'topic': '分支主题',
......
...@@ -192,6 +192,9 @@ kity.extendClass(Minder, { ...@@ -192,6 +192,9 @@ kity.extendClass(Minder, {
var offset = node.getLayoutOffset(); var offset = node.getLayoutOffset();
matrix.translate(offset.x, offset.y); matrix.translate(offset.x, offset.y);
matrix.m.e = Math.round(matrix.m.e);
matrix.m.f = Math.round(matrix.m.f);
if (!matrix.equals(lastMatrix) || true) { if (!matrix.equals(lastMatrix) || true) {
// 如果当前有动画,停止动画 // 如果当前有动画,停止动画
......
var connectMarker = new kity.Marker().pipe(function() { var connectMarker = new kity.Marker().pipe(function() {
var r = 4; var r = 7;
var dot = new kity.Circle(r); var dot = new kity.Circle(r - 1);
this.addShape(dot); this.addShape(dot);
this.setRef(r, 0).setViewBox(-r, -r, r + r, r + r).setWidth(r).setHeight(r); this.setRef(r - 1, 0).setViewBox(-r, -r, r + r, r + r).setWidth(r).setHeight(r);
this.dot = dot; this.dot = dot;
this.node.setAttribute('markerUnits', 'userSpaceOnUse');
}); });
KityMinder.registerConnectProvider('default', function(node, parent, connection, width, color) { KityMinder.registerConnectProvider('default', function(node, parent, connection, width, color) {
...@@ -39,22 +40,27 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection, ...@@ -39,22 +40,27 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection,
case 'sub': case 'sub':
var radius = node.getStyle('connect-radius'); var radius = node.getStyle('connect-radius');
var underY = box.bottom + 2; var underY = box.bottom + 3;
var startY = parent.getType() == 'sub' ? pBox.bottom + 2 : pBox.cy; var startY = parent.getType() == 'sub' ? pBox.bottom + 2 : pBox.cy;
var p1, p2, p3, mx; var p1, p2, p3, mx;
if (side == 'right') { if (side == 'right') {
p1 = new kity.Point(pBox.right + 10, startY); p1 = new kity.Point(pBox.right + 10, startY);
p2 = new kity.Point(box.left, underY); p2 = new kity.Point(box.left, underY);
p3 = new kity.Point(box.right + 10.5, underY); p3 = new kity.Point(box.right + 10, underY);
} else { } else {
p1 = new kity.Point(pBox.left - 10, startY); p1 = new kity.Point(pBox.left - 10, startY);
p2 = new kity.Point(box.right, underY); p2 = new kity.Point(box.right, underY);
p3 = new kity.Point(box.left - 10.5, underY); p3 = new kity.Point(box.left - 10, underY);
} }
mx = (p1.x + p2.x) / 2; mx = (p1.x + p2.x) / 2;
if (width % 2 === 0) {
p2.y += 0.5;
p3.y += 0.5;
}
pathData.push('M', p1); pathData.push('M', p1);
pathData.push('C', mx, p1.y, mx, p2.y, p2); pathData.push('C', mx, p1.y, mx, p2.y, p2);
pathData.push('L', p3); pathData.push('L', p3);
......
...@@ -116,7 +116,7 @@ KityMinder.registerLayout('default', kity.createClass({ ...@@ -116,7 +116,7 @@ KityMinder.registerLayout('default', kity.createClass({
getOrderHint: function(node) { getOrderHint: function(node) {
var hint = []; var hint = [];
var box = node.getLayoutBox(); var box = node.getLayoutBox();
var offset = node.getLevel() > 1 ? 3 : 5; var offset = 5;
hint.push({ hint.push({
type: 'up', type: 'up',
......
...@@ -91,8 +91,9 @@ KityMinder.registerConnectProvider('filetree', function(node, parent, connection ...@@ -91,8 +91,9 @@ KityMinder.registerConnectProvider('filetree', function(node, parent, connection
pBox = parent.getLayoutBox(); pBox = parent.getLayoutBox();
var pathData = []; var pathData = [];
var left = parent.getLayoutPoint().x; var left = parent.getLayoutPoint().x;
pathData.push('M', new kity.Point(left, pBox.bottom + 1)); var r = Math.round;
pathData.push('L', new kity.Point(left, box.cy)); pathData.push('M', new kity.Point(r(left), r(pBox.bottom)));
pathData.push('L', new kity.Point(box.left, box.cy)); pathData.push('L', new kity.Point(r(left), r(box.cy)));
pathData.push('L', new kity.Point(r(box.left), r(box.cy)));
connection.setPathData(pathData); connection.setPathData(pathData);
}); });
\ No newline at end of file
...@@ -34,8 +34,8 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', { ...@@ -34,8 +34,8 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', {
.setPosition(outlineBox.x, outlineBox.y) .setPosition(outlineBox.x, outlineBox.y)
.setSize(outlineBox.width, outlineBox.height) .setSize(outlineBox.width, outlineBox.height)
.setRadius(node.getStyle('radius')) .setRadius(node.getStyle('radius'))
.fill(node.getStyle(prefix + 'background')) .fill(node.getStyle(prefix + 'background') || node.getStyle('background'))
.stroke(node.getStyle(prefix + 'stroke'), .stroke(node.getStyle(prefix + 'stroke' || node.getStyle('stroke')),
node.getStyle(prefix + 'stroke-width')); node.getStyle(prefix + 'stroke-width'));
return outlineBox; return outlineBox;
......
...@@ -56,7 +56,10 @@ KityMinder.registerModule('Select', function() { ...@@ -56,7 +56,10 @@ KityMinder.registerModule('Select', function() {
selectedNodes = []; selectedNodes = [];
// 使其犀利 // 使其犀利
g.snapToSharp(marquee); marquee.left = Math.round(marquee.left);
marquee.top = Math.round(marquee.top);
marquee.right = Math.round(marquee.right);
marquee.bottom = Math.round(marquee.bottom);
// 选区形状更新 // 选区形状更新
marqueeShape.getDrawer().pipe(function() { marqueeShape.getDrawer().pipe(function() {
......
...@@ -11,7 +11,9 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', { ...@@ -11,7 +11,9 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
update: function(text, node) { update: function(text, node) {
this.setTextStyle(node, text.setContent(node.getText())); this.setTextStyle(node, text.setContent(node.getText()));
return text.getBoundaryBox(); var box = text.getBoundaryBox();
var r = Math.round;
return new kity.Box(r(box.x), r(box.y), r(box.width), r(box.height));
}, },
setTextStyle: function(node, text) { setTextStyle: function(node, text) {
...@@ -31,7 +33,7 @@ utils.extend(TextRenderer, { ...@@ -31,7 +33,7 @@ utils.extend(TextRenderer, {
}); });
kity.extendClass(MinderNode,{ kity.extendClass(MinderNode,{
getTextShape : function(){ getTextShape : function() {
return this.getRenderer('TextRenderer').getRenderShape(); return this.getRenderer('TextRenderer').getRenderShape();
} }
}); });
......
...@@ -2,11 +2,8 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -2,11 +2,8 @@ var ViewDragger = kity.createClass("ViewDragger", {
constructor: function(minder) { constructor: function(minder) {
this._minder = minder; this._minder = minder;
this._enabled = false; this._enabled = false;
this._offset = {
x: 0,
y: 0
};
this._bind(); this._bind();
this._minder.getRenderContainer().translate(0.5, 0.5);
}, },
isEnabled: function() { isEnabled: function() {
return this._enabled; return this._enabled;
...@@ -203,7 +200,7 @@ KityMinder.registerModule('View', function() { ...@@ -203,7 +200,7 @@ KityMinder.registerModule('View', function() {
}, },
b = this._lastClientSize; b = this._lastClientSize;
this.getRenderContainer().translate( this.getRenderContainer().translate(
(a.width - b.width) / 2, (a.height - b.height) / 2); (a.width - b.width) / 2 | 0, (a.height - b.height) / 2 | 0);
this._lastClientSize = a; this._lastClientSize = a;
} }
} }
......
KityMinder.registerTheme('default', { KityMinder.registerTheme('default', {
'name': '脑图经典',
'root-color': '#430', 'root-color': '#430',
'root-background': '#e9df98', 'root-background': '#e9df98',
'root-stroke': 'none', 'root-stroke': '#e9df98',
'root-font-size': 24, 'root-font-size': 24,
'root-padding': [15, 25], 'root-padding': [15, 25],
'root-margin': [30, 100], 'root-margin': [30, 100],
...@@ -14,7 +11,7 @@ KityMinder.registerTheme('default', { ...@@ -14,7 +11,7 @@ KityMinder.registerTheme('default', {
'main-color': '#333', 'main-color': '#333',
'main-background': '#a4c5c0', 'main-background': '#a4c5c0',
'main-stroke': 'none', 'main-stroke': '#a4c5c0',
'main-font-size': 16, 'main-font-size': 16,
'main-padding': [6, 20], 'main-padding': [6, 20],
'main-margin': 20, 'main-margin': 20,
...@@ -37,6 +34,7 @@ KityMinder.registerTheme('default', { ...@@ -37,6 +34,7 @@ KityMinder.registerTheme('default', {
'connect-radius': 5, 'connect-radius': 5,
'selected-background': 'rgb(254, 219, 0)', 'selected-background': 'rgb(254, 219, 0)',
'selected-stroke': 'rgb(254, 219, 0)',
'selected-color': 'black', 'selected-color': 'black',
'marquee-background': 'rgba(255,255,255,.3)', 'marquee-background': 'rgba(255,255,255,.3)',
...@@ -49,5 +47,5 @@ KityMinder.registerTheme('default', { ...@@ -49,5 +47,5 @@ KityMinder.registerTheme('default', {
'order-hint-area-color': 'rgba(0, 255, 0, .5)', 'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0', 'order-hint-path-color': '#0f0',
'order-hint-path-width': 2 'order-hint-path-width': 1
}); });
\ No newline at end of file
KityMinder.registerTheme('fresh', { (function() {
function hsl(h, s, l) {
return kity.Color.createHSL(h, s, l);
}
'name': '文艺小清新', function generate(h) {
return {
'background': '#fefefe',
'background': 'white', 'root-color': 'white',
'root-background': hsl(h, 37, 60),
'root-color': '#fff', 'root-stroke': hsl(h, 37, 60),
'root-background': '#73bf75',
'root-selected-background': '#73bf75',
'root-stroke': 'none',
'root-font-size': 16, 'root-font-size': 16,
'root-padding': [12, 24], 'root-padding': [12, 24],
'root-margin': [30, 100], 'root-margin': [30, 100],
...@@ -15,10 +17,9 @@ KityMinder.registerTheme('fresh', { ...@@ -15,10 +17,9 @@ KityMinder.registerTheme('fresh', {
'root-space': 10, 'root-space': 10,
'main-color': '#000', 'main-color': 'black',
'main-background': '#f3f9f3', 'main-background': hsl(h, 33, 95),
'main-selected-background': '#f3f9f3', 'main-stroke': hsl(h, 37, 60),
'main-stroke': '#beddbf',
'main-stroke-width': 1, 'main-stroke-width': 1,
'main-font-size': 16, 'main-font-size': 16,
'main-padding': [6, 20], 'main-padding': [6, 20],
...@@ -28,7 +29,6 @@ KityMinder.registerTheme('fresh', { ...@@ -28,7 +29,6 @@ KityMinder.registerTheme('fresh', {
'sub-color': 'black', 'sub-color': 'black',
'sub-background': 'none', 'sub-background': 'none',
'sub-selected-background': 'none',
'sub-stroke': 'none', 'sub-stroke': 'none',
'sub-font-size': 12, 'sub-font-size': 12,
'sub-padding': [5, 10], 'sub-padding': [5, 10],
...@@ -37,22 +37,36 @@ KityMinder.registerTheme('fresh', { ...@@ -37,22 +37,36 @@ KityMinder.registerTheme('fresh', {
'sub-radius': 5, 'sub-radius': 5,
'sub-space': 5, 'sub-space': 5,
'connect-color': '#80bf82', 'connect-color': hsl(h, 37, 60),
'connect-width': 2, 'connect-width': 1,
'connect-radius': 5, 'connect-radius': 5,
'selected-stroke': '#437152', 'selected-stroke': hsl(h, 26, 30),
'selected-stroke-width': '3', 'selected-stroke-width': '3',
'marquee-background': 'rgba(154,255,156,.1)', 'marquee-background': hsl(h, 100, 80).set('a', 0.1),
'marquee-stroke': '#73bf75', 'marquee-stroke': hsl(h, 37, 60),
'drop-hint-color': hsl(h, 26, 35),
'drop-hint-width': 5,
'order-hint-area-color': hsl(h, 100, 95).set('a', 0.5),
'order-hint-path-color': hsl(h, 100, 25),
'order-hint-path-width': 1
};
}
var plans = {
red: 0,
soil: 25,
green: 122,
blue: 204,
purple: 246,
pink: 334
};
'drop-hint-color': '#437152', for (var name in plans) {
'sub-drop-hint-width': 2, KityMinder.registerTheme('fresh-' + name, generate(plans[name]));
'main-drop-hint-width': 4, }
'root-drop-hint-width': 4,
'order-hint-area-color': 'rgba(0, 255, 0, .5)', })();
'order-hint-path-color': '#0f0', \ No newline at end of file
'order-hint-path-width': 2
});
\ No newline at end of file
...@@ -2,25 +2,27 @@ KityMinder.registerTheme('snow', { ...@@ -2,25 +2,27 @@ KityMinder.registerTheme('snow', {
'root-color': '#430', 'root-color': '#430',
'root-background': '#e9df98', 'root-background': '#e9df98',
'root-stroke': 'none', 'root-stroke': '#e9df98',
'root-font-size': 24, 'root-font-size': 24,
'root-padding': [15, 25], 'root-padding': [15, 25],
'root-margin': 30, 'root-margin': 30,
'root-radius': 5, 'root-radius': 5,
'root-space': 10, 'root-space': 10,
'root-shadow': 'rgba(0, 0, 0, .25)',
'main-color': '#333', 'main-color': '#333',
'main-background': '#a4c5c0', 'main-background': '#a4c5c0',
'main-stroke': 'none', 'main-stroke': '#a4c5c0',
'main-font-size': 16, 'main-font-size': 16,
'main-padding': [6, 20], 'main-padding': [6, 20],
'main-margin': [20, 40], 'main-margin': [20, 40],
'main-radius': 5, 'main-radius': 5,
'main-space': 5, 'main-space': 5,
'main-shadow': 'rgba(0, 0, 0, .25)',
'sub-color': 'black', 'sub-color': 'black',
'sub-background': 'white', 'sub-background': 'white',
'sub-stroke': 'none', 'sub-stroke': 'white',
'sub-font-size': 12, 'sub-font-size': 12,
'sub-padding': [5, 10], 'sub-padding': [5, 10],
'sub-margin': [10, 20], 'sub-margin': [10, 20],
...@@ -31,5 +33,18 @@ KityMinder.registerTheme('snow', { ...@@ -31,5 +33,18 @@ KityMinder.registerTheme('snow', {
'connect-width': 2, 'connect-width': 2,
'connect-radius': 5, 'connect-radius': 5,
'selected-background': 'rgb(254, 219, 0)' 'selected-background': 'rgb(254, 219, 0)',
'selected-stroke': 'rgb(254, 219, 0)',
'marquee-background': 'rgba(255,255,255,.3)',
'marquee-stroke': 'white',
'drop-hint-color': 'yellow',
'sub-drop-hint-width': 2,
'main-drop-hint-width': 4,
'root-drop-hint-width': 4,
'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0',
'order-hint-path-width': 1
}); });
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment