Commit 8ded3fe6 authored by campaign's avatar campaign

Merge branch 'release-1.2.0' of https://github.com/fex-team/kityminder into release-1.2.0

parents 7dc99d33 d81b8019
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
<meta name="title" content="百度脑图(KityMinder)"> <meta name="title" content="百度脑图(KityMinder)">
<meta name="keyword" content="kityminder,脑图,思维导图,kity,svg,minder,百度,fex,前端,在线"> <meta name="keyword" content="kityminder,脑图,思维导图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。"> <meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script> <script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js" charset="utf-8"></script> <script src="lib/ZeroClipboard.min.js" charset="utf-8"></script>
...@@ -34,6 +35,7 @@ ...@@ -34,6 +35,7 @@
</head> </head>
<body> <body>
<div id="content-wrapper">
<div id="panel"></div> <div id="panel"></div>
<div id="kityminder" onselectstart="return false"></div> <div id="kityminder" onselectstart="return false"></div>
...@@ -94,6 +96,7 @@ ...@@ -94,6 +96,7 @@
target="_blank">Contact Us target="_blank">Contact Us
</a> </a>
</div> </div>
</div>
</body> </body>
<!--脑图启动代码--> <!--脑图启动代码-->
...@@ -124,6 +127,10 @@ ...@@ -124,6 +127,10 @@
km.on('unknownprotocal', function(ev) { km.on('unknownprotocal', function(ev) {
alert('不支持的文件格式!'); alert('不支持的文件格式!');
}); });
document.body.ontouchmove = function(e) {
//e.preventDefault();
}
</script> </script>
<!--社会分享代码--> <!--社会分享代码-->
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="lib/jquery-2.1.0.min.js" charset="utf-8"></script>
<script src="kity/dist/kitygraph.all.js" charset="utf-8"></script>
<script src="import.js" charset="utf-8"></script>
<script src="kityminder.config.js" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js" charset="utf-8"></script>
<script src="lib/zip.js" charset="utf-8"></script>
<script>
zip.inflateJSPath = 'lib/inflate.js';
</script>
<script src="lib/jquery.xml2json.js" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js" charset="utf-8"></script>
<script src="social/social.js" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon">
<link href="favicon.ico" type="image/x-icon" rel="apple-touch-icon-precomposed">
<style>
.kmui-toolbar, #social button#save-btn, #draft-btn, .user-file-menu li:first-child {
display: none;
}
</style>
</head>
<body>
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<h3>URL分享:</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">复制</button>
</p>
<h3>社交分享:</h3>
<p id="share-platform" class="bdsharebuttonbox">
<a href="#" class="bds_tsina" data-cmd="tsina" title="分享到新浪微博"></a>
<a href="#" class="bds_qzone" data-cmd="qzone" title="分享到QQ空间"></a>
<a href="#" class="bds_tqq" data-cmd="tqq" title="分享到腾讯微博"></a>
<a href="#" class="bds_renren" data-cmd="renren" title="分享到人人网"></a>
<a href="#" class="bds_weixin" data-cmd="weixin" title="分享到微信"></a>
</p>
</div>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
</body>
<script>
// create km instance
window.km = KM.getKityMinder('kityminder');
//km.setDisabled();
km.execCommand('hand');
</script>
</html>
\ No newline at end of file
.niceblue { .niceblue{color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}
color: white; .dropdown{padding-right:28px;position:relative}.dropdown:after{content:' ';display:block;position:absolute;right:10px;top:12px;width:0;height:0;border:solid;border-width:4px 5px;border-color:#333 transparent transparent transparent}
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); .dropdown:active:after,.dropdown.active:after{border-color:#fff transparent transparent transparent}
/* FF3.6+ */ button{font-family:Arial,"Heiti SC","Microsoft Yahei";outline:none;display:inline-block;vertical-align:middle;padding:0 15px;height:30px;font-size:13px;line-height:30px;text-align:center;color:#000;text-decoration:none;border:none;margin-left:5px;background:none;color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}button:hover,button.hover{background:#009fff}
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0099f2), color-stop(0%, #4096ee), color-stop(100%, #0076dd)); button:active,button.active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)}
/* Chrome,Safari4+ */ button[disabled]{cursor:default;background:#ccc}
background: -webkit-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); .draft-menu.kmui-dropdown-menu{margin-top:24px;margin-left:1px}.draft-menu.kmui-dropdown-menu span.update-time{float:right;color:#ccc;margin-left:40px;padding-right:16px}
/* Chrome10+,Safari5.1+ */ .draft-menu.kmui-dropdown-menu li.draft-item a{position:relative}.draft-menu.kmui-dropdown-menu li.draft-item a:before{content:' ';display:block;width:24px;height:24px;background:url(../themes/default/images/draft.png) no-repeat 0 -24px;position:absolute;left:4px;top:2px}
background: -o-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); .draft-menu.kmui-dropdown-menu li.draft-item:hover a:before{background-position:0 -48px}
/* Opera 11.10+ */ .draft-menu.kmui-dropdown-menu li.draft-item{position:relative}.draft-menu.kmui-dropdown-menu li.draft-item:hover a.delete{display:block}
background: -ms-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); .draft-menu.kmui-dropdown-menu li.draft-item a.delete{display:none;cursor:pointer;position:absolute;width:20px;height:20px;right:4px;top:4px;padding:0;background:url(../themes/default/images/close-button.png) no-repeat 0 0}.draft-menu.kmui-dropdown-menu li.draft-item a.delete:before{display:none}
/* IE10+ */ .draft-menu.kmui-dropdown-menu li.draft-item a.delete:hover{background-position:0 -20px}
background: linear-gradient(to bottom, #0099f2 0%, #4096ee 0%, #0076dd 100%); .draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked{overflow:hidden;opacity:1;color:#ccc}.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-icon{float:left;margin:5px 0;width:28px;background-position:center 0;opacity:.3}
/* W3C */ .draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-item-label{display:block;margin-left:28px}
} .draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover{color:#ccc}.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon{background-position:center 0}
.dropdown { .file-menu.kmui-dropdown-menu{margin-top:24px;margin-left:1px;box-shadow:0 1px 5px rgba(0,0,0,0.3)}.file-menu.kmui-dropdown-menu #save-button,.file-menu.kmui-dropdown-menu #manage-file-button{display:none}
padding-right: 28px; .file-menu.kmui-dropdown-menu.logined #save-button,.file-menu.kmui-dropdown-menu.logined #manage-file-button{display:block}
position: relative; .file-menu.kmui-dropdown-menu.logined #net-hint-buttom{display:none}
} .user-menu.kmui-dropdown-menu{margin-top:24px;margin-left:-25px;min-width:130px;box-shadow:0 1px 5px rgba(0,0,0,0.3)}.user-menu.kmui-dropdown-menu li a{padding-left:40px}
.dropdown:after { #share-dialog{position:absolute;padding:20px;left:50%;top:40%;margin-left:-175px;margin-top:-100px;background:#fff;width:350px;box-shadow:1px 2px 16px rgba(0,0,0,0.5);display:none}#share-dialog h3{margin:0;font-size:16px;color:#666}
content: ' '; #share-dialog input{width:255px;height:22px;line-height:22px;padding:4px 4px 0;border:1px solid #999;vertical-align:middle;margin-right:3px;background:#eee}#share-dialog input:focus{border:1px solid #99f;outline:none}
display: block; #share-dialog p,#share-dialog #share-platform{margin:20px 0 30px}
position: absolute; #share-dialog #copy-share-url{display:inline-block;margin:0;width:75px;height:28px;line-height:28px;vertical-align:middle;color:#fff;background:-moz-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0, #0099f2), color-stop(0, #4096ee), color-stop(100%, #0076dd));background:-webkit-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-o-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:-ms-linear-gradient(top, #0099f2 0, #4096ee 0, #0076dd 100%);background:linear-gradient(to bottom, #0099f2 0, #4096ee 0, #0076dd 100%);}#share-dialog #copy-share-url:hover,#share-dialog #copy-share-url.hover{background:#009fff}
right: 10px; #share-dialog #copy-share-url:active,#share-dialog #copy-share-url.active{background:#007fcc;box-shadow:inset 0 2px 3px rgba(0,0,0,0.2)}
top: 12px; #share-dialog #share-platform{margin-bottom:0}
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #333 transparent transparent transparent;
}
.dropdown:active:after,
.dropdown.active:after {
border-color: #fff transparent transparent transparent;
}
button {
font-family: Arial, "Heiti SC", "Microsoft Yahei";
outline: none;
display: inline-block;
vertical-align: middle;
padding: 0 15px;
height: 30px;
font-size: 13px;
line-height: 30px;
text-align: center;
color: #000;
text-decoration: none;
border: none;
margin-left: 5px;
background: none;
color: white;
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0099f2), color-stop(0%, #4096ee), color-stop(100%, #0076dd));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* W3C */
}
button:hover,
button.hover {
background: #009fff;
}
button:active,
button.active {
background: #007fcc;
box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
}
button[disabled] {
cursor: default;
background: #ccc;
}
.draft-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: 1px;
}
.draft-menu.kmui-dropdown-menu span.update-time {
float: right;
color: #CCC;
margin-left: 40px;
padding-right: 16px;
}
.draft-menu.kmui-dropdown-menu li.draft-item a {
position: relative;
}
.draft-menu.kmui-dropdown-menu li.draft-item a:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/draft.png) no-repeat 0 -24px;
position: absolute;
left: 4px;
top: 2px;
}
.draft-menu.kmui-dropdown-menu li.draft-item:hover a:before {
background-position: 0 -48px;
}
.draft-menu.kmui-dropdown-menu li.draft-item {
position: relative;
}
.draft-menu.kmui-dropdown-menu li.draft-item:hover a.delete {
display: block;
}
.draft-menu.kmui-dropdown-menu li.draft-item a.delete {
display: none;
cursor: pointer;
position: absolute;
width: 20px;
height: 20px;
right: 4px;
top: 4px;
padding: 0;
background: url(../themes/default/images/close-button.png) no-repeat 0 0;
}
.draft-menu.kmui-dropdown-menu li.draft-item a.delete:before {
display: none;
}
.draft-menu.kmui-dropdown-menu li.draft-item a.delete:hover {
background-position: 0 -20px;
}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked {
overflow: hidden;
opacity: 1;
color: #CCC;
}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-icon {
float: left;
margin: 5px 0;
width: 28px;
background-position: center 0;
opacity: .3;
}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked .kmui-combobox-item-label {
display: block;
margin-left: 28px;
}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover {
color: #CCC;
}
.draft-menu.kmui-dropdown-menu.kmui-combobox-menu .kmui-combobox-checked:hover .kmui-combobox-icon {
background-position: center 0;
}
.file-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: 1px;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.3);
}
.file-menu.kmui-dropdown-menu #save-button,
.file-menu.kmui-dropdown-menu #manage-file-button {
display: none;
}
.file-menu.kmui-dropdown-menu.logined #save-button,
.file-menu.kmui-dropdown-menu.logined #manage-file-button {
display: block;
}
.file-menu.kmui-dropdown-menu.logined #net-hint-buttom {
display: none;
}
.user-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: -25px;
min-width: 130px;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.3);
}
.user-menu.kmui-dropdown-menu li a {
padding-left: 40px;
}
#share-dialog {
position: absolute;
padding: 20px;
left: 50%;
top: 40%;
margin-left: -175px;
margin-top: -100px;
background: white;
width: 350px;
box-shadow: 1px 2px 16px rgba(0, 0, 0, 0.5);
display: none;
}
#share-dialog h3 {
margin: 0;
font-size: 16px;
color: #666;
}
#share-dialog input {
width: 260px;
height: 22px;
line-height: 22px;
padding: 4px 4px 0;
border: 1px solid #999;
vertical-align: middle;
margin-right: 3px;
background: #EEE;
}
#share-dialog input:focus {
border: 1px solid #99f;
outline: none;
}
#share-dialog p,
#share-dialog #share-platform {
margin: 20px 0 30px;
}
#share-dialog #copy-share-url {
display: inline-block;
margin: 0;
width: 70px;
height: 28px;
line-height: 28px;
vertical-align: middle;
color: white;
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #0099f2), color-stop(0%, #4096ee), color-stop(100%, #0076dd));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%, #4096ee 0%, #0076dd 100%);
/* W3C */
}
#share-dialog #copy-share-url:hover,
#share-dialog #copy-share-url.hover {
background: #009fff;
}
#share-dialog #copy-share-url:active,
#share-dialog #copy-share-url.active {
background: #007fcc;
box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
}
#share-dialog #share-platform {
margin-bottom: 0;
}
/*# sourceMappingURL=social.css.map */
\ No newline at end of file
...@@ -249,6 +249,10 @@ $(function() { ...@@ -249,6 +249,10 @@ $(function() {
e.stopPropagation(); e.stopPropagation();
}); });
$('body').delegate('#global-zeroclipboard-html-bridge', 'mousedown', function(e) {
e.stopPropagation();
});
var copyTrickTimer = 0; var copyTrickTimer = 0;
$('body').on('mousedown', function(e) { $('body').on('mousedown', function(e) {
copyTrickTimer = setTimeout(function() { copyTrickTimer = setTimeout(function() {
......
...@@ -183,7 +183,7 @@ button { ...@@ -183,7 +183,7 @@ button {
} }
input { input {
width: 260px; width: 255px;
height: 22px; height: 22px;
line-height: 22px; line-height: 22px;
padding: 4px 4px 0; padding: 4px 4px 0;
...@@ -204,7 +204,7 @@ button { ...@@ -204,7 +204,7 @@ button {
#copy-share-url { #copy-share-url {
display: inline-block; display: inline-block;
margin: 0; margin: 0;
width: 70px; width: 75px;
height: 28px; height: 28px;
line-height: 28px; line-height: 28px;
vertical-align: middle; vertical-align: middle;
......
...@@ -62,9 +62,13 @@ KM.registerUI( 'contextmenu', function () { ...@@ -62,9 +62,13 @@ KM.registerUI( 'contextmenu', function () {
if(item.divider){ if(item.divider){
data.pop(); data.pop();
} }
var pos = e.getPosition('screen');
var offset = $(me.getPaper().container).offset();
pos.y -= offset.top;
pos.x -= offset.left;
$menu.kmui().setData({ $menu.kmui().setData({
data:data data:data
}).position(e.getPosition()).show(); }).position(pos).show();
} }
}); });
......
...@@ -145,7 +145,7 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -145,7 +145,7 @@ Minder.Receiver = kity.createClass('Receiver', {
me.minderNode.getRenderContainer().bringTop(); me.minderNode.getRenderContainer().bringTop();
me.minderNode.render(); me.minderNode.render();
//移动光标不做layout //移动光标不做layout
if(!keymap.direction[keyCode] && !orgEvt.shiftKey && !orgEvt.metaKey && orgEvt.ctrlKey){ if(!keymap.direction[keyCode] && !orgEvt.shiftKey && !orgEvt.metaKey && !orgEvt.ctrlKey){
clearTimeout(me.inputTextTimer); clearTimeout(me.inputTextTimer);
me.inputTextTimer = setTimeout(function(){ me.inputTextTimer = setTimeout(function(){
......
...@@ -163,6 +163,10 @@ KityMinder.registerModule('Expand', function() { ...@@ -163,6 +163,10 @@ KityMinder.registerModule('Expand', function() {
e.stopPropagation(); e.stopPropagation();
e.preventDefault(); e.preventDefault();
}); });
this.on('dblclick click mouseup', function(e) {
e.stopPropagation();
e.preventDefault();
});
}, },
setState: function(state) { setState: function(state) {
......
...@@ -28,8 +28,11 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -28,8 +28,11 @@ var ViewDragger = kity.createClass("ViewDragger", {
lastPosition = null, lastPosition = null,
currentPosition = null; currentPosition = null;
this._minder.on('normal.mousedown readonly.mousedown readonly.touchstart', function (e) { this._minder.on('normal.mousedown normal.touchstart readonly.mousedown readonly.touchstart', function(e) {
if (e.originEvent.button == 2) {
e.originEvent.preventDefault(); // 阻止中键拉动 e.originEvent.preventDefault(); // 阻止中键拉动
}
// 点击未选中的根节点临时开启 // 点击未选中的根节点临时开启
if (e.getTargetNode() == this.getRoot() || e.originEvent.button == 2) { if (e.getTargetNode() == this.getRoot() || e.originEvent.button == 2) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
...@@ -37,18 +40,19 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -37,18 +40,19 @@ var ViewDragger = kity.createClass("ViewDragger", {
} }
}) })
.on('normal.mousemove normal.touchmove', function(e) { .on('normal.mousemove normal.touchmove readonly.touchmove readonly.mousemove', function(e) {
if (!isTempDrag) return; if (!isTempDrag) return;
var offset = kity.Vector.fromPoints(lastPosition, e.getPosition()); var offset = kity.Vector.fromPoints(lastPosition, e.getPosition());
if (offset.length() > 3) this.setStatus('hand'); if (offset.length() > 3) this.setStatus('hand');
}) })
.on('hand.beforemousedown hand.beforetouchend', function(e) { .on('hand.beforemousedown hand.beforetouchstart', function(e) {
// 已经被用户打开拖放模式 // 已经被用户打开拖放模式
if (dragger.isEnabled()) { if (dragger.isEnabled()) {
lastPosition = e.getPosition(); lastPosition = e.getPosition();
e.stopPropagation(); e.stopPropagation();
} }
console.log('touchstart');
}) })
.on('hand.beforemousemove hand.beforetouchmove', function(e) { .on('hand.beforemousemove hand.beforetouchmove', function(e) {
...@@ -65,7 +69,7 @@ var ViewDragger = kity.createClass("ViewDragger", { ...@@ -65,7 +69,7 @@ var ViewDragger = kity.createClass("ViewDragger", {
} }
}) })
.on('mouseup', function(e) { .on('mouseup touchend', function(e) {
lastPosition = null; lastPosition = null;
// 临时拖动需要还原状态 // 临时拖动需要还原状态
...@@ -86,8 +90,7 @@ KityMinder.registerModule('View', function() { ...@@ -86,8 +90,7 @@ KityMinder.registerModule('View', function() {
base: Command, base: Command,
execute: function(minder) { execute: function(minder) {
minder._viewDragger.setEnabled(!minder._viewDragger.isEnabled()); if (minder.getStatus() != 'hand') {
if (minder._viewDragger.isEnabled()) {
minder.setStatus('hand'); minder.setStatus('hand');
} else { } else {
minder.rollbackStatus(); minder.rollbackStatus();
...@@ -96,7 +99,7 @@ KityMinder.registerModule('View', function() { ...@@ -96,7 +99,7 @@ KityMinder.registerModule('View', function() {
}, },
queryState: function(minder) { queryState: function(minder) {
return minder._viewDragger.isEnabled() ? 1 : 0; return minder.getStatus() == 'hand' ? 1 : 0;
}, },
enableReadOnly: false enableReadOnly: false
}); });
...@@ -156,7 +159,10 @@ KityMinder.registerModule('View', function() { ...@@ -156,7 +159,10 @@ KityMinder.registerModule('View', function() {
e.preventDefault(); e.preventDefault();
} }
}, },
mousewheel: function (e) { statuschange: function(e) {
this._viewDragger.setEnabled(e.currentStatus == 'hand');
},
mousewheel: function(e) {
var dx, dy; var dx, dy;
e = e.originEvent; e = e.originEvent;
if (e.ctrlKey || e.shiftKey) return; if (e.ctrlKey || e.shiftKey) return;
......
...@@ -5,39 +5,46 @@ KityMinder.registerModule('Zoom', function() { ...@@ -5,39 +5,46 @@ KityMinder.registerModule('Zoom', function() {
me.setDefaultOptions('zoom', [50, 80, 100, 120, 150, 200]); me.setDefaultOptions('zoom', [50, 80, 100, 120, 150, 200]);
function fixPaperCTM() { function fixPaperCTM(paper) {
var paper = me.getPaper();
var node = paper.shapeNode; var node = paper.shapeNode;
var ctm = node.getCTM(); var ctm = node.getCTM();
var matrix = new kity.Matrix(ctm.a, ctm.b, ctm.c, ctm.d, (ctm.e | 0) + 0.5, (ctm.f | 0) + 0.5); var matrix = new kity.Matrix(ctm.a, ctm.b, ctm.c, ctm.d, (ctm.e | 0) + 0.5, (ctm.f | 0) + 0.5);
node.setAttribute('transform', 'matrix(' + matrix.toString() + ')'); node.setAttribute('transform', 'matrix(' + matrix.toString() + ')');
} }
function zoomMinder(minder, zoom) { kity.extendClass(Minder, {
zoom: function(value) {
var paper = this.getPaper();
var viewport = paper.getViewPort();
viewport.zoom = value / 100;
viewport.center = {
x: viewport.center.x,
y: viewport.center.y
};
paper.setViewPort(viewport);
fixPaperCTM(paper);
}
});
function zoomMinder(minder, value) {
var paper = minder.getPaper(); var paper = minder.getPaper();
var viewport = paper.getViewPort(); var viewport = paper.getViewPort();
if (!zoom) return; if (!value) return;
var animator = new kity.Animator({ var animator = new kity.Animator({
beginValue: viewport.zoom, beginValue: minder._zoomValue,
finishValue: zoom / 100, finishValue: value,
setter: function(target, value) { setter: function(target, value) {
viewport.zoom = value; target.zoom(value);
viewport.center = {
x: viewport.center.x,
y: viewport.center.y
};
target.setViewPort(viewport);
fixPaperCTM();
} }
}); });
minder.zoom = zoom; minder._zoomValue = value;
if (timeline) { if (timeline) {
timeline.pause(); timeline.pause();
} }
timeline = animator.start(paper, 500, 'ease', function() { timeline = animator.start(minder, 100, 'ease', function() {
minder.refresh(500); minder.refresh(100);
}); });
} }
...@@ -45,7 +52,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -45,7 +52,7 @@ KityMinder.registerModule('Zoom', function() {
base: Command, base: Command,
execute: zoomMinder, execute: zoomMinder,
queryValue: function(minder) { queryValue: function(minder) {
return minder.zoom; return minder._zoomValue;
} }
}); });
...@@ -61,7 +68,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -61,7 +68,7 @@ KityMinder.registerModule('Zoom', function() {
var stack = minder.getOptions('zoom'), var stack = minder.getOptions('zoom'),
i; i;
for (i = 0; i < stack.length; i++) { for (i = 0; i < stack.length; i++) {
if (stack[i] > minder.zoom) return stack[i]; if (stack[i] > minder._zoomValue) return stack[i];
} }
return 0; return 0;
}, },
...@@ -80,7 +87,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -80,7 +87,7 @@ KityMinder.registerModule('Zoom', function() {
var stack = minder.getOptions('zoom'), var stack = minder.getOptions('zoom'),
i; i;
for (i = stack.length - 1; i >= 0; i--) { for (i = stack.length - 1; i >= 0; i--) {
if (stack[i] < minder.zoom) return stack[i]; if (stack[i] < minder._zoomValue) return stack[i];
} }
return 0; return 0;
}, },
...@@ -89,7 +96,7 @@ KityMinder.registerModule('Zoom', function() { ...@@ -89,7 +96,7 @@ KityMinder.registerModule('Zoom', function() {
return { return {
init: function() { init: function() {
this.zoom = 100; this._zoomValue = 100;
}, },
commands: { commands: {
'zoom-in': ZoomInCommand, 'zoom-in': ZoomInCommand,
...@@ -113,9 +120,6 @@ KityMinder.registerModule('Zoom', function() { ...@@ -113,9 +120,6 @@ KityMinder.registerModule('Zoom', function() {
} }
}, },
'ready': function() {
this._zoomValue = 1;
},
'normal.mousewheel readonly.mousewheel': function(e) { 'normal.mousewheel readonly.mousewheel': function(e) {
if (!e.originEvent.ctrlKey) return; if (!e.originEvent.ctrlKey) return;
var delta = e.originEvent.wheelDelta; var delta = e.originEvent.wheelDelta;
......
...@@ -10,14 +10,11 @@ if (!kity.Browser.ie) { ...@@ -10,14 +10,11 @@ if (!kity.Browser.ie) {
fileDescription: 'PNG 图片', fileDescription: 'PNG 图片',
fileExtension: '.png', fileExtension: '.png',
encode: function(json, km) { encode: function(json, km) {
var paper = km.getPaper(); var originZoom = km._zoomValue;
var viewport = paper.getViewPort();
var originZoom = viewport.zoom;
viewport.zoom = 1; var paper = km.getPaper(),
paper.setViewPort(viewport); paperTransform = paper.shapeNode.getAttribute('transform'),
domContainer = paper.container,
var domContainer = km.getPaper().container,
svgXml, svgXml,
$svg, $svg,
...@@ -27,27 +24,27 @@ if (!kity.Browser.ie) { ...@@ -27,27 +24,27 @@ if (!kity.Browser.ie) {
renderContainer = km.getRenderContainer(), renderContainer = km.getRenderContainer(),
renderBox = renderContainer.getRenderBox(), renderBox = renderContainer.getRenderBox(),
transform = renderContainer.getTransform(), width = renderBox.width + 1,
width = renderBox.width, height = renderBox.height + 1,
height = renderBox.height,
padding = 20, padding = 20,
canvas = document.createElement('canvas'), canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d'), ctx = canvas.getContext('2d'),
blob, DomURL, url, img, finishCallback; blob, DomURL, url, img, finishCallback;
paper.shapeNode.setAttribute('transform', 'translate(0.5, 0.5)');
renderContainer.translate(-renderBox.x, -renderBox.y); renderContainer.translate(-renderBox.x, -renderBox.y);
svgXml = km.getPaper().container.innerHTML; svgXml = paper.container.innerHTML;
renderContainer.translate(renderBox.x, renderBox.y); renderContainer.translate(renderBox.x, renderBox.y);
viewport.zoom = originZoom;
paper.setViewPort(viewport); paper.shapeNode.setAttribute('transform', paperTransform);
$svg = $(svgXml).filter('svg'); $svg = $(svgXml).filter('svg');
$svg.attr({ $svg.attr({
width: renderBox.width, width: renderBox.width + 1,
height: renderBox.height, height: renderBox.height + 1,
style: 'font-family: Arial, "Microsoft Yahei","Heiti SC";' style: 'font-family: Arial, "Microsoft Yahei","Heiti SC";'
}); });
......
...@@ -6,14 +6,9 @@ if (!kity.Browser.ie) { ...@@ -6,14 +6,9 @@ if (!kity.Browser.ie) {
fileExtension: '.svg', fileExtension: '.svg',
mineType: 'image/svg+xml', mineType: 'image/svg+xml',
encode: function(json, km) { encode: function(json, km) {
var paper = km.getPaper();
var viewport = paper.getViewPort();
var originZoom = viewport.zoom;
viewport.zoom = 1; var paper = km.getPaper(),
paper.setViewPort(viewport); paperTransform = paper.shapeNode.getAttribute('transform'),
var domContainer = km.getPaper().container,
svgXml, svgXml,
$svg, $svg,
...@@ -24,13 +19,15 @@ if (!kity.Browser.ie) { ...@@ -24,13 +19,15 @@ if (!kity.Browser.ie) {
height = renderBox.height, height = renderBox.height,
padding = 20; padding = 20;
paper.shapeNode.setAttribute('transform', 'translate(0.5, 0.5)');
svgXml = km.getPaper().container.innerHTML; svgXml = km.getPaper().container.innerHTML;
paper.shapeNode.setAttribute('transform', paperTransform);
$svg = $(svgXml).filter('svg'); $svg = $(svgXml).filter('svg');
$svg.attr({ $svg.attr({
width: width + padding * 2 | 0, width: width + padding * 2 | 0,
height: height + padding * 2 | 0, height: height + padding * 2 | 0,
style: 'font-family: Arial, "Microsoft Yahei", "Heiti SC";' style: 'font-family: Arial, "Microsoft Yahei", "Heiti SC"; background: ' + km.getStyle('background')
}); });
$svg[0].setAttribute('viewBox', [renderBox.x - padding | 0, $svg[0].setAttribute('viewBox', [renderBox.x - padding | 0,
renderBox.y - padding | 0, renderBox.y - padding | 0,
...@@ -42,8 +39,6 @@ if (!kity.Browser.ie) { ...@@ -42,8 +39,6 @@ if (!kity.Browser.ie) {
svgXml = $('<div></div>').append($svg).html(); svgXml = $('<div></div>').append($svg).html();
svgXml = $('<div></div>').append($svg).html(); svgXml = $('<div></div>').append($svg).html();
viewport.zoom = originZoom;
paper.setViewPort(viewport);
// svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined // svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined
svgXml = svgXml.replace(/&nbsp;/g, '&#xa0;'); svgXml = svgXml.replace(/&nbsp;/g, '&#xa0;');
......
KityMinder.registerTheme('classic', { KityMinder.registerTheme('classic', {
'background': 'url(themes/default/images/grid.png) repeat', 'background': '#3A4144 url(themes/default/images/grid.png) repeat',
'root-color': '#430', 'root-color': '#430',
'root-background': '#e9df98', 'root-background': '#e9df98',
......
KityMinder.registerTheme('snow', { KityMinder.registerTheme('snow', {
'background': 'url(themes/default/images/grid.png) repeat', 'background': '#3A4144 url(themes/default/images/grid.png) repeat',
'root-color': '#430', 'root-color': '#430',
'root-background': '#e9df98', 'root-background': '#e9df98',
......
...@@ -2,13 +2,21 @@ ...@@ -2,13 +2,21 @@
html, body, div { html, body, div {
margin: 0; margin: 0;
padding: 0; padding: 0;
/* background: #FFFFFF; */ margin-top: 0 !important;
} }
html, body, #kityminder, div.kmui-editor-body { html, body, #kityminder, div.kmui-editor-body {
overflow: hidden; overflow: hidden;
-moz-user-select: none; -moz-user-select: none;
width: 100%;
}
#content-wrapper {
overflow: hidden;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
} }
#title, #panel { #title, #panel {
background: hsl(224, 16%, 27%); background: hsl(224, 16%, 27%);
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei'; font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
...@@ -61,7 +69,6 @@ html, body, #kityminder, div.kmui-editor-body { ...@@ -61,7 +69,6 @@ html, body, #kityminder, div.kmui-editor-body {
#menu { #menu {
float: left; float: left;
flo
} }
#panel button:hover, #panel button.active { #panel button:hover, #panel button.active {
...@@ -258,7 +265,7 @@ svg, body { ...@@ -258,7 +265,7 @@ svg, body {
font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif; font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
} }
#about { #about {
position:absolute; position: absolute;
bottom: 0; bottom: 0;
right: 0; right: 0;
height: 40px; height: 40px;
...@@ -266,14 +273,12 @@ svg, body { ...@@ -266,14 +273,12 @@ svg, body {
background: #5d697a; background: #5d697a;
color: #eee; color: #eee;
font-family:Arial; font-family:Arial;
font-size:13px; font-size: 13px;
font-weight:normal; font-weight:normal;
margin:0; margin:0;
text-align: right; text-align: right;
padding: 0 15px 0 60px; padding: 0 15px 0 60px;
border-bottom: 5px solid #393F4F; border-bottom: 5px solid #393F4F;
-webkit-font-smoothing: antialiased;
position: absolute;
transition: all ease .3s 0.3s; transition: all ease .3s 0.3s;
......
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