Commit da286ad2 authored by techird's avatar techird

color egg

parent 76399331
...@@ -164,8 +164,8 @@ KityMinder.LANG['zh-cn'] = { ...@@ -164,8 +164,8 @@ KityMinder.LANG['zh-cn'] = {
'saveto': '另存为', 'saveto': '另存为',
'hand': '允许拖拽', 'hand': '允许拖拽',
'camera': '定位根节点', 'camera': '定位根节点',
'zoom-in': '放大', 'zoom-in': '放大(Ctrl+)',
'zoom-out': '缩小', 'zoom-out': '缩小(Ctrl-)',
'markers': '标签', 'markers': '标签',
'resource': '资源', 'resource': '资源',
'help': '帮助', 'help': '帮助',
......
...@@ -60,8 +60,8 @@ KityMinder.registerModule('Zoom', function() { ...@@ -60,8 +60,8 @@ KityMinder.registerModule('Zoom', function() {
timeline = animator.start(minder, 300, 'easeInOutSine', function() {}); timeline = animator.start(minder, 300, 'easeInOutSine', function() {});
timeline.on('finish', function() { timeline.on('finish', function() {
minder.fire('viewchange'); minder.fire('viewchange');
minder.fire('zoom', { zoom: value });
}); });
minder.fire('zoom', { zoom: value });
} }
var ZoomCommand = kity.createClass('Zoom', { var ZoomCommand = kity.createClass('Zoom', {
......
...@@ -18,9 +18,9 @@ ...@@ -18,9 +18,9 @@
## 视野控制 ## 视野控制
`Space`: 切换编辑/抓手模式
`滚轮`: 移动视野 `Alt` + `拖动` or `右键拖动`: 拖动视野
`右键拖动`: 拖动视野 `滚轮` or `触摸板`: 移动视野
`Ctrl` + `Up`, `Down`, `Left`, `Right`: 视野导航 `Ctrl` + `Up`, `Down`, `Left`, `Right`: 视野导航
`空白处双击`, `Ctrl + Enter`: 居中根节点 `空白处双击`, `Ctrl + Enter`: 居中根节点
`Ctrl` + `+`, `-`: 放大/缩小视野 `Ctrl` + `+`, `-`: 放大/缩小视野
......
...@@ -42,6 +42,19 @@ KityMinder.registerUI('menu/help/help', function (minder) { ...@@ -42,6 +42,19 @@ KityMinder.registerUI('menu/help/help', function (minder) {
} }
$help.removeClass('loading'); $help.removeClass('loading');
$help.find('.km-version').text(KityMinder.version); $help.find('.km-version').text(KityMinder.version);
// 彩蛋:点很多次按钮的蛋疼
var counter = 0;
var archives = {
'1': '你是个勇于尝试的人!',
'10': '你是个愿意深入探索的人!',
'100': '别点了,累',
'1000': '你真是最孤独的屌丝啊……真的别点了,没有了'
};
$help.delegate('.shortcut-key', 'click', function() {
var msg = archives[++counter];
if (msg) window.alert(msg);
});
} }
function convert(markdown) { function convert(markdown) {
...@@ -71,7 +84,7 @@ KityMinder.registerUI('menu/help/help', function (minder) { ...@@ -71,7 +84,7 @@ KityMinder.registerUI('menu/help/help', function (minder) {
var description = match[2]; var description = match[2];
html += '<div class="shortcut-group"><span class="shortcut">'; html += '<div class="shortcut-group"><span class="shortcut">';
html += declare.replace(/\`(.+?)\`/g, function(match, key) { html += declare.replace(/\`(.+?)\`/g, function(match, key) {
return '<span class="shortcut-key ' + key.toLowerCase() + '">' + key + '</span>'; return '<span class="shortcut-key ' + key.toLowerCase() + '" title="' + key + '">' + key + '</span>';
}); });
html += '</span>'; html += '</span>';
html += '<span class="description">' + description + '</span>'; html += '<span class="description">' + description + '</span>';
......
...@@ -15,7 +15,7 @@ KityMinder.registerUI('nav', function(minder) { ...@@ -15,7 +15,7 @@ KityMinder.registerUI('nav', function(minder) {
var $commandbutton = minder.getUI('widget/commandbutton'); var $commandbutton = minder.getUI('widget/commandbutton');
var $zoomIn = $commandbutton.generate('zoom-in').appendTo($navBar[0]); var $zoomIn = $commandbutton.generate('zoom-in').appendTo($navBar[0]);
var $zoomPan = createZoomPan().appendTo($navBar); var $zoomPan = createZoomPan($navBar);
var $zoomOut = $commandbutton.generate('zoom-out').appendTo($navBar[0]); var $zoomOut = $commandbutton.generate('zoom-out').appendTo($navBar[0]);
var $previewNavigator = createViewNavigator(); var $previewNavigator = createViewNavigator();
...@@ -27,31 +27,36 @@ KityMinder.registerUI('nav', function(minder) { ...@@ -27,31 +27,36 @@ KityMinder.registerUI('nav', function(minder) {
var $previewTrigger = createPreviewTrigger($previewNavigator).appendTo($navBar); var $previewTrigger = createPreviewTrigger($previewNavigator).appendTo($navBar);
function createZoomPan() { function createZoomPan($parent) {
var $pan = $('<div>').addClass('zoom-pan'); var $pan = $('<div>').addClass('zoom-pan').appendTo($parent);
var zoomStack = minder.getOptions('zoom'); var zoomStack = minder.getOptions('zoom');
var minValue = zoomStack[0]; var minValue = zoomStack[0];
var maxValue = zoomStack[zoomStack.length - 1]; var maxValue = zoomStack[zoomStack.length - 1];
var valueRange = maxValue - minValue; var valueRange = maxValue - minValue;
var totalHeight = $pan.height();
function getHeight(value) { function getHeight(value) {
return (100 - (value - minValue) / valueRange * 100) + '%'; return (1 - (value - minValue) / valueRange) * totalHeight;
} }
var $origin = $('<div>') var $origin = $('<div>')
.addClass('origin') .addClass('origin')
.appendTo($pan) .appendTo($pan)
.css('top', getHeight(100)); .css('y', getHeight(100));
var $indicator = $('<div>') var $indicator = $('<div>')
.addClass('indicator') .addClass('indicator')
.appendTo($pan) .appendTo($pan)
.css('top', getHeight(100)); .css('y', getHeight(100));
minder.on('zoom', function(e) { function indicate(value) {
$indicator.animate({ $indicator.animate({
'top': getHeight(e.zoom) 'y': getHeight(value)
}, 100); }, 200);
}
minder.on('zoom', function(e) {
indicate(e.zoom);
}); });
$origin.click(function() { $origin.click(function() {
......
...@@ -182,6 +182,15 @@ input[type=url] { ...@@ -182,6 +182,15 @@ input[type=url] {
text-transform: capitalize; text-transform: capitalize;
box-shadow: inset 0 -2px hsl(0, 0%, 92%), inset 0 -3px hsl(0, 100%, 100%), 0 1px 2px rgba(255, 255, 255, 0.3); box-shadow: inset 0 -2px hsl(0, 0%, 92%), inset 0 -3px hsl(0, 100%, 100%), 0 1px 2px rgba(255, 255, 255, 0.3);
&:active {
padding-top: 4px;
padding-bottom: 4px;
box-shadow: inset 0 -1px hsl(0, 0%, 92%), inset 0 -2px hsl(0, 100%, 100%), 0 1px 1px rgba(255, 255, 255, 0.3);
&:after {
.transform(translate(0, 1px));
}
}
.mac &.ctrl, .mac &.ctrl,
.mac &.shift, .mac &.shift,
.mac &.alt, .mac &.alt,
......
...@@ -742,6 +742,18 @@ input[type=url]:focus { ...@@ -742,6 +742,18 @@ input[type=url]:focus {
text-transform: capitalize; text-transform: capitalize;
box-shadow: inset 0 -2px #ebebeb, inset 0 -3px #ffffff, 0 1px 2px rgba(255, 255, 255, 0.3); box-shadow: inset 0 -2px #ebebeb, inset 0 -3px #ffffff, 0 1px 2px rgba(255, 255, 255, 0.3);
} }
.shortcut-key:active {
padding-top: 4px;
padding-bottom: 4px;
box-shadow: inset 0 -1px #ebebeb, inset 0 -2px #ffffff, 0 1px 1px rgba(255, 255, 255, 0.3);
}
.shortcut-key:active:after {
-webkit-transform: translate(0, 1px);
-moz-transform: translate(0, 1px);
-ms-transform: translate(0, 1px);
-o-transform: translate(0, 1px);
tranform: translate(0, 1px);
}
.mac .shortcut-key.ctrl, .mac .shortcut-key.ctrl,
.mac .shortcut-key.shift, .mac .shortcut-key.shift,
.mac .shortcut-key.alt, .mac .shortcut-key.alt,
......
This diff is collapsed.
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