Commit e67dffb4 authored by techird's avatar techird

fixing something...

parent 65e58fb0
......@@ -70,21 +70,21 @@
var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version );
if( lastVersion != KM.version ) {
if (lastVersion != KM.version) {
$( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version;
}
});
km.on('unziperror', function(ev){
km.on('unziperror', function(ev) {
alert('unziperror');
});
km.on('parseerror', function(ev){
km.on('parseerror', function(ev) {
alert('parseerror');
});
km.on('unknownprotocal', function(ev){
km.on('unknownprotocal', function(ev) {
alert('unknownprotocal');
});
</script>
......
Subproject commit 5382742eb5b1764af2bb4fdf4fa7565318bfbb78
Subproject commit 17b221165e51ee1f69358d4d5bacfe4fe4c7d22c
......@@ -176,8 +176,6 @@ kity.extendClass(Minder, {
root = root || this.getRoot();
var me = this;
if (root.getComplex() > 100) duration = 0;
function apply(node, pMatrix) {
var matrix = node.getLayoutTransform().merge(pMatrix);
var lastMatrix = node._lastLayoutTransform || new kity.Matrix();
......@@ -202,6 +200,11 @@ kity.extendClass(Minder, {
matrix: value
});
}).start(node, duration, 'ease').on('finish', function() {
// 可能性能低的时候会丢帧
me.fire('layoutapply', {
node: node,
matrix: matrix
});
me.fire('layoutfinish', {
node: node,
matrix: matrix
......
......@@ -128,10 +128,7 @@ kity.extendClass(Minder, {
importNode(this._root, json, this);
this._root.preTraverse(function(node) {
node.render();
});
this._root.layout();
this.refresh(500);
this.fire('import', params);
......
......@@ -52,14 +52,12 @@ kity.extendClass(Minder, {
var g = KityMinder.Geometry;
var i, latestBox, renderer;
this.fire('beforerender', {
node: node
});
if (!node._renderers) {
this._createRendererForNode(node);
}
this.fire('beforerender', {node: node});
node._contentBox = g.wrapBox({
left: 0,
right: 0,
......
......@@ -224,7 +224,9 @@ KityMinder.registerModule('Expand', function() {
events: {
'layoutapply': function(e) {
var r = e.node.getRenderer('ExpanderRenderer');
if (r.getRenderShape()) {
r.update(r.getRenderShape(), e.node);
}
},
'preimport': function(e) {
var json = e.json;
......@@ -233,6 +235,7 @@ KityMinder.registerModule('Expand', function() {
var node = e.node;
var visible = !node.parent || node.parent.isExpanded();
node.getRenderContainer().setVisible(visible);
if (!visible) e.stopPropagation();
}
},
renderers: {
......
......@@ -139,7 +139,7 @@ KityMinder.registerModule("KeyboardModule", function() {
var node = e.getTargetNode();
var lang = this.getLang();
this.receiver.keydownNode = node;
if (this.receiver) this.receiver.keydownNode = node;
var keyEvent = e.originEvent;
......
KityMinder.registerModule('Select', function() {
var minder = this;
var rc = minder.getRenderContainer();
var g = KityMinder.Geometry;
// 在实例上渲染框选矩形、计算框选范围的对象
......@@ -26,7 +27,7 @@ KityMinder.registerModule('Select', function() {
return this.selectEnd();
}
startPosition = g.snapToSharp(e.getPosition('paper'));
startPosition = g.snapToSharp(e.getPosition(rc));
},
selectMove: function(e) {
if (minder.getStatus() == 'textedit') {
......@@ -35,9 +36,7 @@ KityMinder.registerModule('Select', function() {
if (!startPosition) return;
var p1 = startPosition,
p2 = e.getPosition('paper');
console.log(e.kityEvent.targetShape);
p2 = e.getPosition(rc);
// 检测是否要进入选区模式
if (!marqueeMode) {
......@@ -47,7 +46,7 @@ KityMinder.registerModule('Select', function() {
}
// 已经达到阈值,记录下来并且重置选区形状
marqueeMode = true;
minder.getPaper().addShape(marqueeShape);
rc.addShape(marqueeShape);
marqueeShape
.fill(minder.getStyle('marquee-background'))
.stroke(minder.getStyle('marquee-stroke')).setOpacity(0.8).getDrawer().clear();
......@@ -71,7 +70,7 @@ KityMinder.registerModule('Select', function() {
// 计算选中范围
minder.getRoot().traverse(function(node) {
var renderBox = node.getRenderContainer().getRenderBox('top');
var renderBox = node.getLayoutBox();
if (g.getIntersectBox(renderBox, marquee)) {
selectedNodes.push(node);
}
......
......@@ -3,7 +3,7 @@ KityMinder.registerModule( 'Zoom', function () {
var timeline;
me.setOptions( 'zoom', [ 50, 80, 100, 120, 150, 200 ] );
me.setDefaultOptions( 'zoom', [ 50, 80, 100, 120, 150, 200 ] );
function zoomMinder( minder, zoom ) {
var paper = minder.getPaper();
......
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