Fixing scrollbar thumb width on IE11

This commit is contained in:
Bruno Alves de Faria 2017-04-19 07:45:39 -03:00
parent b30d951ad0
commit 35903109ab
4 changed files with 28 additions and 23 deletions

View File

@ -44,6 +44,9 @@
border: 0 none border: 0 none
outline: 0 none outline: 0 none
&::-ms-tooltip
display: none
.double-row-style .double-row-style
box-sizing: border-box box-sizing: border-box
width: 300px width: 300px

View File

@ -1,11 +1,7 @@
<template name="imageControls"> <template name="imageControls">
<div class="imageControls"> <div class="imageControls">
<div id="scrollbar"> <div class="scrollbar">
<input id="imageSlider" <input class="imageSlider" type="range" min="1" value="{{imageIndex}}" max="{{numImages}}"/>
type="range"
min="1"
value="{{imageIndex}}"
max="{{numImages}}"/>
</div> </div>
</div> </div>
</template> </template>

View File

@ -1,5 +1,6 @@
import { Template } from 'meteor/templating'; import { Template } from 'meteor/templating';
import { $ } from 'meteor/jquery'; import { $ } from 'meteor/jquery';
import { OHIF } from 'meteor/ohif:core';
import { setActiveViewport } from '../../../lib/setActiveViewport'; import { setActiveViewport } from '../../../lib/setActiveViewport';
import { switchToImageByIndex } from '../../../lib/switchToImageByIndex'; import { switchToImageByIndex } from '../../../lib/switchToImageByIndex';
@ -11,12 +12,12 @@ Template.imageControls.onRendered(() => {
// Set the current imageSlider width to its parent's height // Set the current imageSlider width to its parent's height
// (because webkit is stupid and can't style vertical sliders) // (because webkit is stupid and can't style vertical sliders)
const $slider = instance.$('#imageSlider'); const $slider = instance.$('.imageSlider');
const $element = $slider.parents().eq(2).siblings('.imageViewerViewport'); const $element = $slider.parents().eq(2).siblings('.imageViewerViewport');
const viewportHeight = $element.height(); const viewportHeight = $element.height();
$slider.width(viewportHeight - 20); $slider.width(viewportHeight - 20);
}) });
Template.imageControls.events({ Template.imageControls.events({
'keydown input[type=range]'(event) { 'keydown input[type=range]'(event) {
@ -37,6 +38,7 @@ Template.imageControls.events({
event.preventDefault(); event.preventDefault();
} }
}, },
'input input[type=range], change input[type=range]'(event) { 'input input[type=range], change input[type=range]'(event) {
// Note that we throttle requests to prevent the // Note that we throttle requests to prevent the
// user's ultrafast scrolling from firing requests too quickly. // user's ultrafast scrolling from firing requests too quickly.
@ -44,13 +46,13 @@ Template.imageControls.events({
slideTimeout = setTimeout(() => { slideTimeout = setTimeout(() => {
// Using the slider in an inactive viewport // Using the slider in an inactive viewport
// should cause that viewport to become active // should cause that viewport to become active
const slider = $(event.currentTarget); const $slider = $(event.currentTarget);
const newActiveElement = slider.parents('.viewportContainer').find('.imageViewerViewport'); const newActiveElement = $slider.parents('.viewportContainer').find('.imageViewerViewport');
setActiveViewport(newActiveElement); setActiveViewport(newActiveElement);
// Subtract 1 here since the slider goes from 1 to N images // Subtract 1 here since the slider goes from 1 to N images
// But the stack indexing starts at 0 // But the stack indexing starts at 0
const newImageIdIndex = parseInt(slider.val(), 10) - 1; const newImageIdIndex = parseInt($slider.val(), 10) - 1;
switchToImageByIndex(newImageIdIndex); switchToImageByIndex(newImageIdIndex);
}, slideTimeoutTime); }, slideTimeoutTime);

View File

@ -7,7 +7,6 @@ $imageSliderBorder = none
// Note that these are backwards due to the magic needed to make a cross-browser vertical slider // Note that these are backwards due to the magic needed to make a cross-browser vertical slider
$imageSliderWidth = 12px $imageSliderWidth = 12px
$imageSliderHeight = 39px $imageSliderHeight = 39px
$imageSliderCursor = grab
.imageControls .imageControls
position: absolute position: absolute
@ -16,12 +15,12 @@ $imageSliderCursor = grab
height: 100% height: 100%
padding: 5px padding: 5px
#scrollbar .scrollbar
height: calc(100% - 20px); height: calc(100% - 20px);
margin-top: 5px margin-top: 5px
width: 31px width: 31px
#imageSlider .imageSlider
position: absolute position: absolute
left: 20px left: 20px
@ -57,7 +56,7 @@ $imageSliderCursor = grab
&::-ms-track &::-ms-track
width: 100% width: 100%
height: 2px height: $imageSliderWidth
border: none border: none
cursor: pointer cursor: pointer
animate: 0.2s animate: 0.2s
@ -80,11 +79,12 @@ $imageSliderCursor = grab
border: $imageSliderBorder border: $imageSliderBorder
height: $imageSliderWidth height: $imageSliderWidth
width: $imageSliderHeight width: $imageSliderHeight
cursor: $imageSliderCursor cursor: -webkit-grab
margin-top: -7px margin-top: -7px
&:active &:active
theme('background-color', '$activeColor') theme('background-color', '$activeColor')
cursor: -webkit-grabbing
&::-moz-range-thumb &::-moz-range-thumb
theme('background-color', '$imageSliderColor') theme('background-color', '$imageSliderColor')
@ -92,11 +92,12 @@ $imageSliderCursor = grab
border: $imageSliderBorder border: $imageSliderBorder
height: $imageSliderWidth height: $imageSliderWidth
width: $imageSliderHeight width: $imageSliderHeight
cursor: $imageSliderCursor cursor: -moz-grab
z-index: 7 z-index: 7
&:active &:active
theme('background-color', '$activeColor') theme('background-color', '$activeColor')
cursor: -moz-grabbing
&::-ms-thumb &::-ms-thumb
theme('background-color', '$imageSliderColor') theme('background-color', '$imageSliderColor')
@ -104,12 +105,15 @@ $imageSliderCursor = grab
border: $imageSliderBorder border: $imageSliderBorder
height: $imageSliderWidth height: $imageSliderWidth
width: $imageSliderHeight width: $imageSliderHeight
cursor: $imageSliderCursor cursor: ns-resize
&:active &:active
theme('background-color', '$activeColor') theme('background-color', '$activeColor')
&::-ms-tooltip
display: none
// Set left position in IE, border-width attribute breaks left position of imageSlider // Set left position in IE, border-width attribute breaks left position of imageSlider
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) @media screen and (-ms-high-contrast: active), (-ms-high-contrast: none)
#imageSlider .imageSlider
left: 50px left: 50px