Commit d0331036 authored by Randall Leeds's avatar Randall Leeds

Improve the usability and transitions of toolbar

Change the toolbar transitions, hover actions, and push states to
improve usability and feel.

- Animate from the right, so that all buttons enter as a group, so
  as to give them all equal "weight"
- Colorize the pushed buttons even when not hovering so it's easier
  to see which are active
- Further emphasize pushed state by "docking" them to the right
- Rework curves, delays, and durations for great beauty
- Show hidden buttons when hovering anywhere, not just the top

Close #1268
parent 4a604b5d
...@@ -267,48 +267,37 @@ $baseFontSize: 14px; ...@@ -267,48 +267,37 @@ $baseFontSize: 14px;
//CONTROLBAR STUFF//////////////////////////////// //CONTROLBAR STUFF////////////////////////////////
.annotator-toolbar { .annotator-toolbar {
@include transition(
height .25s,
min-height .25s,
max-height .25s
);
position: absolute; position: absolute;
overflow: hidden;
height: 200px;
left: -($heatmap-width + 18px - 7px); left: -($heatmap-width + 18px - 7px);
right: 0; right: 0;
width: 37px;
z-index: 2; z-index: 2;
ul {
height: 100%;
}
ul, li { ul, li {
@include box-sizing(border-box); @include box-sizing(border-box);
@include reset-box-model; @include reset-box-model;
@include reset-list-style; @include reset-list-style;
} }
li {
border-width: 1px;
max-height: 30px;
margin-bottom: 5px;
min-height: 30px;
}
} }
.annotator-toolbar.annotator-hide { .annotator-toolbar.annotator-hide {
@include transition-delay(.25s);
display: initial; display: initial;
height: 37px; // 30px height + 2px (top+bottom border) + 5px shadow
visibility: initial; visibility: initial;
li { li {
@include transition-delay(.2s, 0, 0); @include transition-delay(.75s);
border-width: 0; @include transition-timing-function(cubic-bezier(1, .1, .55, 0));
height: 0;
left: 34px;
margin-bottom: 0; margin-bottom: 0;
max-height: 0;
min-height: 0;
&:first-child, &.pushed { &:first-child, &.pushed {
border-width: 1px; @include transition-delay(0);
max-height: 30px; left: 3px;
height: 30px;
margin-bottom: 5px; margin-bottom: 5px;
} }
} }
...@@ -317,9 +306,14 @@ $baseFontSize: 14px; ...@@ -317,9 +306,14 @@ $baseFontSize: 14px;
.annotator-toolbar li { .annotator-toolbar li {
@include border-radius(4px); @include border-radius(4px);
@include smallshadow; @include smallshadow;
@include transition(max-height .25s); @include transition-property(left, height, margin-bottom);
@include transition-duration(.25s);
@include transition-delay(0);
@include transition-timing-function(cubic-bezier(0, .55, .1, 1));
background: $white; background: $white;
border: solid 1px $grayLighter; border: solid 1px $grayLighter;
left: 0;
margin-bottom: 5px;
overflow: hidden; overflow: hidden;
position: relative; position: relative;
height: 30px; height: 30px;
...@@ -329,12 +323,18 @@ $baseFontSize: 14px; ...@@ -329,12 +323,18 @@ $baseFontSize: 14px;
@include border-radius(4px 0 0 4px); @include border-radius(4px 0 0 4px);
@include box-shadow(none); @include box-shadow(none);
border-right-style: none; border-right-style: none;
left: 0;
width: 36px; width: 36px;
z-index: 1;
} }
&.pushed { &.pushed {
@include box-shadow(none); @include box-shadow(none);
left: 3px;
z-index: 1;
a, a:hover, a:active, a:visited, a:link, a:link:hover {
color: $linkColor;
}
} }
a, a:hover, a:active, a:visited, a:link, a:link:hover { a, a:hover, a:active, a:visited, a:link, a:link:hover {
...@@ -349,8 +349,12 @@ $baseFontSize: 14px; ...@@ -349,8 +349,12 @@ $baseFontSize: 14px;
color: rgba(200, 200, 200, .3); color: rgba(200, 200, 200, .3);
text-decoration: none; text-decoration: none;
text-shadow:
0 0 2px $grayLightest,
0 0 0 $gray;
&:focus { outline: 0; } &:focus { outline: 0; }
&:hover { color: $linkColorHover; }
&.tri-icon { &.tri-icon {
text-shadow: text-shadow:
...@@ -361,16 +365,6 @@ $baseFontSize: 14px; ...@@ -361,16 +365,6 @@ $baseFontSize: 14px;
color: fade-out($grayLightest, .9); color: fade-out($grayLightest, .9);
} }
} }
&.alwaysonhighlights-icon, &.highlighter-icon, &.commenter-icon {
text-shadow:
0 0 2px $grayLightest,
0 0 0 $gray;
&:hover {
color: $linkColorHover;
}
}
} }
} }
......
...@@ -2,7 +2,7 @@ $ = Annotator.$ ...@@ -2,7 +2,7 @@ $ = Annotator.$
class Annotator.Plugin.Toolbar extends Annotator.Plugin class Annotator.Plugin.Toolbar extends Annotator.Plugin
events: events:
'.annotator-toolbar li:first-child mouseenter': 'show' '.annotator-toolbar mouseenter': 'show'
'.annotator-toolbar mouseleave': 'hide' '.annotator-toolbar mouseleave': 'hide'
'setTool': 'onSetTool' 'setTool': 'onSetTool'
'setVisibleHighlights': 'onSetVisibleHighlights' 'setVisibleHighlights': 'onSetVisibleHighlights'
......
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