Commit 51fc6f70 authored by RawKStar77's avatar RawKStar77

Adds stickybuttons to the toolbar.

parent 3356be78
...@@ -258,7 +258,10 @@ $baseFontSize: 14px; ...@@ -258,7 +258,10 @@ $baseFontSize: 14px;
//CONTROLBAR STUFF//////////////////////////////// //CONTROLBAR STUFF////////////////////////////////
.annotator-toolbar { .annotator-toolbar {
@include single-transition(height, .25s, ease, .25s); @include transition(
height .25s,
min-height .25s
);
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
height: 200px; height: 200px;
...@@ -267,46 +270,49 @@ $baseFontSize: 14px; ...@@ -267,46 +270,49 @@ $baseFontSize: 14px;
width: 2.5em; width: 2.5em;
z-index: 2; z-index: 2;
a, a:hover, a:active, a:visited, a:link, a:link:hover {
color: $grayLighter;
text-decoration: none;
&:before {
color: inherit;
}
&.tri-icon {
color: rgba(200, 200, 200, .3);
text-shadow:
1px .8px 1.5px $white,
0 0 0 #000;
&:hover {
color: rgba(235, 235, 230, .1);
}
}
}
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: 35px;
margin-bottom: 5px;
}
} }
.annotator-toolbar.annotator-hide { .annotator-toolbar.annotator-hide {
@include transition-delay(.25s);
height: 2.2em; height: 2.2em;
&:hover { li {
height: 200px; @include transition-delay(.2s, 0, 0);
//@include transition-duration(0 .25s);
border-width: 0;
max-height: 0;
margin-bottom: 0;
&:first-child, &.pushed {
margin-bottom: 5px;
border-width: 1px;
max-height: 35px;
}
} }
} }
.annotator-toolbar li { .annotator-toolbar li {
@include border-radius(4px); @include border-radius(4px);
@include smallshadow(0); @include smallshadow(0);
@include transition(
border-width .05s,
margin-bottom .25s,
max-height .25s
);
background: $white; background: $white;
border: solid 1px $grayLighter; border: solid 1px $grayLighter;
overflow: hidden;
position: relative; position: relative;
left: 2px; left: 2px;
height: 2em; height: 2em;
...@@ -319,11 +325,7 @@ $baseFontSize: 14px; ...@@ -319,11 +325,7 @@ $baseFontSize: 14px;
width: 2.3em; width: 2.3em;
} }
& + li { a, a:hover, a:active, a:visited, a:link, a:link:hover {
margin-top: 5px;
}
a {
font-size: $baseFontSize * 1.3; font-size: $baseFontSize * 1.3;
line-height: $baseLineHeight * 1.3; line-height: $baseLineHeight * 1.3;
...@@ -332,14 +334,34 @@ $baseFontSize: 14px; ...@@ -332,14 +334,34 @@ $baseFontSize: 14px;
position: absolute; position: absolute;
left: .2em; left: .2em;
color: $grayLighter;
text-decoration: none;
&:before {
color: inherit;
}
&.tri-icon {
color: rgba(200, 200, 200, .3);
text-shadow:
1px .8px 1.5px $white,
0 0 0 #000;
&:hover {
color: rgba(235, 235, 230, .1);
}
}
} }
a.pushed, a:hover.pushed { &.pushed, &:hover.pushed {
max-height: 35px;
a {
color: $hypothered; color: $hypothered;
} }
}
} }
// Toolbar Icons // Toolbar Icons
.alwaysonhighlights-icon { .alwaysonhighlights-icon {
@include fonticon("\e01b", left); @include fonticon("\e01b", left);
......
...@@ -26,12 +26,6 @@ class Annotator.Host extends Annotator.Guest ...@@ -26,12 +26,6 @@ class Annotator.Host extends Annotator.Guest
app.appendTo(@frame) app.appendTo(@frame)
if @toolbar?
@toolbar.addClass 'annotator-hide'
@toolbar
.on('mouseenter', => @toolbar.removeClass 'annotator-hide')
.on('mouseleave', => @toolbar.addClass 'annotator-hide')
if @plugins.Heatmap? if @plugins.Heatmap?
this._setupDragEvents() this._setupDragEvents()
@plugins.Heatmap.element.on 'click', (event) => @plugins.Heatmap.element.on 'click', (event) =>
......
...@@ -2,13 +2,15 @@ $ = Annotator.$ ...@@ -2,13 +2,15 @@ $ = 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 mouseleave': 'hide'
'updateNotificationCounter': 'onUpdateNotificationCounter' 'updateNotificationCounter': 'onUpdateNotificationCounter'
'setTool': 'onSetTool' 'setTool': 'onSetTool'
'setVisibleHighlights': 'onSetVisibleHighlights' 'setVisibleHighlights': 'onSetVisibleHighlights'
html: html:
element: '<div class="annotator-toolbar"></div>' element: '<div class="annotator-toolbar annotator-hide"></div>'
notification: '<div class="annotator-notification-counter"></div>"' notification: '<div class="annotator-notification-counter"></div>'
options: options:
items: [ items: [
...@@ -59,20 +61,23 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin ...@@ -59,20 +61,23 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
@toolbar.append(@notificationCounter) @toolbar.append(@notificationCounter)
@buttons = @options.items.reduce (buttons, item) => @buttons = @options.items.reduce (buttons, item) =>
button = $('<a></a>') anchor = $('<a></a>')
.attr('href', '') .attr('href', '')
.attr('title', item.title) .attr('title', item.title)
.on('click', item.click) .on('click', item.click)
.addClass(item.class) .addClass(item.class)
.data('state', false) button = $('<li></li>').append(anchor)
buttons.add button buttons.add button
, $() , $()
list = $('<ul></ul>') list = $('<ul></ul>')
@buttons.appendTo(list) @buttons.appendTo(list)
@buttons.wrap('<li></li>')
@toolbar.append(list) @toolbar.append(list)
show: -> this.toolbar.removeClass('annotator-hide')
hide: -> this.toolbar.addClass('annotator-hide')
onUpdateNotificationCounter: (count) -> onUpdateNotificationCounter: (count) ->
element = $(@buttons[0]) element = $(@buttons[0])
element.toggle('fg_highlight', {color: 'lightblue'}) element.toggle('fg_highlight', {color: 'lightblue'})
...@@ -93,9 +98,22 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin ...@@ -93,9 +98,22 @@ class Annotator.Plugin.Toolbar extends Annotator.Plugin
$(@buttons[2]).addClass('pushed') $(@buttons[2]).addClass('pushed')
else else
$(@buttons[2]).removeClass('pushed') $(@buttons[2]).removeClass('pushed')
this._updateStickyButtons()
onSetVisibleHighlights: (state) -> onSetVisibleHighlights: (state) ->
if state if state
$(@buttons[1]).addClass('pushed') $(@buttons[1]).addClass('pushed')
else else
$(@buttons[1]).removeClass('pushed') $(@buttons[1]).removeClass('pushed')
this._updateStickyButtons()
_updateStickyButtons: ->
count = $(@buttons).filter(-> $(this).hasClass('pushed')).length
if count
height = (count + 1) * 32 # +1 -- top button is always visible
this.toolbar.css("min-height", "#{height}px")
else
height = 32
this.toolbar.css("min-height", "")
this.annotator.plugins.Heatmap?.BUCKET_THRESHOLD_PAD = height - 5
this.annotator.plugins.Heatmap?._update();
\ No newline at end of file
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