Commit 5e687016 authored by techird's avatar techird

Animate support && text fix

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