Commit 38b96851 authored by techird's avatar techird

非常清晰的脑图

parent 51354b02
......@@ -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
......@@ -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
......@@ -9,7 +9,7 @@
'root-color': 'white',
'root-background': hsl(h, 37, 60),
'root-stroke': 'none',
'root-stroke': hsl(h, 37, 60),
'root-font-size': 16,
'root-padding': [12, 24],
'root-margin': [30, 100],
......@@ -52,7 +52,7 @@
'order-hint-area-color': hsl(h, 100, 95).set('a', 0.5),
'order-hint-path-color': hsl(h, 100, 25),
'order-hint-path-width': 2
'order-hint-path-width': 1
};
}
......
......@@ -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