diff --git a/packages/graphics/package.json b/packages/graphics/package.json index 8839fa8..2d417fa 100644 --- a/packages/graphics/package.json +++ b/packages/graphics/package.json @@ -52,8 +52,7 @@ "@pixi/text": "^5.3.9", "image-size": "^0.9.3", "kefir": "^3.8.8", - "lru-cache": "^6.0.0", - "rc-slider": "^9.7.1" + "lru-cache": "^6.0.0" }, "devDependencies": { "@flecks/fleck": "^1.4.1" diff --git a/packages/graphics/src/components/stage/index.jsx b/packages/graphics/src/components/stage/index.jsx index 609aace..1d7e93f 100644 --- a/packages/graphics/src/components/stage/index.jsx +++ b/packages/graphics/src/components/stage/index.jsx @@ -8,28 +8,18 @@ import { useEffect, useImperativeHandle, useRef, - useState, } from '@flecks/react'; import K from 'kefir'; -import Slider from 'rc-slider'; - -const marks = { - 1: '1x', - 2: '2x', - 4: '4x', - 8: '8x', -}; const Stage = forwardRef(({ centered, renderable, renderer, - scalable, + scale, size, styles, ticker, }, fref) => { - const [scale, setScale] = useState(1); const hostRef = useRef(); useImperativeHandle(fref, () => ({ events: () => K.merge( @@ -50,14 +40,14 @@ const Stage = forwardRef(({ event, // Normalize touch events. (event) => { + /* eslint-disable no-param-reassign */ if (-1 !== ['touchstart', 'touchmove'].indexOf(event.type)) { - /* eslint-disable no-param-reassign */ event.clientX = event.touches[0].clientX; event.deltaX = event.touches[0].deltaX; event.clientY = event.touches[0].clientY; event.deltaY = event.touches[0].deltaY; - /* eslint-enable no-param-reassign */ } + /* eslint-enable no-param-reassign */ return event; }, ) @@ -92,24 +82,10 @@ const Stage = forwardRef(({ current.removeChild(renderer.element); }, ]; - if (scalable) { - const wheelEvents = K.fromEvents(renderer.element, 'wheel'); - const onWheel = (event) => { - if (event.ctrlKey) { - event.preventDefault(); - const increment = event.deltaY > 0 ? 0.5 : 2; - setScale(Math.min(8, Math.max(1, scale * increment))); - } - }; - wheelEvents.onValue(onWheel); - cleanups.push(() => { - wheelEvents.offValue(onWheel); - }); - } return () => { cleanups.forEach((fn) => fn()); }; - }, [hostRef, renderer, scalable, scale, setScale]); + }, [hostRef, renderer]); useEffect(() => { if (!renderable || !renderer) { return undefined; @@ -136,18 +112,6 @@ const Stage = forwardRef(({ }, [renderable, renderer, ticker]); return (