diff --git a/src/components/render.js b/src/components/render.js index a7ae01ba..0f56e618 100644 --- a/src/components/render.js +++ b/src/components/render.js @@ -34,8 +34,15 @@ class CanvasRender extends Component { } getTargetZoom = (scale = 1) => { - const { viewport } = this.viewer - return viewport.imageToViewportZoom(scale) + let zooms = [] + const { viewport, world } = this.viewer + const count = world.getItemCount() + + for (let i = 0; i < count; i++) { + zooms[i] = world.getItemAt(i).imageToViewportZoom(scale) + } + + return Math.max(zooms) } updateZoomLimits = () => { diff --git a/src/components/slider/sliderRail.js b/src/components/slider/sliderRail.js index 35ec15c2..9e88fae8 100644 --- a/src/components/slider/sliderRail.js +++ b/src/components/slider/sliderRail.js @@ -13,30 +13,7 @@ const railStyle = { } const SliderRail = ({ activeHandleID, getEventData, getRailProps }) => { - const [value, setValue] = useState(null) - const [percent, setPercent] = useState(null) - - const onMouseEnter = () => { - document.addEventListener('mousemove', onMouseMove) - } - - const onMouseLeave = () => { - setValue(null) - setPercent(null) - document.removeEventListener('mousemove', onMouseMove) - } - - const onMouseMove = e => { - if (activeHandleID) { - setValue(null) - setPercent(null) - } else { - setValue(getEventData(e).value) - setPercent(getEventData(e).percent) - } - } - - return
+ return
} SliderRail.propTypes = {