Commit 4bb6399b authored by techird's avatar techird

Merge branch 'dev' of github.com:fex-team/kityminder into dev

parents a5cb96ee 0a733593
...@@ -7,26 +7,26 @@ ...@@ -7,26 +7,26 @@
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"> <meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js?_=1399615757955" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js?_=1399624214062" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399615757955" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js?_=1399624214062" charset="utf-8"></script>
<script type="text/javascript"> <script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } ); ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script> </script>
<script src="lib/kitygraph.all.min.js?_=1399615757955" charset="utf-8"></script> <script src="lib/kitygraph.all.min.js?_=1399624214062" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1399615757955" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1399624214062" charset="utf-8"></script>
<script src="kityminder.config.js?_=1399615757955" charset="utf-8"></script> <script src="kityminder.config.js?_=1399624214062" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1399615757955" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1399624214062" charset="utf-8"></script>
<script src="lib/zip.js?_=1399615757955" charset="utf-8"></script> <script src="lib/zip.js?_=1399624214062" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="lib/jquery.xml2json.js?_=1399615757955" charset="utf-8"></script> <script src="lib/jquery.xml2json.js?_=1399624214062" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399615757955" charset="utf-8"></script> <script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399624214062" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1399615757955" charset="utf-8"></script> <script src="social/draftmanager.js?_=1399624214062" charset="utf-8"></script>
<script src="social/social.js?_=1399615757955" charset="utf-8"></script> <script src="social/social.js?_=1399624214062" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet"> <link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" /> <link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
......
...@@ -2915,7 +2915,7 @@ KityMinder.registerModule( "LayoutDefault", function () { ...@@ -2915,7 +2915,7 @@ KityMinder.registerModule( "LayoutDefault", function () {
} }
for ( var i = 0; i < children.length; i++ ) { for ( var i = 0; i < children.length; i++ ) {
var childLayout = children[ i ].getLayout(); var childLayout = children[ i ].getLayout();
if ( children[ i ].getRenderContainer().getHeight() !== 0 ) if ( children[ i ].getRenderContainer().getPaper() && children[ i ].getRenderContainer().getHeight() !== 0 )
sum += childLayout.branchheight; sum += childLayout.branchheight;
} }
return sum; return sum;
...@@ -5619,17 +5619,25 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5619,17 +5619,25 @@ Minder.Receiver = kity.createClass( 'Receiver', {
}, },
setContainerStyle: function () { setContainerStyle: function () {
var textShapeBox = this.getBaseOffset('screen'); var textShapeBox = this.getBaseOffset('screen');
var me = this;
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 5 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;'; this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 5 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
var paperContainer = this.km.getPaper();
var width = paperContainer.getWidth(); if(!this.selection.isShow()){
var height = paperContainer.getHeight(); var paperContainer = this.km.getPaper();
var containerWidth = this.container.offsetWidth; var width = paperContainer.node.parentNode.clientWidth;
if(width < containerWidth + this.container.offsetLeft){ var height = paperContainer.node.parentNode.clientHeight;
this.km.getRenderContainer().fxTranslate(width/-2, 0, 200, "ease", 0, function() {
me.setContainerStyle() if(width < this.container.offsetWidth + this.container.offsetLeft){
}); this.km.getRenderContainer().translate(width/-3, 0);
this.setContainerStyle();
}else if (height < this.container.offsetTop + this.container.offsetHeight){
this.km.getRenderContainer().translate(0, height/-3);
this.setContainerStyle()
}
} }
return this; return this;
}, },
getTextOffsetData: function () { getTextOffsetData: function () {
...@@ -5718,7 +5726,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5718,7 +5726,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me.selection.setEndOffset( i + 1 ) me.selection.setEndOffset( i + 1 )
} else { } else {
if ( dir == 1 ) { if ( dir == 1 ) {
me.selection.setStartOffset( i + ( offset.x >= v.x + v.width / 2 ? 1 : 0 ) ); me.selection.setStartOffset( i + ( offset.x >= v.x + v.width / 2 && i < me.textData.length - 1 ? 1 : 0 ) );
} else { } else {
me.selection.setStartOffset( i ); me.selection.setStartOffset( i );
} }
...@@ -5740,8 +5748,13 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5740,8 +5748,13 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this; return this;
} }
if ( !endOffset ) { if ( !endOffset ) {
var lastOffset = this.textData[ this.textData.length - 1 ]; try{
width = lastOffset.x - startOffset.x + lastOffset.width; var lastOffset = this.textData[ this.textData.length - 1 ];
width = lastOffset.x - startOffset.x + lastOffset.width;
}catch(e){
console.log(e)
}
} else { } else {
width = endOffset.x - startOffset.x; width = endOffset.x - startOffset.x;
} }
...@@ -5782,6 +5795,7 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -5782,6 +5795,7 @@ Minder.Selection = kity.createClass( 'Selection', {
this.startOffset = this.endOffset = 0; this.startOffset = this.endOffset = 0;
this.setOpacity(0.5); this.setOpacity(0.5);
this.setStyle('cursor','text'); this.setStyle('cursor','text');
this._show = false;
}, },
collapse : function(toEnd){ collapse : function(toEnd){
...@@ -5855,11 +5869,13 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -5855,11 +5869,13 @@ Minder.Selection = kity.createClass( 'Selection', {
setHide: function () { setHide: function () {
clearInterval( this.timer ); clearInterval( this.timer );
this.setStyle( 'display', 'none' ); this.setStyle( 'display', 'none' );
this._show = false;
return this; return this;
}, },
setShowHold: function () { setShowHold: function () {
clearInterval( this.timer ); clearInterval( this.timer );
this.setStyle( 'display', '' ); this.setStyle( 'display', '' );
this._show = true;
return this; return this;
}, },
setShow: function () { setShow: function () {
...@@ -5867,7 +5883,7 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -5867,7 +5883,7 @@ Minder.Selection = kity.createClass( 'Selection', {
var me = this, var me = this,
state = ''; state = '';
me.setStyle( 'display', '' ); me.setStyle( 'display', '' );
me._show = true;
if(this.collapsed){ if(this.collapsed){
me.setOpacity(1); me.setOpacity(1);
this.timer = setInterval( function () { this.timer = setInterval( function () {
...@@ -5878,6 +5894,9 @@ Minder.Selection = kity.createClass( 'Selection', { ...@@ -5878,6 +5894,9 @@ Minder.Selection = kity.createClass( 'Selection', {
return this; return this;
}, },
isShow:function(){
return this._show;
},
setTextShape: function ( text ) { setTextShape: function ( text ) {
if ( !text ) { if ( !text ) {
this.text = new kity.Text(); this.text = new kity.Text();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -246,9 +246,9 @@ var utils = Utils = KityMinder.Utils = { ...@@ -246,9 +246,9 @@ var utils = Utils = KityMinder.Utils = {
element.onload = element.onreadystatechange = null; element.onload = element.onreadystatechange = null;
} }
}; };
element.onerror = function () { // element.onerror = function () {
throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file ') // throw Error('The load ' + (obj.href || obj.src) + ' fails,check the url settings of file ')
}; // };
doc.getElementsByTagName("head")[0].appendChild(element); doc.getElementsByTagName("head")[0].appendChild(element);
} }
}(), }(),
......
...@@ -19,7 +19,7 @@ Minder.Range = kity.createClass('Range',{ ...@@ -19,7 +19,7 @@ Minder.Range = kity.createClass('Range',{
try{ try{
this.nativeRange.setStart(node,index); this.nativeRange.setStart(node,index);
}catch(e){ }catch(e){
console.log(e) console.log('e')
} }
return this; return this;
......
...@@ -250,12 +250,12 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -250,12 +250,12 @@ Minder.Receiver = kity.createClass( 'Receiver', {
if(width < this.container.offsetWidth + this.container.offsetLeft){ if(width < this.container.offsetWidth + this.container.offsetLeft){
this.km.getRenderContainer().translate(width/-3, 0); this.km.getRenderContainer().translate(width/-3, 0);
//this.setContainerStyle(); this.setContainerStyle();
console.log(width, this.container.offsetWidth + this.container.offsetLeft);
}else if (height < this.container.offsetTop + this.container.offsetHeight){ }else if (height < this.container.offsetTop + this.container.offsetHeight){
this.km.getRenderContainer().translate(0, height/-3); this.km.getRenderContainer().translate(0, height/-3);
//this.setContainerStyle() this.setContainerStyle()
} }
} }
...@@ -340,7 +340,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -340,7 +340,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
if ( offset.x <= v.x + v.width / 2 ) { if ( offset.x <= v.x + v.width / 2 ) {
me.selection.collapse() me.selection.collapse()
} else { } else {
me.selection.setEndOffset( i + ( me.selection.endOffset > i || dir == 1 ? 1 : 0 ) ) me.selection.setEndOffset( i + ( ( me.selection.endOffset > i || dir == 1 ) && i != me.textData.length - 1 ? 1 : 0 ) )
} }
} else if ( i > me.index ) { } else if ( i > me.index ) {
...@@ -348,7 +348,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -348,7 +348,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
me.selection.setEndOffset( i + 1 ) me.selection.setEndOffset( i + 1 )
} else { } else {
if ( dir == 1 ) { if ( dir == 1 ) {
me.selection.setStartOffset( i + ( offset.x >= v.x + v.width / 2 ? 1 : 0 ) ); me.selection.setStartOffset( i + ( offset.x >= v.x + v.width / 2 && i != me.textData.length - 1 ? 1 : 0 ) );
} else { } else {
me.selection.setStartOffset( i ); me.selection.setStartOffset( i );
} }
...@@ -370,8 +370,13 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -370,8 +370,13 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this; return this;
} }
if ( !endOffset ) { if ( !endOffset ) {
var lastOffset = this.textData[ this.textData.length - 1 ]; try{
width = lastOffset.x - startOffset.x + lastOffset.width; var lastOffset = this.textData[ this.textData.length - 1 ];
width = lastOffset.x - startOffset.x + lastOffset.width;
}catch(e){
console.log('e')
}
} else { } else {
width = endOffset.x - startOffset.x; width = endOffset.x - startOffset.x;
} }
......
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