Commit ceb8a7e9 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

parents 9978b295 714c5c66
...@@ -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?_=1399627592968" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js?_=1399633550603" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399627592968" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js?_=1399633550603" 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?_=1399627592968" charset="utf-8"></script> <script src="lib/kitygraph.all.min.js?_=1399633550603" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1399627592968" charset="utf-8"></script> <script src="kityminder.all.min.js?_=1399633550603" charset="utf-8"></script>
<script src="kityminder.config.js?_=1399627592968" charset="utf-8"></script> <script src="kityminder.config.js?_=1399633550603" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1399627592968" charset="utf-8"></script> <script src="lang/zh-cn/zh-cn.js?_=1399633550603" charset="utf-8"></script>
<script src="lib/zip.js?_=1399627592968" charset="utf-8"></script> <script src="lib/zip.js?_=1399633550603" charset="utf-8"></script>
<script> <script>
zip.inflateJSPath = 'lib/inflate.js'; zip.inflateJSPath = 'lib/inflate.js';
</script> </script>
<script src="lib/jquery.xml2json.js?_=1399627592968" charset="utf-8"></script> <script src="lib/jquery.xml2json.js?_=1399633550603" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399627592968" charset="utf-8"></script> <script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399633550603" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1399627592968" charset="utf-8"></script> <script src="social/draftmanager.js?_=1399633550603" charset="utf-8"></script>
<script src="social/social.js?_=1399627592968" charset="utf-8"></script> <script src="social/social.js?_=1399633550603" 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" />
......
/*! /*!
* ==================================================== * ====================================================
* kityminder - v1.0.0 - 2014-05-09 * kityminder - v1.1.3 - 2014-05-09
* https://github.com/fex-team/kityminder * https://github.com/fex-team/kityminder
* GitHub: https://github.com/fex-team/kityminder.git * GitHub: https://github.com/fex-team/kityminder.git
* Copyright (c) 2014 f-cube @ FEX; Licensed MIT * Copyright (c) 2014 f-cube @ FEX; Licensed MIT
...@@ -2438,9 +2438,13 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -2438,9 +2438,13 @@ KityMinder.registerModule( "LayoutModule", function () {
initStyle: function () { initStyle: function () {
var curStyle = this.getCurrentStyle(); var curStyle = this.getCurrentStyle();
this._rc.remove(); this._rc.remove();
var transform = this._rc.transform;
this._rc = new kity.Group(); this._rc = new kity.Group();
this._paper.addShape( this._rc ); this._paper.addShape( this._rc );
this._rc.transform = transform;
this._rc._applyTransform();
var _root = this.getRoot(); var _root = this.getRoot();
_root.preTraverse( function ( n ) { _root.preTraverse( function ( n ) {
n.clearLayout(); n.clearLayout();
...@@ -5328,6 +5332,9 @@ Minder.Range = kity.createClass('Range',{ ...@@ -5328,6 +5332,9 @@ Minder.Range = kity.createClass('Range',{
this.nativeRange = document.createRange(); this.nativeRange = document.createRange();
this.nativeSel = window.getSelection(); this.nativeSel = window.getSelection();
}, },
hasNativeRange : function(){
return this.nativeSel.rangeCount != 0 ;
},
select:function(){ select:function(){
var start = this.nativeRange.startContainer; var start = this.nativeRange.startContainer;
if(start.nodeType == 1 && start.childNodes.length == 0){ if(start.nodeType == 1 && start.childNodes.length == 0){
...@@ -5406,10 +5413,10 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5406,10 +5413,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div.setAttribute( 'contenteditable', true ); _div.setAttribute( 'contenteditable', true );
_div.className = 'km_receiver'; _div.className = 'km_receiver';
this.container = document.body.insertBefore( _div, document.body.firstChild ); this.container = document.body.insertBefore( _div, document.body.firstChild );
if(browser.ie && browser.version == 11){ if ( browser.ie && browser.version == 11 ) {
utils.listen(this.container,'keydown keypress keyup',function(e){ utils.listen( this.container, 'keydown keypress keyup', function ( e ) {
me.keyboardEvents.call(me,new MinderEvent(e.type == 'keyup' ? "beforekeyup": e.type,e)) me.keyboardEvents.call( me, new MinderEvent( e.type == 'keyup' ? "beforekeyup" : e.type, e ) )
}) } )
} }
utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); // utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); //
this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) ); this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) );
...@@ -5435,7 +5442,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5435,7 +5442,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape = new kity.Text(); textShape = new kity.Text();
} }
this.textShape = textShape; this.textShape = textShape;
this.container.innerHTML = utils.unhtml(textShape.getContent()); this.container.innerHTML = utils.unhtml( textShape.getContent() );
return this; return this;
}, },
setTextShapeSize: function ( size ) { setTextShapeSize: function ( size ) {
...@@ -5466,6 +5473,9 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5466,6 +5473,9 @@ Minder.Receiver = kity.createClass( 'Receiver', {
var keys = KityMinder.keymap; var keys = KityMinder.keymap;
function setTextToContainer() { function setTextToContainer() {
if(!me.range.hasNativeRange()){
return;
}
var text = me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ); var text = me.container.textContent.replace( /[\u200b\t\r\n]/g, '' );
if ( me.textShape.getOpacity() == 0 ) { if ( me.textShape.getOpacity() == 0 ) {
...@@ -5530,7 +5540,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5530,7 +5540,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout( function () { setTimeout( function () {
me.range.updateNativeRange().insertNode( $( '<span>$$_kityminder_bookmark_$$</span>' )[ 0 ] ); me.range.updateNativeRange().insertNode( $( '<span>$$_kityminder_bookmark_$$</span>' )[ 0 ] );
me.container.innerHTML = utils.unhtml(me.container.textContent.replace( /[\u200b\t\r\n]/g, '' )); me.container.innerHTML = utils.unhtml( me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ) );
var index = me.container.textContent.indexOf( '$$_kityminder_bookmark_$$' ); var index = me.container.textContent.indexOf( '$$_kityminder_bookmark_$$' );
me.container.textContent = me.container.textContent.replace( '$$_kityminder_bookmark_$$', '' ); me.container.textContent = me.container.textContent.replace( '$$_kityminder_bookmark_$$', '' );
me.range.setStart( me.container.firstChild, index ).collapse( true ).select(); me.range.setStart( me.container.firstChild, index ).collapse( true ).select();
...@@ -5559,7 +5569,6 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5559,7 +5569,6 @@ Minder.Receiver = kity.createClass( 'Receiver', {
break; break;
case 'beforekeyup': case 'beforekeyup':
switch ( keyCode ) { switch ( keyCode ) {
case keymap.Enter: case keymap.Enter:
case keymap.Tab: case keymap.Tab:
...@@ -5619,10 +5628,10 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5619,10 +5628,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
}, },
getBaseOffset: function ( refer ) { getBaseOffset: function ( refer ) {
var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() ); var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() );
// if(!this.pr) { // if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green')); // this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// } // }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y); // this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return rb; return rb;
}, },
setBaseOffset: function () { setBaseOffset: function () {
...@@ -5630,18 +5639,18 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5630,18 +5639,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this; return this;
}, },
setContainerStyle: function () { setContainerStyle: function () {
var textShapeBox = this.getBaseOffset('screen'); var textShapeBox = this.getBaseOffset( 'screen' );
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;'; this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
if(!this.selection.isShow()){ if ( !this.selection.isShow() ) {
var paperContainer = this.km.getPaper(); var paperContainer = this.km.getPaper();
var width = paperContainer.node.parentNode.clientWidth; var width = paperContainer.node.parentNode.clientWidth;
var height = paperContainer.node.parentNode.clientHeight; var height = paperContainer.node.parentNode.clientHeight;
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();
}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()
} }
} }
...@@ -5657,7 +5666,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5657,7 +5666,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
try { try {
var box = this.textShape.getExtentOfChar( i ); var box = this.textShape.getExtentOfChar( i );
} catch ( e ) { } catch ( e ) {
console.log(e) console.log( e )
} }
this.textData.push( { this.textData.push( {
...@@ -5735,7 +5744,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5735,7 +5744,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 && i != me.textData.length - 1 ? 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 );
} }
...@@ -5753,15 +5762,15 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -5753,15 +5762,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset = this.textData[ this.selection.endOffset ], endOffset = this.textData[ this.selection.endOffset ],
width = 0; width = 0;
if ( this.selection.collapsed ) { if ( this.selection.collapsed ) {
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ],1 ); this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ], 1 );
return this; return this;
} }
if ( !endOffset ) { if ( !endOffset ) {
try{ try {
var lastOffset = this.textData[ this.textData.length - 1 ]; var lastOffset = this.textData[ this.textData.length - 1 ];
width = lastOffset.x - startOffset.x + lastOffset.width; width = lastOffset.x - startOffset.x + lastOffset.width;
}catch(e){ } catch ( e ) {
console.log('e') console.log( 'e' )
} }
} else { } else {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4846,7 +4846,8 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", " ...@@ -4846,7 +4846,8 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
var svg = require("graphic/svg"); var svg = require("graphic/svg");
var offsetHash = {}; var offsetHash = {};
function getTextBoundOffset(text) { function getTextBoundOffset(text) {
var font = window.getComputedStyle(text.node).font; var style = window.getComputedStyle(text.node);
var font = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-");
if (offsetHash[font]) { if (offsetHash[font]) {
return offsetHash[font]; return offsetHash[font];
} }
...@@ -4866,9 +4867,6 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", " ...@@ -4866,9 +4867,6 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
if (content !== undefined) { if (content !== undefined) {
this.setContent(content); this.setContent(content);
} }
this.whenPaperReady(function() {
this.setVerticalAlign(this.verticalAlign);
});
}, },
setX: function(x) { setX: function(x) {
this.node.setAttribute("x", x); this.node.setAttribute("x", x);
...@@ -4900,24 +4898,26 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", " ...@@ -4900,24 +4898,26 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
}, },
// top/bottom/middle/baseline // top/bottom/middle/baseline
setVerticalAlign: function(align) { setVerticalAlign: function(align) {
var dy; this.whenPaperReady(function() {
switch (align) { var dy;
case "top": switch (align) {
dy = getTextBoundOffset(this).top; case "top":
break; dy = getTextBoundOffset(this).top;
break;
case "bottom": case "bottom":
dy = getTextBoundOffset(this).bottom; dy = getTextBoundOffset(this).bottom;
break; break;
case "middle": case "middle":
dy = getTextBoundOffset(this).middle; dy = getTextBoundOffset(this).middle;
break; break;
default: default:
dy = 0; dy = 0;
} }
this.node.setAttribute("dy", dy); this.node.setAttribute("dy", dy);
});
this.verticalAlign = align; this.verticalAlign = align;
return this; return this;
}, },
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "kityminder", "name": "kityminder",
"title": "kityminder", "title": "kityminder",
"description": "Kity Minder", "description": "Kity Minder",
"version": "1.0.0", "version": "1.1.3",
"homepage": "https://github.com/fex-team/kityminder", "homepage": "https://github.com/fex-team/kityminder",
"author": { "author": {
"name": "f-cube @ FEX", "name": "f-cube @ FEX",
...@@ -23,12 +23,10 @@ ...@@ -23,12 +23,10 @@
"bugs": { "bugs": {
"url": "https://github.com/fex-team/kityminder/issues" "url": "https://github.com/fex-team/kityminder/issues"
}, },
"licenses": [ "licenses": [ {
{ "type": "MIT",
"type": "MIT", "url": "https://github.com/fex-team/kityminder/blob/dev/LICENSE"
"url": "https://github.com/fex-team/kityminder/blob/dev/LICENSE" } ],
}
],
"dependencies": {}, "dependencies": {},
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",
......
...@@ -23,10 +23,10 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -23,10 +23,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div.setAttribute( 'contenteditable', true ); _div.setAttribute( 'contenteditable', true );
_div.className = 'km_receiver'; _div.className = 'km_receiver';
this.container = document.body.insertBefore( _div, document.body.firstChild ); this.container = document.body.insertBefore( _div, document.body.firstChild );
if(browser.ie && browser.version == 11){ if ( browser.ie && browser.version == 11 ) {
utils.listen(this.container,'keydown keypress keyup',function(e){ utils.listen( this.container, 'keydown keypress keyup', function ( e ) {
me.keyboardEvents.call(me,new MinderEvent(e.type == 'keyup' ? "beforekeyup": e.type,e)) me.keyboardEvents.call( me, new MinderEvent( e.type == 'keyup' ? "beforekeyup" : e.type, e ) )
}) } )
} }
utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); // utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); //
this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) ); this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) );
...@@ -52,7 +52,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -52,7 +52,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape = new kity.Text(); textShape = new kity.Text();
} }
this.textShape = textShape; this.textShape = textShape;
this.container.innerHTML = utils.unhtml(textShape.getContent()); this.container.innerHTML = utils.unhtml( textShape.getContent() );
return this; return this;
}, },
setTextShapeSize: function ( size ) { setTextShapeSize: function ( size ) {
...@@ -150,7 +150,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -150,7 +150,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout( function () { setTimeout( function () {
me.range.updateNativeRange().insertNode( $( '<span>$$_kityminder_bookmark_$$</span>' )[ 0 ] ); me.range.updateNativeRange().insertNode( $( '<span>$$_kityminder_bookmark_$$</span>' )[ 0 ] );
me.container.innerHTML = utils.unhtml(me.container.textContent.replace( /[\u200b\t\r\n]/g, '' )); me.container.innerHTML = utils.unhtml( me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ) );
var index = me.container.textContent.indexOf( '$$_kityminder_bookmark_$$' ); var index = me.container.textContent.indexOf( '$$_kityminder_bookmark_$$' );
me.container.textContent = me.container.textContent.replace( '$$_kityminder_bookmark_$$', '' ); me.container.textContent = me.container.textContent.replace( '$$_kityminder_bookmark_$$', '' );
me.range.setStart( me.container.firstChild, index ).collapse( true ).select(); me.range.setStart( me.container.firstChild, index ).collapse( true ).select();
...@@ -238,10 +238,10 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -238,10 +238,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
}, },
getBaseOffset: function ( refer ) { getBaseOffset: function ( refer ) {
var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() ); var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() );
// if(!this.pr) { // if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green')); // this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// } // }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y); // this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return rb; return rb;
}, },
setBaseOffset: function () { setBaseOffset: function () {
...@@ -249,18 +249,18 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -249,18 +249,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this; return this;
}, },
setContainerStyle: function () { setContainerStyle: function () {
var textShapeBox = this.getBaseOffset('screen'); var textShapeBox = this.getBaseOffset( 'screen' );
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;'; this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
if(!this.selection.isShow()){ if ( !this.selection.isShow() ) {
var paperContainer = this.km.getPaper(); var paperContainer = this.km.getPaper();
var width = paperContainer.node.parentNode.clientWidth; var width = paperContainer.node.parentNode.clientWidth;
var height = paperContainer.node.parentNode.clientHeight; var height = paperContainer.node.parentNode.clientHeight;
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();
}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()
} }
} }
...@@ -276,7 +276,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -276,7 +276,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
try { try {
var box = this.textShape.getExtentOfChar( i ); var box = this.textShape.getExtentOfChar( i );
} catch ( e ) { } catch ( e ) {
console.log(e) console.log( e )
} }
this.textData.push( { this.textData.push( {
...@@ -354,7 +354,7 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -354,7 +354,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 && i != me.textData.length - 1 ? 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 );
} }
...@@ -372,15 +372,15 @@ Minder.Receiver = kity.createClass( 'Receiver', { ...@@ -372,15 +372,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset = this.textData[ this.selection.endOffset ], endOffset = this.textData[ this.selection.endOffset ],
width = 0; width = 0;
if ( this.selection.collapsed ) { if ( this.selection.collapsed ) {
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ],1 ); this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ], 1 );
return this; return this;
} }
if ( !endOffset ) { if ( !endOffset ) {
try{ try {
var lastOffset = this.textData[ this.textData.length - 1 ]; var lastOffset = this.textData[ this.textData.length - 1 ];
width = lastOffset.x - startOffset.x + lastOffset.width; width = lastOffset.x - startOffset.x + lastOffset.width;
}catch(e){ } catch ( e ) {
console.log('e') console.log( 'e' )
} }
} else { } else {
......
...@@ -41,9 +41,13 @@ KityMinder.registerModule( "LayoutModule", function () { ...@@ -41,9 +41,13 @@ KityMinder.registerModule( "LayoutModule", function () {
initStyle: function () { initStyle: function () {
var curStyle = this.getCurrentStyle(); var curStyle = this.getCurrentStyle();
this._rc.remove(); this._rc.remove();
var transform = this._rc.transform;
this._rc = new kity.Group(); this._rc = new kity.Group();
this._paper.addShape( this._rc ); this._paper.addShape( this._rc );
this._rc.transform = transform;
this._rc._applyTransform();
var _root = this.getRoot(); var _root = this.getRoot();
_root.preTraverse( function ( n ) { _root.preTraverse( function ( n ) {
n.clearLayout(); n.clearLayout();
......
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