Commit 32ddd2cd authored by techird's avatar techird

dev

parent ccaa40c1
......@@ -239,6 +239,7 @@ define(function(require, exports, module) {
},
getRenderer: function(type) {
var rs = this._renderers;
if (!rs) return null;
for (var i = 0; i < rs.length; i++) {
if (rs[i].getType() == type) return rs[i];
}
......@@ -249,7 +250,8 @@ define(function(require, exports, module) {
return this.parent && this.parent.isCollapsed() ? new kity.Box() : (this._contentBox || new kity.Box());
},
getRenderBox: function(rendererType, refer) {
var contentBox = rendererType ? this.getRenderer(rendererType).contentBox : this.getContentBox();
var renderer = rendererType && this.getRenderer(rendererType);
var contentBox = renderer ? renderer.contentBox : this.getContentBox();
var ctm = kity.Matrix.getCTM(this.getRenderContainer(), refer || 'paper');
return ctm.transformBox(contentBox);
}
......
......@@ -26,6 +26,9 @@ define(function(require, exports, module) {
function sendToClipboard(nodes) {
if (!nodes.length) return;
nodes.sort(function(a, b) {
return b.getIndex() - a.getIndex();
});
_clipboardNodes = nodes.map(function(node) {
return node.clone();
});
......
......@@ -326,20 +326,21 @@ define(function(require, exports, module) {
var dragger = this._viewDragger;
var view = dragger.getView();
var focus = selected.getLayoutBox();
var space = 50;
var space = 150;
var tolerance = 150;
var dx = 0,
dy = 0;
if (focus.right > view.right) {
if (focus.right > view.right - tolerance) {
dx += view.right - focus.right - space;
} else if (focus.left < view.left) {
} else if (focus.left < view.left + tolerance) {
dx += view.left - focus.left + space;
}
if (focus.bottom > view.bottom) {
if (focus.bottom > view.bottom - tolerance) {
dy += view.bottom - focus.bottom - space;
}
if (focus.top < view.top) {
if (focus.top < view.top + tolerance) {
dy += view.top - focus.top + space;
}
......
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