LT-115: Changing the 'more tools' layout and behavior

This commit is contained in:
Bruno Alves de Faria 2017-01-04 08:18:01 -02:00
parent 6be83653f8
commit 55ca29e0cf
9 changed files with 84 additions and 65 deletions

View File

@ -203,13 +203,14 @@ Template.toolbarSection.helpers({
disabled: isToolDisabled disabled: isToolDisabled
}); });
buttonData.push({ // Disabling this on Lesion Tracker
id: 'targetEX', // buttonData.push({
title: 'EX Target', // id: 'targetEX',
classes: 'imageViewerTool toolbarSectionButton', // title: 'EX Target',
svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp', // classes: 'imageViewerTool toolbarSectionButton',
disabled: isToolDisabled // svgLink: '/packages/ohif_viewerbase/assets/icons.svg#icon-tools-measure-temp',
}); // disabled: isToolDisabled
// });
return buttonData; return buttonData;
} }

View File

@ -4,7 +4,6 @@
theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness) theme('border-bottom', '%s solid $uiBorderColor' % $uiBorderThickness)
flex: 0 0 auto flex: 0 0 auto
height: $toolbarHeight height: $toolbarHeight
overflow: hidden
padding-top: 6px padding-top: 6px
position: relative position: relative
transition(height 300ms ease) transition(height 300ms ease)

View File

@ -21,7 +21,7 @@
width: 25% width: 25%
input input
theme('background-color', '$boxBackgroundColor')Dark theme('background-color', '$boxBackgroundColor')
min-width: 50px min-width: 50px
width: 40% width: 40%
border: none border: none

View File

@ -121,7 +121,7 @@ $seriesSpacing = 2px
width: $switchSize + $seriesSpacing width: $switchSize + $seriesSpacing
.seriesItem .seriesItem
theme('background-color', '$boxBackgroundColor')Dark theme('background-color', '$boxBackgroundColor')
border-radius: 3px border-radius: 3px
height: 15px height: 15px
margin: $seriesSpacing margin: $seriesSpacing
@ -164,10 +164,10 @@ $seriesSpacing = 2px
overflow-x: hidden overflow-x: hidden
overflow-y: scroll overflow-y: scroll
width: calc(100% + 22px) width: calc(100% + 22px)
&.is-mac &.is-mac
padding-right: 22px padding-right: 22px
&.show-scroll-indicator-up:before &.show-scroll-indicator-up:before
&.show-scroll-indicator-down:after &.show-scroll-indicator-down:after
font-family: FontAwesome font-family: FontAwesome
@ -180,11 +180,11 @@ $seriesSpacing = 2px
z-index: 1 z-index: 1
text-align: center text-align: center
left: 0 left: 0
&.show-scroll-indicator-up:before &.show-scroll-indicator-up:before
top: -10px top: -10px
content: '\f102' content: '\f102'
&.show-scroll-indicator-down:after &.show-scroll-indicator-down:after
bottom: 18px bottom: 18px
content: '\f103' content: '\f103'

View File

@ -1,4 +1,6 @@
import { OHIF } from 'meteor/ohif:core'; import { OHIF } from 'meteor/ohif:core';
import { Template } from 'meteor/templating';
import { Session } from 'meteor/session';
Template.toolbarSectionButton.helpers({ Template.toolbarSectionButton.helpers({
activeClass() { activeClass() {
@ -11,9 +13,10 @@ Template.toolbarSectionButton.helpers({
return 'active'; return 'active';
} }
}, },
disableButton() { disableButton() {
const instance = Template.instance(); const instance = Template.instance();
return this.disableFunction && this.disableFunction(); return instance.disableFunction && instance.disableFunction();
} }
}); });
@ -37,7 +40,11 @@ Template.toolbarSectionButton.events({
toolManager.setActiveTool(tool, elements); toolManager.setActiveTool(tool, elements);
} }
}, },
'click .imageViewerCommand'(event, instance) { 'click .imageViewerCommand'(event, instance) {
// Prevent the event from bubbling to parent tools
event.stopPropagation();
// Stop here if the tool is disabled // Stop here if the tool is disabled
if ($(event.currentTarget).hasClass('disabled')) { if ($(event.currentTarget).hasClass('disabled')) {
return; return;

View File

@ -10,13 +10,13 @@
text-align: center text-align: center
&.disabled &.disabled
opacity: 0.5 &>.buttonLabel, &>.svgContainer
cursor: not-allowed opacity: 0.5
cursor: not-allowed
&:hover
i, &:hover
.buttonLabel &, i
theme('color', '$textSecondaryColor') theme('color', '$textSecondaryColor')
.buttonLabel .buttonLabel
theme('color', '$textSecondaryColor') theme('color', '$textSecondaryColor')
@ -26,7 +26,7 @@
.svgContainer .svgContainer
margin: 0 auto margin: 0 auto
text-align: center text-align: center
i i
theme('color', '$textSecondaryColor') theme('color', '$textSecondaryColor')
font-size: 18px font-size: 18px
@ -39,23 +39,23 @@
height: 21px height: 21px
&:hover &:hover
.buttonLabel &>.buttonLabel, &>.svgContainer
theme('color', '$hoverColor') theme('color', '$hoverColor')
svg svg
theme('fill', '$hoverColor') theme('fill', '$hoverColor')
theme('stroke', '$hoverColor') theme('stroke', '$hoverColor')
i i
theme('color', '$hoverColor') theme('color', '$hoverColor')
&:active, &.active &:active, &.active
.buttonLabel &>.buttonLabel, &>.svgContainer
theme('color', '$activeColor') theme('color', '$activeColor')
svg svg
theme('fill', '$activeColor') theme('fill', '$activeColor')
theme('stroke', '$activeColor') theme('stroke', '$activeColor')
i i
theme('color', '$activeColor') theme('color', '$activeColor')

View File

@ -4,27 +4,25 @@
{{>toolbarSectionButton toolbarButton}} {{>toolbarSectionButton toolbarButton}}
{{/each}} {{/each}}
{{ #if extraToolbarButtons}} {{#if extraToolbarButtons}}
<div id="moreTools" class="js-open-more-tools toolbarSectionButton rp-x-1 rm-l-3"> <div id="moreTools" class="js-open-more-tools toolbarSectionButton rp-x-1 rm-l-3">
<div class="svgContainer"> <div class="svgContainer">
<svg> <svg>
<use xlink:href="/packages/ohif_viewerbase/assets/icons.svg#icon-tools-more"></use> <use xlink:href="/packages/ohif_viewerbase/assets/icons.svg#icon-tools-more"></use>
</svg> </svg>
</div>
<div class="buttonLabel">
<span>More</span>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</div>
<div class="toolbarSectionDrawerContainer">
<div class="toolbarSectionDrawer">
{{#each toolbarButton in extraToolbarButtons}}
{{>toolbarSectionButton toolbarButton}}
{{/each}}
</div>
</div>
</div> </div>
<div class="buttonLabel"> {{/if}}
<span>More</span>
<i class="fa fa-caret-down" aria-hidden="true"></i>
</div>
</div>
<div class="toolbarSectionDrawerContainer">
<!-- TODO: [design] check which group of tools shall be shown -->
<div class="toolbarSectionDrawer">
{{#each toolbarButton in extraToolbarButtons}}
{{>toolbarSectionButton toolbarButton}}
{{/each}}
</div>
</div>
{{ /if }}
</div> </div>
</template> </template>

View File

@ -1,8 +1,9 @@
import { Template } from 'meteor/templating';
Template.toolbarSectionTools.events({ Template.toolbarSectionTools.events({
'click .js-open-more-tools'(event, instance) { 'click .js-open-more-tools'(event, instance) {
const $target = $(event.currentTarget); const $target = $(event.currentTarget);
const isActive = $target.hasClass('active'); const isActive = $target.hasClass('active');
$target.toggleClass('active', !isActive); $target.toggleClass('active', !isActive);
$target.closest('.toolbarSection').toggleClass('expanded', !isActive);
} }
}); });

View File

@ -1,30 +1,43 @@
@import "{design}/app" @import "{design}/app"
$distance = 12px $distance = 10px
.toolbarSectionTools .toolbarSectionTools
position: relative position: relative
.toolbarSectionButton.active>.toolbarSectionDrawerContainer
opacity: 1
transform(translateX(-50%) translateY(0) scale(1))
.toolbarSectionDrawerContainer .toolbarSectionDrawerContainer
bottom: - ($toolbarDrawerHeight + $distance) bottom: - $toolbarDrawerHeight
height: $toolbarDrawerHeight height: $toolbarDrawerHeight
left: 0 left: 50%
min-width: 100% min-width: 100%
opacity: 0
padding-top: $distance
position: absolute position: absolute
transition(opacity 0.3s ease\, transform 0.3s ease)
transform(translateX(-50%) translateY( - ($toolbarDrawerHeight + $distance)) scale(0))
white-space: nowrap white-space: nowrap
z-index: 1
.toolbarSectionDrawer .toolbarSectionDrawer
theme('background-color', '$uiGrayDarker') theme('background', '$uiGrayDarkest', 0.95)
theme('border', '2px solid $uiBorderColor', 0.95)
border-radius: 7px border-radius: 7px
theme('color', '$textPrimaryColor') theme('color', '$textPrimaryColor')
content: '' content: ''
display: block display: block
font-size: 18px font-size: 18px
height: $toolbarDrawerHeight - $distance height: $toolbarDrawerHeight
padding-top: 6px
text-align: center text-align: center
width: 100% width: 100%
#moreTools #moreTools
position: relative
.buttonLabel i .buttonLabel i
text-align: center text-align: center
transition(all 300ms ease) transition(all 300ms ease)