Commit 5e687016 authored by techird's avatar techird

Animate support && text fix

parent 1926eda1
......@@ -10,6 +10,7 @@ define(function(require, exports, module) {
var Minder = require('./minder');
var animateDefaultOptions = {
enableAnimation: true,
layoutAnimationDuration: 300,
viewAnimationDuration: 100,
zoomAnimationDuration: 300
......@@ -18,6 +19,9 @@ define(function(require, exports, module) {
Minder.registerInitHook(function() {
this.setDefaultOptions(animateDefaultOptions);
if (!this.getOption('enableAnimation')) {
this.disableAnimation();
}
});
Minder.prototype.enableAnimation = function() {
......
......@@ -98,15 +98,11 @@ define(function(require, exports, module) {
base: Command,
execute: function(km, text) {
var nodes = km.getSelectedNodes();
if (!nodes.length) return;
var parent = nodes[0].parent;
for (var i = 1; i < nodes.length; i++) {
if (nodes[i].parent != parent) return -1;
}
nodes.sort(function(a, b) {
return a.getIndex() - b.getIndex();
});
var parent = nodes[0].parent;
var newParent = km.createNode(text, parent, nodes[0].getIndex());
nodes.forEach(function(node) {
......@@ -121,6 +117,7 @@ define(function(require, exports, module) {
var nodes = km.getSelectedNodes();
if (!nodes.length) return;
var parent = nodes[0].parent;
if (!parent) return -1;
for (var i = 1; i < nodes.length; i++) {
if (nodes[i].parent != parent) return -1;
}
......
......@@ -74,6 +74,9 @@ define(function(require, exports, module) {
for (i = 0, text, textShape;
(text = textArr[i], textShape = textGroup.getItem(i)); i++) {
textShape.setContent(text);
if (kity.Browser.ie) {
textShape.fixPosition();
}
}
this.setTextStyle(node, textGroup);
......
......@@ -104,6 +104,8 @@ define(function(require, exports, module) {
}
var paper = dragger._minder.getPaper();
paper.setStyle('cursor', dragger._minder.getStatus() == 'hand' ? '-webkit-grab' : 'default');
dragger._minder.fire('viewchanged');
}
this._minder.on('normal.mousedown normal.touchstart ' +
......@@ -296,6 +298,12 @@ define(function(require, exports, module) {
y: dy / 2.5
});
var me = this;
clearTimeout(this._mousewheeltimer);
this._mousewheeltimer = setTimeout(function() {
me.fire('viewchanged');
}, 100);
e.preventDefault();
},
'normal.dblclick readonly.dblclick': function(e) {
......
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