Commit e67dffb4 authored by techird's avatar techird

fixing something...

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