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'] = {
'theme': {
'default': '脑图经典',
'snow': '温柔冷光',
'fresh': '文艺小清新'
'fresh-red': '清新红',
'fresh-soil': '泥土',
'fresh-green': '自然',
'fresh-blue': '天空',
'fresh-purple': '浪漫',
'fresh-pink': '可爱'
},
'maintopic': '中心主题',
'topic': '分支主题',
......
......@@ -192,6 +192,9 @@ kity.extendClass(Minder, {
var offset = node.getLayoutOffset();
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) {
// 如果当前有动画,停止动画
......
var connectMarker = new kity.Marker().pipe(function() {
var r = 4;
var dot = new kity.Circle(r);
var r = 7;
var dot = new kity.Circle(r - 1);
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.node.setAttribute('markerUnits', 'userSpaceOnUse');
});
KityMinder.registerConnectProvider('default', function(node, parent, connection, width, color) {
......@@ -39,22 +40,27 @@ KityMinder.registerConnectProvider('default', function(node, parent, connection,
case 'sub':
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 p1, p2, p3, mx;
if (side == 'right') {
p1 = new kity.Point(pBox.right + 10, startY);
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 {
p1 = new kity.Point(pBox.left - 10, startY);
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;
if (width % 2 === 0) {
p2.y += 0.5;
p3.y += 0.5;
}
pathData.push('M', p1);
pathData.push('C', mx, p1.y, mx, p2.y, p2);
pathData.push('L', p3);
......
......@@ -116,7 +116,7 @@ KityMinder.registerLayout('default', kity.createClass({
getOrderHint: function(node) {
var hint = [];
var box = node.getLayoutBox();
var offset = node.getLevel() > 1 ? 3 : 5;
var offset = 5;
hint.push({
type: 'up',
......
......@@ -91,8 +91,9 @@ KityMinder.registerConnectProvider('filetree', function(node, parent, connection
pBox = parent.getLayoutBox();
var pathData = [];
var left = parent.getLayoutPoint().x;
pathData.push('M', new kity.Point(left, pBox.bottom + 1));
pathData.push('L', new kity.Point(left, box.cy));
pathData.push('L', new kity.Point(box.left, box.cy));
var r = Math.round;
pathData.push('M', new kity.Point(r(left), r(pBox.bottom)));
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);
});
\ No newline at end of file
......@@ -34,8 +34,8 @@ var OutlineRenderer = kity.createClass('OutlineRenderer', {
.setPosition(outlineBox.x, outlineBox.y)
.setSize(outlineBox.width, outlineBox.height)
.setRadius(node.getStyle('radius'))
.fill(node.getStyle(prefix + 'background'))
.stroke(node.getStyle(prefix + 'stroke'),
.fill(node.getStyle(prefix + 'background') || node.getStyle('background'))
.stroke(node.getStyle(prefix + 'stroke' || node.getStyle('stroke')),
node.getStyle(prefix + 'stroke-width'));
return outlineBox;
......
......@@ -56,7 +56,10 @@ KityMinder.registerModule('Select', function() {
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() {
......
......@@ -11,7 +11,9 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
update: function(text, node) {
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) {
......@@ -31,7 +33,7 @@ utils.extend(TextRenderer, {
});
kity.extendClass(MinderNode,{
getTextShape : function(){
getTextShape : function() {
return this.getRenderer('TextRenderer').getRenderShape();
}
});
......
......@@ -2,11 +2,8 @@ var ViewDragger = kity.createClass("ViewDragger", {
constructor: function(minder) {
this._minder = minder;
this._enabled = false;
this._offset = {
x: 0,
y: 0
};
this._bind();
this._minder.getRenderContainer().translate(0.5, 0.5);
},
isEnabled: function() {
return this._enabled;
......@@ -203,7 +200,7 @@ KityMinder.registerModule('View', function() {
},
b = this._lastClientSize;
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;
}
}
......
KityMinder.registerTheme('default', {
'name': '脑图经典',
'root-color': '#430',
'root-background': '#e9df98',
'root-stroke': 'none',
'root-stroke': '#e9df98',
'root-font-size': 24,
'root-padding': [15, 25],
'root-margin': [30, 100],
......@@ -14,7 +11,7 @@ KityMinder.registerTheme('default', {
'main-color': '#333',
'main-background': '#a4c5c0',
'main-stroke': 'none',
'main-stroke': '#a4c5c0',
'main-font-size': 16,
'main-padding': [6, 20],
'main-margin': 20,
......@@ -37,6 +34,7 @@ KityMinder.registerTheme('default', {
'connect-radius': 5,
'selected-background': 'rgb(254, 219, 0)',
'selected-stroke': 'rgb(254, 219, 0)',
'selected-color': 'black',
'marquee-background': 'rgba(255,255,255,.3)',
......@@ -49,5 +47,5 @@ KityMinder.registerTheme('default', {
'order-hint-area-color': 'rgba(0, 255, 0, .5)',
'order-hint-path-color': '#0f0',
'order-hint-path-width': 2
'order-hint-path-width': 1
});
\ No newline at end of file
KityMinder.registerTheme('fresh', {
'name': '文艺小清新',
'background': 'white',
'root-color': '#fff',
'root-background': '#73bf75',
'root-selected-background': '#73bf75',
'root-stroke': 'none',
'root-font-size': 16,
'root-padding': [12, 24],
'root-margin': [30, 100],
'root-radius': 5,
'root-space': 10,
'main-color': '#000',
'main-background': '#f3f9f3',
'main-selected-background': '#f3f9f3',
'main-stroke': '#beddbf',
'main-stroke-width': 1,
'main-font-size': 16,
'main-padding': [6, 20],
'main-margin': 20,
'main-radius': 3,
'main-space': 5,
'sub-color': 'black',
'sub-background': 'none',
'sub-selected-background': 'none',
'sub-stroke': 'none',
'sub-font-size': 12,
'sub-padding': [5, 10],
'sub-margin': [15, 20],
'sub-tree-margin': 30,
'sub-radius': 5,
'sub-space': 5,
'connect-color': '#80bf82',
'connect-width': 2,
'connect-radius': 5,
'selected-stroke': '#437152',
'selected-stroke-width': '3',
'marquee-background': 'rgba(154,255,156,.1)',
'marquee-stroke': '#73bf75',
'drop-hint-color': '#437152',
'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': 2
});
\ No newline at end of file
(function() {
function hsl(h, s, l) {
return kity.Color.createHSL(h, s, l);
}
function generate(h) {
return {
'background': '#fefefe',
'root-color': 'white',
'root-background': hsl(h, 37, 60),
'root-stroke': hsl(h, 37, 60),
'root-font-size': 16,
'root-padding': [12, 24],
'root-margin': [30, 100],
'root-radius': 5,
'root-space': 10,
'main-color': 'black',
'main-background': hsl(h, 33, 95),
'main-stroke': hsl(h, 37, 60),
'main-stroke-width': 1,
'main-font-size': 16,
'main-padding': [6, 20],
'main-margin': 20,
'main-radius': 3,
'main-space': 5,
'sub-color': 'black',
'sub-background': 'none',
'sub-stroke': 'none',
'sub-font-size': 12,
'sub-padding': [5, 10],
'sub-margin': [15, 20],
'sub-tree-margin': 30,
'sub-radius': 5,
'sub-space': 5,
'connect-color': hsl(h, 37, 60),
'connect-width': 1,
'connect-radius': 5,
'selected-stroke': hsl(h, 26, 30),
'selected-stroke-width': '3',
'marquee-background': hsl(h, 100, 80).set('a', 0.1),
'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
};
for (var name in plans) {
KityMinder.registerTheme('fresh-' + name, generate(plans[name]));
}
})();
\ No newline at end of file
......@@ -2,25 +2,27 @@ KityMinder.registerTheme('snow', {
'root-color': '#430',
'root-background': '#e9df98',
'root-stroke': 'none',
'root-stroke': '#e9df98',
'root-font-size': 24,
'root-padding': [15, 25],
'root-margin': 30,
'root-radius': 5,
'root-space': 10,
'root-shadow': 'rgba(0, 0, 0, .25)',
'main-color': '#333',
'main-background': '#a4c5c0',
'main-stroke': 'none',
'main-stroke': '#a4c5c0',
'main-font-size': 16,
'main-padding': [6, 20],
'main-margin': [20, 40],
'main-radius': 5,
'main-space': 5,
'main-shadow': 'rgba(0, 0, 0, .25)',
'sub-color': 'black',
'sub-background': 'white',
'sub-stroke': 'none',
'sub-stroke': 'white',
'sub-font-size': 12,
'sub-padding': [5, 10],
'sub-margin': [10, 20],
......@@ -31,5 +33,18 @@ KityMinder.registerTheme('snow', {
'connect-width': 2,
'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