diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e863002..9229559 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,14 +1,25 @@ name: Checks -on: push +on: + push: + branches: + - master + pull_request: + jobs: - build: + checks: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install modules - run: yarn - - name: Run tsc + - uses: actions/checkout@v4 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Run TypeScript run: yarn run typescript - name: Run ESLint run: yarn run lint - + - name: Build + run: yarn build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d610bab --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,35 @@ +name: Release + +on: + release: + types: [published] + +jobs: + publish: + if: ${{ !github.event.release.prerelease }} + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20.x' + registry-url: 'https://registry.npmjs.org' + cache: 'yarn' + + - name: Verify npm version + run: npm --version + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Publish to npm + # --access public: Scoped packages (@openspacelabs/*) default to private, this makes it public + # id-token: write (above) enables --provenance for signed attestations, not registry auth + run: npm publish --access public --provenance + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.gitignore b/.gitignore index 9da6239..a53e88a 100644 --- a/.gitignore +++ b/.gitignore @@ -47,6 +47,9 @@ npm-debug.log yarn-debug.log yarn-error.log +# Build output +/lib/ + # BUCK buck-out/ \.buckd/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9c29109..44da1b2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -76,17 +76,30 @@ Our pre-commit hooks verify that your commit message matches this format when co We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. -Our pre-commit hooks verify that the linter and tests pass when committing. +Our pre-commit hooks verify that the linter and type checks pass when committing. + +### Build Process + +The library source code in `src/` is built to `lib/` for distribution. The `lib/` directory is not tracked in git. + +- **Local development**: No build needed - the example app reads directly from `src/` +- **Pull requests**: CI automatically builds to verify there are no build errors +- **Releases**: GitHub Actions automatically builds and publishes to npm + +You don't need to run build commands locally unless testing the built output. ### Publishing to npm -We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. +We use [release-it](https://github.com/release-it/release-it) to create releases and [GitHub Actions](.github/workflows/release.yml) to build and publish to npm. -To publish new versions, run the following: +To publish new versions: -```sh -yarn release -``` +1. Run `yarn release` locally (creates git tag and GitHub release) +2. GitHub Actions automatically builds and publishes to npm + +Only maintainers with permission to create releases can publish. The repository must have an `NPM_TOKEN` secret configured (Settings → Secrets and variables → Actions) for CI to publish to npm. + +> **Note:** GitHub pre-releases (e.g. `v3.0.0-beta.1`) intentionally skip the npm publish step to prevent beta versions from being tagged as `latest`. The CI job will show as "Skipped" — this is expected. To publish a pre-release manually, build locally and run `npm publish --tag beta --access public`. ### Scripts diff --git a/lib/commonjs/ReactNativeZoomableView.js b/lib/commonjs/ReactNativeZoomableView.js deleted file mode 100644 index 000ace8..0000000 --- a/lib/commonjs/ReactNativeZoomableView.js +++ /dev/null @@ -1,929 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.default = exports.ReactNativeZoomableView = void 0; -var _lodash = require("lodash"); -var _react = _interopRequireWildcard(require("react")); -var _reactNative = require("react-native"); -var _animations = require("./animations"); -var _components = require("./components"); -var _StaticPin = require("./components/StaticPin"); -var _debugHelper = require("./debugHelper"); -var _helper = require("./helper"); -var _coordinateConversion = require("./helper/coordinateConversion"); -var _useLatestCallback = require("./hooks/useLatestCallback"); -var _jsxRuntime = require("react/jsx-runtime"); -function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } -const ReactNativeZoomableView = (props, ref) => { - const [originalWidth, setOriginalWidth] = (0, _react.useState)(0); - const [originalHeight, setOriginalHeight] = (0, _react.useState)(0); - const [originalPageX, setOriginalPageX] = (0, _react.useState)(0); - const [originalPageY, setOriginalPageY] = (0, _react.useState)(0); - const [originalX, setOriginalX] = (0, _react.useState)(0); - const [originalY, setOriginalY] = (0, _react.useState)(0); - const [pinSize, setPinSize] = (0, _react.useState)({ - width: 0, - height: 0 - }); - const [debugPoints, setDebugPoints] = (0, _react.useState)([]); - const [stateTouches, setStateTouches] = (0, _react.useState)([]); - const zoomSubjectWrapperRef = (0, _react.useRef)(null); - const gestureHandlers = (0, _react.useRef)(); - const doubleTapFirstTapReleaseTimestamp = (0, _react.useRef)(); - props = (0, _lodash.defaults)({}, props, { - zoomEnabled: true, - panEnabled: true, - initialZoom: 1, - initialOffsetX: 0, - initialOffsetY: 0, - maxZoom: 1.5, - minZoom: 0.5, - pinchToZoomInSensitivity: 1, - pinchToZoomOutSensitivity: 1, - movementSensibility: 1, - doubleTapDelay: 300, - zoomStep: 0.5, - onLongPress: undefined, - longPressDuration: 700, - contentWidth: undefined, - contentHeight: undefined, - visualTouchFeedbackEnabled: true, - staticPinPosition: undefined, - staticPinIcon: undefined, - onStaticPinPositionChange: undefined, - onStaticPinPositionMove: undefined, - disablePanOnInitialZoom: false - }); - const panAnim = (0, _react.useRef)(new _reactNative.Animated.ValueXY({ - x: 0, - y: 0 - })); - const zoomAnim = (0, _react.useRef)(new _reactNative.Animated.Value(1)); - const offsetX = (0, _react.useRef)(0); - const offsetY = (0, _react.useRef)(0); - const zoomLevel = (0, _react.useRef)(1); - const lastGestureCenterPosition = (0, _react.useRef)(null); - const lastGestureTouchDistance = (0, _react.useRef)(150); - const gestureType = (0, _react.useRef)(); - const gestureStarted = (0, _react.useRef)(false); - - /** - * Last press time (used to evaluate whether user double tapped) - */ - const longPressTimeout = (0, _react.useRef)(); - const onTransformInvocationInitialized = (0, _react.useRef)(); - const singleTapTimeoutId = (0, _react.useRef)(); - const touches = (0, _react.useRef)([]); - const doubleTapFirstTap = (0, _react.useRef)(); - const measureZoomSubjectInterval = (0, _react.useRef)(); - (0, _react.useLayoutEffect)(() => { - gestureHandlers.current = _reactNative.PanResponder.create({ - onStartShouldSetPanResponder: _handleStartShouldSetPanResponder, - onPanResponderGrant: _handlePanResponderGrant, - onPanResponderMove: _handlePanResponderMove, - onPanResponderRelease: _handlePanResponderEnd, - onPanResponderTerminate: (evt, gestureState) => { - // We should also call _handlePanResponderEnd - // to properly perform cleanups when the gesture is terminated - // (aka gesture handling responsibility is taken over by another component). - // This also fixes a weird issue where - // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, - // but onPanResponderTerminate is called instead for no apparent reason. - _handlePanResponderEnd(evt, gestureState); - props.onPanResponderTerminate?.(evt, gestureState, _getZoomableViewEventObject()); - }, - onPanResponderTerminationRequest: (evt, gestureState) => !!props.onPanResponderTerminationRequest?.(evt, gestureState, _getZoomableViewEventObject()), - // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => props.onShouldBlockNativeResponder?.(evt, gestureState, _getZoomableViewEventObject()) ?? true, - onStartShouldSetPanResponderCapture: (evt, gestureState) => !!props.onStartShouldSetPanResponderCapture?.(evt, gestureState), - onMoveShouldSetPanResponderCapture: (evt, gestureState) => !!props.onMoveShouldSetPanResponderCapture?.(evt, gestureState) - }); - if (props.zoomAnimatedValue) zoomAnim.current = props.zoomAnimatedValue; - if (props.panAnimatedValueXY) panAnim.current = props.panAnimatedValueXY; - if (props.initialZoom) zoomLevel.current = props.initialZoom; - if (props.initialOffsetX != null) offsetX.current = props.initialOffsetX; - if (props.initialOffsetY != null) offsetY.current = props.initialOffsetY; - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - zoomAnim.current.setValue(zoomLevel.current); - panAnim.current.addListener(({ - x, - y - }) => { - offsetX.current = x; - offsetY.current = y; - }); - zoomAnim.current.addListener(({ - value - }) => { - zoomLevel.current = value; - }); - }, []); - const { - zoomEnabled - } = props; - const initialZoom = (0, _react.useRef)(props.initialZoom); - initialZoom.current = props.initialZoom; - (0, _react.useLayoutEffect)(() => { - if (!zoomEnabled && initialZoom.current) { - zoomLevel.current = initialZoom.current; - zoomAnim.current.setValue(zoomLevel.current); - } - }, [zoomEnabled]); - (0, _react.useLayoutEffect)(() => { - if (!onTransformInvocationInitialized.current && _invokeOnTransform().successful) { - panAnim.current.addListener(() => _invokeOnTransform()); - zoomAnim.current.addListener(() => _invokeOnTransform()); - onTransformInvocationInitialized.current = true; - } - }, - // FIXME: deps has implicit coupling with internal _invokeOnTransform logic - [originalWidth, originalHeight]); - const onLayout = (0, _react.useRef)(props.onLayout); - onLayout.current = props.onLayout; - - // Handle original measurements changed - (0, _react.useLayoutEffect)(() => { - // We use a custom `onLayout` event, so the clients can stay in-sync - // with when the internal measurements are actually saved to the state, - // thus helping them apply transformations at more accurate timings - const layout = { - width: originalWidth, - height: originalHeight, - x: originalX, - y: originalY - }; - onLayout.current?.({ - nativeEvent: { - layout - } - }); - if (onTransformInvocationInitialized.current) _invokeOnTransform(); - }, [originalHeight, originalWidth, originalPageX, originalPageY, originalX, originalY]); - - // Handle staticPinPosition changed - (0, _react.useLayoutEffect)(() => { - if (onTransformInvocationInitialized.current) _invokeOnTransform(); - }, [props.staticPinPosition?.x, props.staticPinPosition?.y]); - (0, _react.useEffect)(() => { - measureZoomSubject(); - // We've already run `grabZoomSubjectOriginalMeasurements` at various events - // to make sure the measurements are promptly updated. - // However, there might be cases we haven't accounted for, especially when - // native processes are involved. To account for those cases, - // we'll use an interval here to ensure we're always up-to-date. - // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender - // if the values given haven't changed, so we're not running performance risk here. - measureZoomSubjectInterval.current = setInterval(measureZoomSubject, 1e3); - return () => { - measureZoomSubjectInterval.current && clearInterval(measureZoomSubjectInterval.current); - }; - }, []); - const onStaticPinPositionChange = (0, _useLatestCallback.useLatestCallback)(props.onStaticPinPositionChange || (() => undefined)); - const debouncedOnStaticPinPositionChange = (0, _react.useMemo)(() => (0, _lodash.debounce)(onStaticPinPositionChange, 100), []); - - /** - * try to invoke onTransform - * @private - */ - const _invokeOnTransform = (0, _useLatestCallback.useLatestCallback)(() => { - const zoomableViewEvent = _getZoomableViewEventObject(); - const position = _staticPinPosition(); - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { - successful: false - }; - props.onTransform?.(zoomableViewEvent); - if (position) { - props.onStaticPinPositionMove?.(position); - debouncedOnStaticPinPositionChange(position); - } - return { - successful: true - }; - }); - - /** - * Returns additional information about components current state for external event hooks - * - * @returns {{}} - * @private - */ - const _getZoomableViewEventObject = (0, _useLatestCallback.useLatestCallback)((overwriteObj = {}) => { - return { - zoomLevel: zoomLevel.current, - offsetX: offsetX.current, - offsetY: offsetY.current, - originalHeight, - originalWidth, - originalPageX, - originalPageY, - ...overwriteObj - }; - }); - - /** - * Get the original box dimensions and save them for later use. - * (They will be used to calculate boxBorders) - * - * @private - */ - const measureZoomSubject = (0, _useLatestCallback.useLatestCallback)(() => { - // make sure we measure after animations are complete - requestAnimationFrame(() => { - // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` - // when navigating back (react-navigation stack) from another view - // while closing the keyboard at the same time - setTimeout(() => { - // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper. - // However, our zoomSubject may have been transformed by an initial zoomLevel or offset, - // in which case these measurements will not represent the true "original" measurements. - // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject - // (no border, space, or anything between them) - zoomSubjectWrapperRef.current?.measure((x, y, width, height, pageX, pageY) => { - // When the component is off-screen, these become all 0s, so we don't set them - // to avoid messing up calculations, especially ones that are done right after - // the component transitions from hidden to visible. - if (!pageX && !pageY && !width && !height) return; - setOriginalX(x); - setOriginalY(y); - setOriginalWidth(width); - setOriginalHeight(height); - setOriginalPageX(pageX); - setOriginalPageY(pageY); - }); - }); - }); - }); - - /** - * Handles the start of touch events and checks for taps - * - * @param e - * @param gestureState - * @returns {boolean} - * - * @private - */ - const _handleStartShouldSetPanResponder = (0, _useLatestCallback.useLatestCallback)((e, gestureState) => { - if (props.onStartShouldSetPanResponder) { - props.onStartShouldSetPanResponder(e, gestureState, _getZoomableViewEventObject(), false); - } - - // Always set pan responder on start - // of gesture so we can handle tap. - // "Pan threshold validation" will be handled - // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder` - return true; - }); - - /** - * Calculates pinch distance - * - * @param e - * @param gestureState - * @private - */ - const _handlePanResponderGrant = (0, _useLatestCallback.useLatestCallback)((e, gestureState) => { - if (props.onLongPress) { - e.persist(); - longPressTimeout.current = setTimeout(() => { - props.onLongPress?.(e, gestureState, _getZoomableViewEventObject()); - longPressTimeout.current = undefined; - }, props.longPressDuration); - } - props.onPanResponderGrant?.(e, gestureState, _getZoomableViewEventObject()); - panAnim.current.stopAnimation(); - zoomAnim.current.stopAnimation(); - gestureStarted.current = true; - }); - - /** - * Handles the end of touch events - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePanResponderEnd = (0, _useLatestCallback.useLatestCallback)((e, gestureState) => { - if (!gestureType.current) { - _resolveAndHandleTap(e); - } - setDebugPoints([]); - lastGestureCenterPosition.current = null; - if (longPressTimeout.current) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - props.onPanResponderEnd?.(e, gestureState, _getZoomableViewEventObject()); - if (gestureType.current === 'pinch') { - props.onZoomEnd?.(e, gestureState, _getZoomableViewEventObject()); - } else if (gestureType.current === 'shift') { - props.onShiftingEnd?.(e, gestureState, _getZoomableViewEventObject()); - } - if (props.staticPinPosition) { - _updateStaticPin(); - } - gestureType.current = undefined; - gestureStarted.current = false; - }); - - /** - * Handles the actual movement of our pan responder - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePanResponderMove = (0, _useLatestCallback.useLatestCallback)((e, gestureState) => { - if (props.onPanResponderMove) { - if (props.onPanResponderMove(e, gestureState, _getZoomableViewEventObject())) { - return false; - } - } - - // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - if (gestureState.numberActiveTouches <= 2) { - if (!gestureStarted.current) { - _handlePanResponderGrant(e, gestureState); - } - } else { - if (gestureStarted.current) { - _handlePanResponderEnd(e, gestureState); - } - return true; - } - if (gestureState.numberActiveTouches === 2) { - if (longPressTimeout.current) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - - // change some measurement states when switching gesture to ensure a smooth transition - if (gestureType.current !== 'pinch') { - lastGestureCenterPosition.current = (0, _helper.calcGestureCenterPoint)(e, gestureState); - lastGestureTouchDistance.current = (0, _helper.calcGestureTouchDistance)(e, gestureState); - } - gestureType.current = 'pinch'; - _handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if (longPressTimeout.current && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - // change some measurement states when switching gesture to ensure a smooth transition - if (gestureType.current !== 'shift') { - lastGestureCenterPosition.current = (0, _helper.calcGestureCenterPoint)(e, gestureState); - } - const { - dx, - dy - } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - if (isShiftGesture) { - gestureType.current = 'shift'; - _handleShifting(gestureState); - } - } - }); - - /** - * Handles the pinch movement and zooming - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePinching = (0, _useLatestCallback.useLatestCallback)((e, gestureState) => { - if (!props.zoomEnabled) return; - const { - maxZoom, - minZoom, - pinchToZoomInSensitivity, - pinchToZoomOutSensitivity - } = props; - const distance = (0, _helper.calcGestureTouchDistance)(e, gestureState); - if (props.onZoomBefore && props.onZoomBefore(e, gestureState, _getZoomableViewEventObject())) { - return; - } - if (!distance) return; - if (!lastGestureTouchDistance.current) return; - - // define the new zoom level and take zoom level sensitivity into consideration - const zoomGrowthFromLastGestureState = distance / lastGestureTouchDistance.current; - lastGestureTouchDistance.current = distance; - const pinchToZoomSensitivity = zoomGrowthFromLastGestureState < 1 ? pinchToZoomOutSensitivity : pinchToZoomInSensitivity; - if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; - // 0 - no resistance - // 10 - 90% resistance - const deltaGrowthAdjustedBySensitivity = deltaGrowth * (1 - pinchToZoomSensitivity * 9 / 100); - let newZoomLevel = zoomLevel.current * (1 + deltaGrowthAdjustedBySensitivity); - - // make sure max and min zoom levels are respected - if (maxZoom != null && newZoomLevel > maxZoom) { - newZoomLevel = maxZoom; - } - if (minZoom != null && newZoomLevel < minZoom) { - newZoomLevel = minZoom; - } - const gestureCenterPoint = (0, _helper.calcGestureCenterPoint)(e, gestureState); - if (!gestureCenterPoint) return; - let zoomCenter = { - x: gestureCenterPoint.x - originalPageX, - y: gestureCenterPoint.y - originalPageY - }; - if (props.staticPinPosition) { - // When we use a static pin position, the zoom centre is the same as that position, - // otherwise the pin moves around way too much while zooming. - zoomCenter = { - x: props.staticPinPosition.x, - y: props.staticPinPosition.y - }; - } - - // Uncomment to debug - props.debug && _setPinchDebugPoints(e, zoomCenter); - const oldOffsetX = offsetX.current; - const oldOffsetY = offsetY.current; - const oldScale = zoomLevel.current; - const newScale = newZoomLevel; - if (!originalHeight || !originalWidth) return; - let newOffsetY = (0, _helper.calcNewScaledOffsetForZoomCentering)(oldOffsetY, originalHeight, oldScale, newScale, zoomCenter.y); - let newOffsetX = (0, _helper.calcNewScaledOffsetForZoomCentering)(oldOffsetX, originalWidth, oldScale, newScale, zoomCenter.x); - const offsetShift = _calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - if (offsetShift) { - newOffsetX += offsetShift.x; - newOffsetY += offsetShift.y; - } - offsetX.current = newOffsetX; - offsetY.current = newOffsetY; - zoomLevel.current = newScale; - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - zoomAnim.current.setValue(zoomLevel.current); - props.onZoomAfter?.(e, gestureState, _getZoomableViewEventObject()); - }); - - /** - * Used to debug pinch events - * @param gestureResponderEvent - * @param zoomCenter - * @param points - */ - const _setPinchDebugPoints = (0, _useLatestCallback.useLatestCallback)((gestureResponderEvent, zoomCenter, ...points) => { - const { - touches - } = gestureResponderEvent.nativeEvent; - setDebugPoints([{ - x: touches[0].pageX - originalPageX, - y: touches[0].pageY - originalPageY - }, { - x: touches[1].pageX - originalPageX, - y: touches[1].pageY - originalPageY - }, zoomCenter, ...points]); - }); - - /** - * Calculates the amount the offset should shift since the last position during panning - * - * @param {Vec2D} gestureCenterPoint - * - * @private - */ - const _calcOffsetShiftSinceLastGestureState = (0, _useLatestCallback.useLatestCallback)(gestureCenterPoint => { - const { - movementSensibility - } = props; - let shift = null; - if (lastGestureCenterPosition.current && movementSensibility) { - const dx = gestureCenterPoint.x - lastGestureCenterPosition.current.x; - const dy = gestureCenterPoint.y - lastGestureCenterPosition.current.y; - const shiftX = dx / zoomLevel.current / movementSensibility; - const shiftY = dy / zoomLevel.current / movementSensibility; - shift = { - x: shiftX, - y: shiftY - }; - } - lastGestureCenterPosition.current = gestureCenterPoint; - return shift; - }); - - /** - * Handles movement by tap and move - * - * @param gestureState - * - * @private - */ - const _handleShifting = (0, _useLatestCallback.useLatestCallback)(gestureState => { - // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level - if (!props.panEnabled || props.disablePanOnInitialZoom && zoomLevel.current === props.initialZoom) { - return; - } - const shift = _calcOffsetShiftSinceLastGestureState({ - x: gestureState.moveX, - y: gestureState.moveY - }); - if (!shift) return; - const newOffsetX = offsetX.current + shift.x; - const newOffsetY = offsetY.current + shift.y; - if (props.debug && originalPageX && originalPageY) { - const x = gestureState.moveX - originalPageX; - const y = gestureState.moveY - originalPageY; - setDebugPoints([{ - x, - y - }]); - } - _setNewOffsetPosition(newOffsetX, newOffsetY); - }); - - /** - * Set the state to offset moved - * - * @param {number} newOffsetX - * @param {number} newOffsetY - * @returns - */ - const _setNewOffsetPosition = (0, _useLatestCallback.useLatestCallback)((newOffsetX, newOffsetY) => { - const { - onShiftingBefore, - onShiftingAfter - } = props; - if (onShiftingBefore?.(null, null, _getZoomableViewEventObject())) { - return; - } - offsetX.current = newOffsetX; - offsetY.current = newOffsetY; - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - zoomAnim.current.setValue(zoomLevel.current); - onShiftingAfter?.(null, null, _getZoomableViewEventObject()); - }); - - /** - * Check whether the press event is double tap - * or single tap and handle the event accordingly - * - * @param e - * - * @private - */ - const _resolveAndHandleTap = (0, _useLatestCallback.useLatestCallback)(e => { - const now = Date.now(); - if (doubleTapFirstTapReleaseTimestamp.current && props.doubleTapDelay && now - doubleTapFirstTapReleaseTimestamp.current < props.doubleTapDelay) { - doubleTapFirstTap.current && _addTouch({ - ...doubleTapFirstTap.current, - id: now.toString(), - isSecondTap: true - }); - singleTapTimeoutId.current && clearTimeout(singleTapTimeoutId.current); - delete doubleTapFirstTapReleaseTimestamp.current; - delete singleTapTimeoutId.current; - delete doubleTapFirstTap.current; - _handleDoubleTap(e); - } else { - doubleTapFirstTapReleaseTimestamp.current = now; - doubleTapFirstTap.current = { - id: now.toString(), - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY - }; - _addTouch(doubleTapFirstTap.current); - - // persist event so e.nativeEvent is preserved after a timeout delay - e.persist(); - singleTapTimeoutId.current = setTimeout(() => { - delete doubleTapFirstTapReleaseTimestamp.current; - delete singleTapTimeoutId.current; - - // Pan to the tapped location - if (props.staticPinPosition && doubleTapFirstTap.current) { - const tapX = props.staticPinPosition.x - doubleTapFirstTap.current.x; - const tapY = props.staticPinPosition.y - doubleTapFirstTap.current.y; - _reactNative.Animated.timing(panAnim.current, { - toValue: { - x: offsetX.current + tapX / zoomLevel.current, - y: offsetY.current + tapY / zoomLevel.current - }, - useNativeDriver: true, - duration: 200 - }).start(() => { - _updateStaticPin(); - }); - } - props.onSingleTap?.(e, _getZoomableViewEventObject()); - }, props.doubleTapDelay); - } - }); - const publicMoveStaticPinTo = (0, _useLatestCallback.useLatestCallback)((position, duration) => { - const { - staticPinPosition, - contentWidth, - contentHeight - } = props; - if (!staticPinPosition) return; - if (!originalWidth || !originalHeight) return; - if (!contentWidth || !contentHeight) return; - - // Offset for the static pin - const pinX = staticPinPosition.x - originalWidth / 2; - const pinY = staticPinPosition.y - originalHeight / 2; - offsetX.current = contentWidth / 2 - position.x + pinX / zoomLevel.current; - offsetY.current = contentHeight / 2 - position.y + pinY / zoomLevel.current; - if (duration) { - _reactNative.Animated.timing(panAnim.current, { - toValue: { - x: offsetX.current, - y: offsetY.current - }, - useNativeDriver: true, - duration - }).start(); - } else { - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - } - }); - const _staticPinPosition = (0, _useLatestCallback.useLatestCallback)(() => { - if (!props.staticPinPosition) return; - if (!props.contentWidth || !props.contentHeight) return; - return (0, _coordinateConversion.viewportPositionToImagePosition)({ - viewportPosition: { - x: props.staticPinPosition.x, - y: props.staticPinPosition.y - }, - imageSize: { - height: props.contentHeight, - width: props.contentWidth - }, - zoomableEvent: { - ..._getZoomableViewEventObject(), - offsetX: offsetX.current, - offsetY: offsetY.current, - zoomLevel: zoomLevel.current - } - }); - }); - const _updateStaticPin = (0, _useLatestCallback.useLatestCallback)(() => { - const position = _staticPinPosition(); - if (!position) return; - props.onStaticPinPositionChange?.(position); - }); - const _addTouch = (0, _useLatestCallback.useLatestCallback)(touch => { - touches.current.push(touch); - setStateTouches([...touches.current]); - }); - const _removeTouch = (0, _useLatestCallback.useLatestCallback)(touch => { - touches.current.splice(touches.current.indexOf(touch), 1); - setStateTouches([...touches.current]); - }); - - /** - * Handles the double tap event - * - * @param e - * - * @private - */ - const _handleDoubleTap = (0, _useLatestCallback.useLatestCallback)(e => { - const { - onDoubleTapBefore, - onDoubleTapAfter, - doubleTapZoomToCenter - } = props; - onDoubleTapBefore?.(e, _getZoomableViewEventObject()); - const nextZoomStep = _getNextZoomStep(); - if (nextZoomStep == null) return; - - // define new zoom position coordinates - const zoomPositionCoordinates = { - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY - }; - - // if doubleTapZoomToCenter enabled -> always zoom to center instead - if (doubleTapZoomToCenter) { - zoomPositionCoordinates.x = 0; - zoomPositionCoordinates.y = 0; - } - publicZoomTo(nextZoomStep, zoomPositionCoordinates); - onDoubleTapAfter?.(e, _getZoomableViewEventObject({ - zoomLevel: nextZoomStep - })); - }); - - /** - * Returns the next zoom step based on current step and zoomStep property. - * If we are zoomed all the way in -> return to initialzoom - * - * @returns {*} - */ - const _getNextZoomStep = (0, _useLatestCallback.useLatestCallback)(() => { - const { - zoomStep, - maxZoom, - initialZoom - } = props; - if (maxZoom == null) return; - if (zoomLevel.current.toFixed(2) === maxZoom.toFixed(2)) { - return initialZoom; - } - if (zoomStep == null) return; - const nextZoomStep = zoomLevel.current * (1 + zoomStep); - if (nextZoomStep > maxZoom) { - return maxZoom; - } - return nextZoomStep; - }); - - /** - * Zooms to a specific level. A "zoom center" can be provided, which specifies - * the point that will remain in the same position on the screen after the zoom. - * The coordinates of the zoom center is relative to the zoom subject. - * { x: 0, y: 0 } is the very center of the zoom subject. - * - * @param newZoomLevel - * @param zoomCenter - If not supplied, the container's center is the zoom center - */ - const publicZoomTo = (0, _useLatestCallback.useLatestCallback)((newZoomLevel, zoomCenter) => { - if (!props.zoomEnabled) return false; - if (props.maxZoom && newZoomLevel > props.maxZoom) return false; - if (props.minZoom && newZoomLevel < props.minZoom) return false; - props.onZoomBefore?.(null, null, _getZoomableViewEventObject()); - - // == Perform Pan Animation to preserve the zoom center while zooming == - let listenerId = ''; - if (zoomCenter) { - // Calculates panAnim values based on changes in zoomAnim. - let prevScale = zoomLevel.current; - // Since zoomAnim is calculated in native driver, - // it will jitter panAnim once in a while, - // because here panAnim is being calculated in js. - // However the jittering should mostly occur in simulator. - listenerId = zoomAnim.current.addListener(({ - value: newScale - }) => { - panAnim.current.setValue({ - x: (0, _helper.calcNewScaledOffsetForZoomCentering)(offsetX.current, originalWidth, prevScale, newScale, zoomCenter.x), - y: (0, _helper.calcNewScaledOffsetForZoomCentering)(offsetY.current, originalHeight, prevScale, newScale, zoomCenter.y) - }); - prevScale = newScale; - }); - } - - // == Perform Zoom Animation == - (0, _animations.getZoomToAnimation)(zoomAnim.current, newZoomLevel).start(() => { - zoomAnim.current.removeListener(listenerId); - }); - // == Zoom Animation Ends == - - props.onZoomAfter?.(null, null, _getZoomableViewEventObject()); - return true; - }); - - /** - * Zooms in or out by a specified change level - * Use a positive number for `zoomLevelChange` to zoom in - * Use a negative number for `zoomLevelChange` to zoom out - * - * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. - * - * @param {number | null} zoomLevelChange - * - * @return {bool} - */ - const publicZoomBy = (0, _useLatestCallback.useLatestCallback)(zoomLevelChange => { - // if no zoom level Change given -> just use zoom step - zoomLevelChange ||= props.zoomStep || 0; - return publicZoomTo(zoomLevel.current + zoomLevelChange); - }); - - /** - * Moves the zoomed view to a specified position - * Returns a promise when finished - * - * @param {number} newOffsetX the new position we want to move it to (x-axis) - * @param {number} newOffsetY the new position we want to move it to (y-axis) - * - * @return {bool} - */ - const publicMoveTo = (0, _useLatestCallback.useLatestCallback)((newOffsetX, newOffsetY) => { - if (!originalWidth || !originalHeight) return; - const offsetX = (newOffsetX - originalWidth / 2) / zoomLevel.current; - const offsetY = (newOffsetY - originalHeight / 2) / zoomLevel.current; - _setNewOffsetPosition(-offsetX, -offsetY); - }); - - /** - * Moves the zoomed view by a certain amount. - * - * Returns a promise when finished - * - * @param {number} offsetChangeX the amount we want to move the offset by (x-axis) - * @param {number} offsetChangeY the amount we want to move the offset by (y-axis) - * - * @return {bool} - */ - const publicMoveBy = (0, _useLatestCallback.useLatestCallback)((offsetChangeX, offsetChangeY) => { - const newOffsetX = (offsetX.current * zoomLevel.current - offsetChangeX) / zoomLevel.current; - const newOffsetY = (offsetY.current * zoomLevel.current - offsetChangeY) / zoomLevel.current; - _setNewOffsetPosition(newOffsetX, newOffsetY); - }); - (0, _react.useImperativeHandle)(ref, () => ({ - zoomTo: publicZoomTo, - zoomBy: publicZoomBy, - moveTo: publicMoveTo, - moveBy: publicMoveBy, - moveStaticPinTo: publicMoveStaticPinTo, - get gestureStarted() { - return gestureStarted.current; - } - })); - const { - staticPinIcon, - children, - visualTouchFeedbackEnabled, - doubleTapDelay, - staticPinPosition, - onStaticPinLongPress, - onStaticPinPress, - pinProps - } = props; - return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { - style: styles.container, - ...gestureHandlers.current?.panHandlers, - ref: zoomSubjectWrapperRef, - onLayout: measureZoomSubject, - children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { - style: [styles.zoomSubject, props.style, { - transform: [ - // In RN79, we need to split the scale into X and Y to avoid - // the content getting pixelated when zooming in - { - scaleX: zoomAnim.current - }, { - scaleY: zoomAnim.current - }, ...panAnim.current.getTranslateTransform()] - }], - children: children - }), visualTouchFeedbackEnabled && stateTouches.map(touch => doubleTapDelay && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.AnimatedTouchFeedback, { - x: touch.x, - y: touch.y, - animationDuration: doubleTapDelay, - onAnimationDone: () => { - _removeTouch(touch); - } - }, touch.id)), debugPoints.map(({ - x, - y - }, index) => { - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_debugHelper.DebugTouchPoint, { - x: x, - y: y - }, index); - }), staticPinPosition && /*#__PURE__*/(0, _jsxRuntime.jsx)(_StaticPin.StaticPin, { - staticPinIcon: staticPinIcon, - staticPinPosition: staticPinPosition, - pinSize: pinSize, - onPress: onStaticPinPress, - onLongPress: onStaticPinLongPress, - onParentMove: _handlePanResponderMove, - setPinSize: setPinSize, - pinProps: pinProps - })] - }); -}; -exports.ReactNativeZoomableView = ReactNativeZoomableView; -const styles = _reactNative.StyleSheet.create({ - container: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - overflow: 'hidden', - position: 'relative' - }, - zoomSubject: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - width: '100%' - } -}); -var _default = exports.default = ReactNativeZoomableView; -//# sourceMappingURL=ReactNativeZoomableView.js.map \ No newline at end of file diff --git a/lib/commonjs/ReactNativeZoomableView.js.map b/lib/commonjs/ReactNativeZoomableView.js.map deleted file mode 100644 index 42a9b99..0000000 --- a/lib/commonjs/ReactNativeZoomableView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_lodash","require","_react","_interopRequireWildcard","_reactNative","_animations","_components","_StaticPin","_debugHelper","_helper","_coordinateConversion","_useLatestCallback","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ReactNativeZoomableView","props","ref","originalWidth","setOriginalWidth","useState","originalHeight","setOriginalHeight","originalPageX","setOriginalPageX","originalPageY","setOriginalPageY","originalX","setOriginalX","originalY","setOriginalY","pinSize","setPinSize","width","height","debugPoints","setDebugPoints","stateTouches","setStateTouches","zoomSubjectWrapperRef","useRef","gestureHandlers","doubleTapFirstTapReleaseTimestamp","defaults","zoomEnabled","panEnabled","initialZoom","initialOffsetX","initialOffsetY","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","movementSensibility","doubleTapDelay","zoomStep","onLongPress","undefined","longPressDuration","contentWidth","contentHeight","visualTouchFeedbackEnabled","staticPinPosition","staticPinIcon","onStaticPinPositionChange","onStaticPinPositionMove","disablePanOnInitialZoom","panAnim","Animated","ValueXY","x","y","zoomAnim","Value","offsetX","offsetY","zoomLevel","lastGestureCenterPosition","lastGestureTouchDistance","gestureType","gestureStarted","longPressTimeout","onTransformInvocationInitialized","singleTapTimeoutId","touches","doubleTapFirstTap","measureZoomSubjectInterval","useLayoutEffect","current","PanResponder","create","onStartShouldSetPanResponder","_handleStartShouldSetPanResponder","onPanResponderGrant","_handlePanResponderGrant","onPanResponderMove","_handlePanResponderMove","onPanResponderRelease","_handlePanResponderEnd","onPanResponderTerminate","evt","gestureState","_getZoomableViewEventObject","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomAnimatedValue","panAnimatedValueXY","setValue","addListener","value","_invokeOnTransform","successful","onLayout","layout","nativeEvent","useEffect","measureZoomSubject","setInterval","clearInterval","useLatestCallback","debouncedOnStaticPinPositionChange","useMemo","debounce","zoomableViewEvent","position","_staticPinPosition","onTransform","overwriteObj","requestAnimationFrame","setTimeout","measure","pageX","pageY","persist","stopAnimation","_resolveAndHandleTap","clearTimeout","onPanResponderEnd","onZoomEnd","onShiftingEnd","_updateStaticPin","numberActiveTouches","calcGestureCenterPoint","calcGestureTouchDistance","_handlePinching","Math","abs","dx","dy","isShiftGesture","_handleShifting","distance","onZoomBefore","zoomGrowthFromLastGestureState","pinchToZoomSensitivity","deltaGrowth","deltaGrowthAdjustedBySensitivity","newZoomLevel","gestureCenterPoint","zoomCenter","debug","_setPinchDebugPoints","oldOffsetX","oldOffsetY","oldScale","newScale","newOffsetY","calcNewScaledOffsetForZoomCentering","newOffsetX","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","onShiftingBefore","onShiftingAfter","now","Date","_addTouch","id","toString","isSecondTap","_handleDoubleTap","tapX","tapY","timing","toValue","useNativeDriver","duration","start","onSingleTap","publicMoveStaticPinTo","pinX","pinY","viewportPositionToImagePosition","viewportPosition","imageSize","zoomableEvent","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","publicZoomTo","toFixed","listenerId","prevScale","getZoomToAnimation","removeListener","publicZoomBy","zoomLevelChange","publicMoveTo","publicMoveBy","offsetChangeX","offsetChangeY","useImperativeHandle","zoomTo","zoomBy","moveTo","moveBy","moveStaticPinTo","children","onStaticPinLongPress","onStaticPinPress","pinProps","jsxs","View","style","styles","container","panHandlers","jsx","zoomSubject","transform","scaleX","scaleY","getTranslateTransform","map","AnimatedTouchFeedback","animationDuration","onAnimationDone","index","DebugTouchPoint","StaticPin","onPress","onParentMove","exports","StyleSheet","alignItems","flex","justifyContent","overflow","_default"],"sourceRoot":"../../src","sources":["ReactNativeZoomableView.tsx"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,OAAA;AASA,IAAAG,YAAA,GAAAH,OAAA;AAWA,IAAAI,WAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,UAAA,GAAAN,OAAA;AACA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AAKA,IAAAS,qBAAA,GAAAT,OAAA;AACA,IAAAU,kBAAA,GAAAV,OAAA;AAA8D,IAAAW,WAAA,GAAAX,OAAA;AAAA,SAAAE,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAU,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,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vB8M,QAAQ,EAAEA;IAAS,CACpB,CACF;EAAA,CACG,CAAC;AAEX,CAAC;AAACsB,OAAA,CAAArP,uBAAA,GAAAA,uBAAA;AAEF,MAAMmO,MAAM,GAAGmB,uBAAU,CAAC3K,MAAM,CAAC;EAC/ByJ,SAAS,EAAE;IACTmB,UAAU,EAAE,QAAQ;IACpBC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE,QAAQ;IAClB3I,QAAQ,EAAE;EACZ,CAAC;EACDwH,WAAW,EAAE;IACXgB,UAAU,EAAE,QAAQ;IACpBC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBvO,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAAC,IAAAyO,QAAA,GAAAN,OAAA,CAAA9P,OAAA,GAEYS,uBAAuB","ignoreList":[]} diff --git a/lib/commonjs/animations/index.js b/lib/commonjs/animations/index.js deleted file mode 100644 index 473c1d5..0000000 --- a/lib/commonjs/animations/index.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.getZoomToAnimation = getZoomToAnimation; -var _reactNative = require("react-native"); -function getZoomToAnimation(animValue, toValue) { - return _reactNative.Animated.timing(animValue, { - easing: _reactNative.Easing.out(_reactNative.Easing.ease), - toValue, - useNativeDriver: true - }); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/animations/index.js.map b/lib/commonjs/animations/index.js.map deleted file mode 100644 index a048353..0000000 --- a/lib/commonjs/animations/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_reactNative","require","getZoomToAnimation","animValue","toValue","Animated","timing","easing","Easing","out","ease","useNativeDriver"],"sourceRoot":"../../../src","sources":["animations/index.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,SAASC,kBAAkBA,CAACC,SAAyB,EAAEC,OAAe,EAAE;EAC7E,OAAOC,qBAAQ,CAACC,MAAM,CAACH,SAAS,EAAE;IAChCI,MAAM,EAAEC,mBAAM,CAACC,GAAG,CAACD,mBAAM,CAACE,IAAI,CAAC;IAC/BN,OAAO;IACPO,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ","ignoreList":[]} diff --git a/lib/commonjs/assets/pin.png b/lib/commonjs/assets/pin.png deleted file mode 100644 index 471a758..0000000 Binary files a/lib/commonjs/assets/pin.png and /dev/null differ diff --git a/lib/commonjs/components/AnimatedTouchFeedback.js b/lib/commonjs/components/AnimatedTouchFeedback.js deleted file mode 100644 index 02a15b8..0000000 --- a/lib/commonjs/components/AnimatedTouchFeedback.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.AnimatedTouchFeedback = void 0; -var _react = _interopRequireWildcard(require("react")); -var _reactNative = require("react-native"); -var _jsxRuntime = require("react/jsx-runtime"); -function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } -const AnimatedTouchFeedback = ({ - x, - y, - animationDelay, - animationDuration, - onAnimationDone -}) => { - const appearDisappearAnimRef = (0, _react.useRef)(new _reactNative.Animated.Value(0)); - const onAnimationDoneRef = (0, _react.useRef)(onAnimationDone); - onAnimationDoneRef.current = onAnimationDone; - (0, _react.useEffect)(() => { - appearDisappearAnimRef.current.setValue(0); - const inDuration = animationDuration * 0.8; - const outDuration = animationDuration - inDuration; - _reactNative.Animated.sequence([_reactNative.Animated.timing(appearDisappearAnimRef.current, { - delay: animationDelay || 0, - toValue: 1, - duration: inDuration, - easing: _reactNative.Easing.linear, - useNativeDriver: true - }), _reactNative.Animated.timing(appearDisappearAnimRef.current, { - toValue: 0, - duration: outDuration, - easing: _reactNative.Easing.out(_reactNative.Easing.ease), - useNativeDriver: true - })]).start(() => onAnimationDoneRef.current?.()); - }, [animationDelay, animationDuration]); - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { - pointerEvents: "none", - style: [styles.animatedTouchFeedback, { - opacity: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0, 0.3] - }), - left: x - 20, - top: y - 20, - transform: [{ - scale: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0.5, 1] - }) - }] - }] - }); -}; -exports.AnimatedTouchFeedback = AnimatedTouchFeedback; -const styles = _reactNative.StyleSheet.create({ - animatedTouchFeedback: { - backgroundColor: 'lightgray', - borderRadius: 40, - height: 40, - position: 'absolute', - width: 40 - } -}); -//# sourceMappingURL=AnimatedTouchFeedback.js.map \ No newline at end of file diff --git a/lib/commonjs/components/AnimatedTouchFeedback.js.map b/lib/commonjs/components/AnimatedTouchFeedback.js.map deleted file mode 100644 index b33e7fb..0000000 --- a/lib/commonjs/components/AnimatedTouchFeedback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","AnimatedTouchFeedback","x","y","animationDelay","animationDuration","onAnimationDone","appearDisappearAnimRef","useRef","Animated","Value","onAnimationDoneRef","current","useEffect","setValue","inDuration","outDuration","sequence","timing","delay","toValue","duration","easing","Easing","linear","useNativeDriver","out","ease","start","jsx","View","pointerEvents","style","styles","animatedTouchFeedback","opacity","interpolate","inputRange","outputRange","left","top","transform","scale","exports","StyleSheet","create","backgroundColor","borderRadius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B,WAAW,CAAC;QAClDC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAClBC,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG;MACtB,CAAC,CAAC;MACFC,IAAI,EAAErC,CAAC,GAAG,EAAE;MACZsC,GAAG,EAAErC,CAAC,GAAG,EAAE;MACXsC,SAAS,EAAE,CACT;QACEC,KAAK,EAAEnC,sBAAsB,CAACK,OAAO,CAACwB,WAAW,CAAC;UAChDC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;UAClBC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC;MACH,CAAC;IAEL,CAAC;EACD,CACH,CAAC;AAEN,CAAC;AAACK,OAAA,CAAA1C,qBAAA,GAAAA,qBAAA;AAEF,MAAMgC,MAAM,GAAGW,uBAAU,CAACC,MAAM,CAAC;EAC/BX,qBAAqB,EAAE;IACrBY,eAAe,EAAE,WAAW;IAC5BC,YAAY,EAAE,EAAE;IAChBC,MAAM,EAAE,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/commonjs/components/StaticPin.js b/lib/commonjs/components/StaticPin.js deleted file mode 100644 index 14318a9..0000000 --- a/lib/commonjs/components/StaticPin.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.StaticPin = void 0; -var _react = _interopRequireDefault(require("react")); -var _reactNative = require("react-native"); -var _jsxRuntime = require("react/jsx-runtime"); -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } -const StaticPin = ({ - staticPinPosition, - staticPinIcon, - pinSize, - onParentMove, - onPress, - onLongPress, - setPinSize, - pinProps = {} -}) => { - const tapTime = _react.default.useRef(0); - const transform = [{ - translateY: -pinSize.height - }, { - translateX: -pinSize.width / 2 - }]; - const opacity = pinSize.width && pinSize.height ? 1 : 0; - const panResponder = _react.default.useRef(_reactNative.PanResponder.create({ - onStartShouldSetPanResponder: () => { - tapTime.current = Date.now(); - - // We want to handle tap on this so set true - return true; - }, - onPanResponderMove: (evt, gestureState) => { - // However if the user moves finger we want to pass this evt to parent - // to handle panning (tap not recognized) - if (Math.abs(gestureState.dx) > 5 && Math.abs(gestureState.dy) > 5) onParentMove(evt, gestureState); - }, - onPanResponderRelease: (evt, gestureState) => { - if (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) return; - const dt = Date.now() - tapTime.current; - if (onPress && dt < 500) { - onPress(evt); - } - if (onLongPress && dt > 500) { - // RN long press is 500ms - onLongPress(evt); - } - } - })).current; - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { - style: [{ - left: staticPinPosition.x, - top: staticPinPosition.y - }, styles.pinWrapper, { - opacity, - transform - }], - ...pinProps, - children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { - onLayout: ({ - nativeEvent: { - layout - } - }) => { - setPinSize(layout); - }, - ...panResponder.panHandlers, - children: staticPinIcon || - /*#__PURE__*/ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - (0, _jsxRuntime.jsx)(_reactNative.Image, { - source: require('../assets/pin.png'), - style: styles.pin - }) - }) - }); -}; -exports.StaticPin = StaticPin; -const styles = _reactNative.StyleSheet.create({ - pin: { - height: 64, - width: 48 - }, - pinWrapper: { - position: 'absolute' - } -}); -//# sourceMappingURL=StaticPin.js.map \ No newline at end of file diff --git a/lib/commonjs/components/StaticPin.js.map b/lib/commonjs/components/StaticPin.js.map deleted file mode 100644 index 95f9eda..0000000 --- a/lib/commonjs/components/StaticPin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","StaticPin","staticPinPosition","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","React","useRef","transform","translateY","height","translateX","width","opacity","panResponder","PanResponder","create","onStartShouldSetPanResponder","current","Date","now","onPanResponderMove","evt","gestureState","Math","abs","dx","dy","onPanResponderRelease","dt","jsx","Animated","View","style","left","x","top","y","styles","pinWrapper","children","onLayout","nativeEvent","layout","panHandlers","Image","source","pin","exports","StyleSheet","position"],"sourceRoot":"../../../src","sources":["components/StaticPin.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASsB,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAGf,MAAMG,SAAS,GAAGA,CAAC;EACxBC,iBAAiB;EACjBC,aAAa;EACbC,OAAO;EACPC,YAAY;EACZC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,QAAQ,GAAG,CAAC;AAcd,CAAC,KAAK;EACJ,MAAMC,OAAO,GAAGC,cAAK,CAACC,MAAM,CAAC,CAAC,CAAC;EAC/B,MAAMC,SAAS,GAAG,CAChB;IAAEC,UAAU,EAAE,CAACV,OAAO,CAACW;EAAO,CAAC,EAC/B;IAAEC,UAAU,EAAE,CAACZ,OAAO,CAACa,KAAK,GAAG;EAAE,CAAC,CACnC;EAED,MAAMC,OAAO,GAAGd,OAAO,CAACa,KAAK,IAAIb,OAAO,CAACW,MAAM,GAAG,CAAC,GAAG,CAAC;EAEvD,MAAMI,YAAY,GAAGR,cAAK,CAACC,MAAM,CAC/BQ,yBAAY,CAACC,MAAM,CAAC;IAClBC,4BAA4B,EAAEA,CAAA,KAAM;MAClCZ,OAAO,CAACa,OAAO,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;;MAE5B;MACA,OAAO,IAAI;IACb,CAAC;IACDC,kBAAkB,EAAEA,CAACC,GAAG,EAAEC,YAAY,KAAK;MACzC;MACA;MACA,IAAIC,IAAI,CAACC,GAAG,CAACF,YAAY,CAAC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N,WAAA,CAAAsC,GAAA,EAACvC,YAAA,CAAAsD,KAAK;QAACC,MAAM,EAAExD,OAAO,CAAC,mBAAmB,CAAE;QAAC2C,KAAK,EAAEK,MAAM,CAACS;MAAI,CAAE;IAClE,CACG;EAAC,CACM,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAApD,SAAA,GAAAA,SAAA;AAEF,MAAM0C,MAAM,GAAGW,uBAAU,CAACjC,MAAM,CAAC;EAC/B+B,GAAG,EAAE;IACHrC,MAAM,EAAE,EAAE;IACVE,KAAK,EAAE;EACT,CAAC;EACD2B,UAAU,EAAE;IACVW,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/commonjs/components/index.js b/lib/commonjs/components/index.js deleted file mode 100644 index 00f88b3..0000000 --- a/lib/commonjs/components/index.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "AnimatedTouchFeedback", { - enumerable: true, - get: function () { - return _AnimatedTouchFeedback.AnimatedTouchFeedback; - } -}); -var _AnimatedTouchFeedback = require("./AnimatedTouchFeedback"); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/components/index.js.map b/lib/commonjs/components/index.js.map deleted file mode 100644 index 2f76807..0000000 --- a/lib/commonjs/components/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_AnimatedTouchFeedback","require"],"sourceRoot":"../../../src","sources":["components/index.tsx"],"mappings":";;;;;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA","ignoreList":[]} diff --git a/lib/commonjs/debugHelper/index.js b/lib/commonjs/debugHelper/index.js deleted file mode 100644 index 75beac3..0000000 --- a/lib/commonjs/debugHelper/index.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.DebugTouchPoint = exports.DebugRect = void 0; -var _react = _interopRequireDefault(require("react")); -var _reactNative = require("react-native"); -var _jsxRuntime = require("react/jsx-runtime"); -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } -const DebugTouchPoint = ({ - diameter = 20, - x = 0, - y = 0, - color = 'yellow' -}) => { - const radius = diameter / 2; - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { - style: [styles.debugPoint, { - width: diameter, - height: diameter, - borderRadius: diameter, - backgroundColor: color, - left: x - radius, - top: y - radius - }], - pointerEvents: "none" - }); -}; -exports.DebugTouchPoint = DebugTouchPoint; -const DebugRect = ({ - height, - x = 0, - y = 0, - color = 'yellow' -}) => { - const width = 5; - return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { - style: [styles.debugRect, { - width, - height, - backgroundColor: color, - left: x - width / 2, - top: y - }], - pointerEvents: "none" - }); -}; -exports.DebugRect = DebugRect; -const styles = _reactNative.StyleSheet.create({ - debugPoint: { - opacity: 0.7, - position: 'absolute' - }, - debugRect: { - opacity: 0.5, - position: 'absolute' - } -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/debugHelper/index.js.map b/lib/commonjs/debugHelper/index.js.map deleted file mode 100644 index 8e47667..0000000 --- a/lib/commonjs/debugHelper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","DebugTouchPoint","diameter","x","y","color","radius","jsx","View","style","styles","debugPoint","width","height","borderRadius","backgroundColor","left","top","pointerEvents","exports","DebugRect","debugRect","StyleSheet","create","opacity","position"],"sourceRoot":"../../../src","sources":["debugHelper/index.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAgD,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF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,EAAE;IACTG,OAAO,EAAE,GAAG;IACZC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js deleted file mode 100644 index cdf9a30..0000000 --- a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.calcNewScaledOffsetForZoomCentering = calcNewScaledOffsetForZoomCentering; -/** - * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming. - * Parameters should correspond to whether we need the offset for the X or Y axis - * - * ## Terms Used: - * - * - Zoom Subject: the view that's being zoomed and panned - * - Zoom Center: the point whose relative position to the window is retained - * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes - * - Scaled: a measurement in pixels scaled to the "scale transformation" of the zoom subject to match with its true size. - * *For example:* - * If the scale on the zoom subject is 0.5, - * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px - * 8px is the scaled measurement - * - * ## Overall idea of this algorithm: - * - * When users perform zooming by pinching the screen, - * we need to shift the zoom subject so that the position of the zoom center is always the same. - * The offset amount to shift the layer is the returned value. - * - * - * ## How we achieve our goal: - * - * To retain, the zoom center position, whenever a zoom action is performed, - * we just need to make sure the distances from all the points in the zoom subject - * to the zoom center increases or decreases by the growth rate of the scale. - * - * ``` - * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale) - * ``` - * - * We can't calculate that for all the points because there are unlimited points on a plain. - * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center. - * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center. - * - * ``` - * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale) - * ``` - * - * Once we have `newDistanceZoomSubjectCenterToZoomCenter`, - * we can easily calculate the position of the new center, which leads us to the offset amount. - * Refer to the code for more details - * - * @param oldOffsetXOrYScaled - * @param zoomSubjectOriginalWidthOrHeight - * @param oldScale - * @param newScale - * @param zoomCenterXOrY - */ -function calcNewScaledOffsetForZoomCentering(oldOffsetXOrYScaled, zoomSubjectOriginalWidthOrHeight, oldScale, newScale, zoomCenterXOrY) { - const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale; - const growthRate = newScale / oldScale; - - // these act like namespaces just for the sake of readability - const zoomSubjectOriginalCenter = {}; - const zoomSubjectCurrentCenter = {}; - const zoomSubjectNewCenter = {}; - zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2; - zoomSubjectCurrentCenter.xOrY = zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled; - zoomSubjectCurrentCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY; - zoomSubjectNewCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate; - zoomSubjectNewCenter.xOrY = zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY; - const newOffsetUnscaled = zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY; - return newOffsetUnscaled / newScale; -} -//# sourceMappingURL=calcNewScaledOffsetForZoomCentering.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map deleted file mode 100644 index 0b6bb9c..0000000 --- a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["calcNewScaledOffsetForZoomCentering","oldOffsetXOrYScaled","zoomSubjectOriginalWidthOrHeight","oldScale","newScale","zoomCenterXOrY","oldOffSetUnscaled","growthRate","zoomSubjectOriginalCenter","zoomSubjectCurrentCenter","zoomSubjectNewCenter","xOrY","distanceToZoomCenter","newOffsetUnscaled"],"sourceRoot":"../../../src","sources":["helper/calcNewScaledOffsetForZoomCentering.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,mCAAmCA,CACjDC,mBAA2B,EAC3BC,gCAAwC,EACxCC,QAAgB,EAChBC,QAAgB,EAChBC,cAAsB,EACtB;EACA,MAAMC,iBAAiB,GAAGL,mBAAmB,GAAGE,QAAQ;EACxD,MAAMI,UAAU,GAAGH,QAAQ,GAAGD,QAAQ;;EAEtC;EACA,MAAMK,yBAAyB,GAAG,CAAC,CAAW;EAC9C,MAAMC,wBAAwB,GAAG,CAAC,CAAW;EAC7C,MAAMC,oBAAoB,GAAG,CAAC,CAAW;EAEzCF,yBAAyB,CAACG,IAAI,GAAGT,gCAAgC,GAAG,CAAC;EACrEO,wBAAwB,CAACE,IAAI,GAC3BH,yBAAyB,CAACG,IAAI,GAAGL,iBAAiB;EACpDG,wBAAwB,CAACG,oBAAoB,GAC3CH,wBAAwB,CAACE,IAAI,GAAGN,cAAc;EAEhDK,oBAAoB,CAACE,oBAAoB,GACvCH,wBAAwB,CAACG,oBAAoB,GAAGL,UAAU;EAC5DG,oBAAoB,CAACC,IAAI,GACvBD,oBAAoB,CAACE,oBAAoB,GAAGP,cAAc;EAE5D,MAAMQ,iBAAiB,GACrBH,oBAAoB,CAACC,IAAI,GAAGH,yBAAyB,CAACG,IAAI;EAE5D,OAAOE,iBAAiB,GAAGT,QAAQ;AACrC","ignoreList":[]} diff --git a/lib/commonjs/helper/coordinateConversion.js b/lib/commonjs/helper/coordinateConversion.js deleted file mode 100644 index c49c209..0000000 --- a/lib/commonjs/helper/coordinateConversion.js +++ /dev/null @@ -1,117 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.applyContainResizeMode = applyContainResizeMode; -exports.defaultTransformSubjectData = void 0; -exports.getImageOriginOnTransformSubject = getImageOriginOnTransformSubject; -exports.viewportPositionToImagePosition = viewportPositionToImagePosition; -const defaultTransformSubjectData = exports.defaultTransformSubjectData = { - offsetX: 0, - offsetY: 0, - zoomLevel: 0, - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0 -}; - -/** - * Assuming you have an image that's being resized to fit into a container - * using the "contain" resize mode. You can use this function to calculate the - * size of the image after fitting. - * - * Since our sheet is resized in this manner, we need this function - * for things like pan boundaries and marker placement - * - * @param imgSize - * @param containerSize - */ -function applyContainResizeMode(imgSize, containerSize) { - const { - width: imageWidth, - height: imageHeight - } = imgSize; - const { - width: areaWidth, - height: areaHeight - } = containerSize; - const imageAspect = imageWidth / imageHeight; - const areaAspect = areaWidth / areaHeight; - let newSize; - if (imageAspect >= areaAspect) { - // longest edge is horizontal - newSize = { - width: areaWidth, - height: areaWidth / imageAspect - }; - } else { - // longest edge is vertical - newSize = { - width: areaHeight * imageAspect, - height: areaHeight - }; - } - if (isNaN(newSize.height)) newSize.height = areaHeight; - if (isNaN(newSize.width)) newSize.width = areaWidth; - const scale = imageWidth ? newSize.width / imageWidth : newSize.height / imageHeight; - if (!isFinite(scale)) return { - size: null, - scale: null - }; - return { - size: newSize, - scale - }; -} - -/** - * get the coord of image's origin relative to the transformSubject - * @param resizedImageSize - * @param transformSubject - */ -function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { - const { - offsetX, - offsetY, - zoomLevel, - originalWidth, - originalHeight - } = transformSubject; - return { - x: offsetX * zoomLevel + originalWidth / 2 - resizedImageSize.width / 2 * zoomLevel, - y: offsetY * zoomLevel + originalHeight / 2 - resizedImageSize.height / 2 * zoomLevel - }; -} - -/** - * Translates the coord system of a point from the viewport's space to the image's space - * - * @param pointOnContainer - * @param sheetImageSize - * @param transformSubject - * - * @return {Vec2D} returns null if point is out of the sheet's bound - */ -function viewportPositionToImagePosition({ - viewportPosition, - imageSize, - zoomableEvent -}) { - const { - size: resizedImgSize, - scale: resizedImgScale - } = applyContainResizeMode(imageSize, { - width: zoomableEvent.originalWidth, - height: zoomableEvent.originalHeight - }); - if (resizedImgScale == null) return null; - const sheetOriginOnContainer = getImageOriginOnTransformSubject(resizedImgSize, zoomableEvent); - const pointOnSheet = { - x: (viewportPosition.x - sheetOriginOnContainer.x) / zoomableEvent.zoomLevel / resizedImgScale, - y: (viewportPosition.y - sheetOriginOnContainer.y) / zoomableEvent.zoomLevel / resizedImgScale - }; - return pointOnSheet; -} -//# sourceMappingURL=coordinateConversion.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/coordinateConversion.js.map b/lib/commonjs/helper/coordinateConversion.js.map deleted file mode 100644 index 88b61d9..0000000 --- a/lib/commonjs/helper/coordinateConversion.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["defaultTransformSubjectData","exports","offsetX","offsetY","zoomLevel","originalWidth","originalHeight","originalPageX","originalPageY","applyContainResizeMode","imgSize","containerSize","width","imageWidth","height","imageHeight","areaWidth","areaHeight","imageAspect","areaAspect","newSize","isNaN","scale","isFinite","size","getImageOriginOnTransformSubject","resizedImageSize","transformSubject","x","y","viewportPositionToImagePosition","viewportPosition","imageSize","zoomableEvent","resizedImgSize","resizedImgScale","sheetOriginOnContainer","pointOnSheet"],"sourceRoot":"../../../src","sources":["helper/coordinateConversion.ts"],"mappings":";;;;;;;;;AAEO,MAAMA,2BAA8C,GAAAC,OAAA,CAAAD,2BAAA,GAAG;EAC5DE,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,aAAa,EAAE,CAAC;EAChBC,cAAc,EAAE,CAAC;EACjBC,aAAa,EAAE,CAAC;EAChBC,aAAa,EAAE;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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C,GAClEqB,gBAAgB;EAClB,OAAO;IACLC,CAAC,EACC1B,OAAO,GAAGE,SAAS,GACnBC,aAAa,GAAG,CAAC,GAChBqB,gBAAgB,CAACd,KAAK,GAAG,CAAC,GAAIR,SAAS;IAC1CyB,CAAC,EACC1B,OAAO,GAAGC,SAAS,GACnBE,cAAc,GAAG,CAAC,GACjBoB,gBAAgB,CAACZ,MAAM,GAAG,CAAC,GAAIV;EACpC,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS0B,+BAA+BA,CAAC;EAC9CC,gBAAgB;EAChBC,SAAS;EACTC;AAKF,CAAC,EAAgB;EACf,MAAM;IAAET,IAAI,EAAEU,cAAc;IAAEZ,KAAK,EAAEa;EAAgB,CAAC,GACpD1B,sBAAsB,CAACuB,SAAS,EAAE;IAChCpB,KAAK,EAAEqB,aAAa,CAAC5B,aAAa;IAClCS,MAAM,EAAEmB,aAAa,CAAC3B;EACxB,CAAC,CAAC;EAEJ,IAAI6B,eAAe,IAAI,IAAI,EAAE,OAAO,IAAI;EAExC,MAAMC,sBAAsB,GAAGX,gCAAgC,CAC7DS,cAAc,EACdD,aACF,CAAC;EAED,MAAMI,YAAY,GAAG;IACnBT,CAAC,EACC,CAACG,gBAAgB,CAACH,CAAC,GAAGQ,sBAAsB,CAACR,CAAC,IAC9CK,aAAa,CAAC7B,SAAS,GACvB+B,eAAe;IACjBN,CAAC,EACC,CAACE,gBAAgB,CAACF,CAAC,GAAGO,sBAAsB,CAACP,CAAC,IAC9CI,aAAa,CAAC7B,SAAS,GACvB+B;EACJ,CAAC;EAED,OAAOE,YAAY;AACrB","ignoreList":[]} diff --git a/lib/commonjs/helper/index.js b/lib/commonjs/helper/index.js deleted file mode 100644 index 5d28b87..0000000 --- a/lib/commonjs/helper/index.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.calcGestureCenterPoint = calcGestureCenterPoint; -exports.calcGestureTouchDistance = calcGestureTouchDistance; -Object.defineProperty(exports, "calcNewScaledOffsetForZoomCentering", { - enumerable: true, - get: function () { - return _calcNewScaledOffsetForZoomCentering.calcNewScaledOffsetForZoomCentering; - } -}); -var _calcNewScaledOffsetForZoomCentering = require("./calcNewScaledOffsetForZoomCentering"); -/** - * Calculates the gesture center point relative to the page coordinate system - * - * We're unable to use touch.locationX/Y - * because locationX uses the axis system of the leaf element that the touch occurs on, - * which makes it even more complicated to translate into our container's axis system. - * - * We're also unable to use gestureState.moveX/Y - * because gestureState.moveX/Y is messed up on real device - * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches) - */ -function calcGestureCenterPoint(e, gestureState) { - const touches = e.nativeEvent.touches; - if (!touches[0]) return null; - if (gestureState.numberActiveTouches === 2) { - if (!touches[1]) return null; - return { - x: (touches[0].pageX + touches[1].pageX) / 2, - y: (touches[0].pageY + touches[1].pageY) / 2 - }; - } - if (gestureState.numberActiveTouches === 1) { - return { - x: touches[0].pageX, - y: touches[0].pageY - }; - } - return null; -} -function calcGestureTouchDistance(e, gestureState) { - const touches = e.nativeEvent.touches; - if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1]) return null; - const dx = Math.abs(touches[0].pageX - touches[1].pageX); - const dy = Math.abs(touches[0].pageY - touches[1].pageY); - return Math.sqrt(dx * dx + dy * dy); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/index.js.map b/lib/commonjs/helper/index.js.map deleted file mode 100644 index 53f40f3..0000000 --- a/lib/commonjs/helper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_calcNewScaledOffsetForZoomCentering","require","calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","sqrt"],"sourceRoot":"../../../src","sources":["helper/index.ts"],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,oCAAA,GAAAC,OAAA;AAEA;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AACV,OAAO,CAAC,CAAC,CAAC,CAACM,KAAK,GAAGN,OAAO,CAAC,CAAC,CAAC,CAACM,KAAK,CAAC;EACxD,OAAOG,IAAI,CAACG,IAAI,CAACJ,EAAE,GAAGA,EAAE,GAAGG,EAAE,GAAGA,EAAE,CAAC;AACrC","ignoreList":[]} diff --git a/lib/commonjs/hooks/useLatestCallback.js b/lib/commonjs/hooks/useLatestCallback.js deleted file mode 100644 index 331666a..0000000 --- a/lib/commonjs/hooks/useLatestCallback.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.useLatestCallback = void 0; -var _react = require("react"); -/** - * A hook that returns a stable callback reference that always calls the latest version of the function. - * This avoids the need to include the callback in dependency arrays while ensuring the latest version is called. - */ -const useLatestCallback = callback => { - const ref = (0, _react.useRef)(callback); - ref.current = callback; - return (0, _react.useRef)((...args) => ref.current(...args)).current; -}; -exports.useLatestCallback = useLatestCallback; -//# sourceMappingURL=useLatestCallback.js.map \ No newline at end of file diff --git a/lib/commonjs/hooks/useLatestCallback.js.map b/lib/commonjs/hooks/useLatestCallback.js.map deleted file mode 100644 index e24a2dc..0000000 --- a/lib/commonjs/hooks/useLatestCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_react","require","useLatestCallback","callback","ref","useRef","current","args","exports"],"sourceRoot":"../../../src","sources":["hooks/useLatestCallback.ts"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAC5BC,QAAmC,IAChC;EACH,MAAMC,GAAG,GAAG,IAAAC,aAAM,EAACF,QAAQ,CAAC;EAC5BC,GAAG,CAACE,OAAO,GAAGH,QAAQ;EAEtB,OAAO,IAAAE,aAAM,EAAkB,CAAC,GAAGE,IAAI,KAAKH,GAAG,CAACE,OAAO,CAAC,GAAGC,IAAI,CAAC,CAAC,CAACD,OAAO;AAC3E,CAAC;AAACE,OAAA,CAAAN,iBAAA,GAAAA,iBAAA","ignoreList":[]} diff --git a/lib/commonjs/index.js b/lib/commonjs/index.js deleted file mode 100644 index 39cbcac..0000000 --- a/lib/commonjs/index.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -Object.defineProperty(exports, "ReactNativeZoomableView", { - enumerable: true, - get: function () { - return _ReactNativeZoomableView.default; - } -}); -Object.defineProperty(exports, "applyContainResizeMode", { - enumerable: true, - get: function () { - return _coordinateConversion.applyContainResizeMode; - } -}); -Object.defineProperty(exports, "getImageOriginOnTransformSubject", { - enumerable: true, - get: function () { - return _coordinateConversion.getImageOriginOnTransformSubject; - } -}); -Object.defineProperty(exports, "viewportPositionToImagePosition", { - enumerable: true, - get: function () { - return _coordinateConversion.viewportPositionToImagePosition; - } -}); -var _coordinateConversion = require("./helper/coordinateConversion"); -var _ReactNativeZoomableView = _interopRequireDefault(require("./ReactNativeZoomableView")); -function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/index.js.map b/lib/commonjs/index.js.map deleted file mode 100644 index 631e513..0000000 --- a/lib/commonjs/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["_coordinateConversion","require","_ReactNativeZoomableView","_interopRequireDefault","e","__esModule","default"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,qBAAA,GAAAC,OAAA;AAKA,IAAAC,wBAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAgE,SAAAE,uBAAAC,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]} diff --git a/lib/commonjs/package.json b/lib/commonjs/package.json deleted file mode 100644 index 729ac4d..0000000 --- a/lib/commonjs/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"commonjs"} diff --git a/lib/commonjs/typings/index.js b/lib/commonjs/typings/index.js deleted file mode 100644 index 4907bab..0000000 --- a/lib/commonjs/typings/index.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.SwipeDirection = void 0; -let SwipeDirection = exports.SwipeDirection = /*#__PURE__*/function (SwipeDirection) { - SwipeDirection["SWIPE_UP"] = "SWIPE_UP"; - SwipeDirection["SWIPE_DOWN"] = "SWIPE_DOWN"; - SwipeDirection["SWIPE_LEFT"] = "SWIPE_LEFT"; - SwipeDirection["SWIPE_RIGHT"] = "SWIPE_RIGHT"; - return SwipeDirection; -}({}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/commonjs/typings/index.js.map b/lib/commonjs/typings/index.js.map deleted file mode 100644 index 1b6eb0d..0000000 --- a/lib/commonjs/typings/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["SwipeDirection","exports"],"sourceRoot":"../../../src","sources":["typings/index.ts"],"mappings":";;;;;;IASYA,cAAc,GAAAC,OAAA,CAAAD,cAAA,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]} diff --git a/lib/module/ReactNativeZoomableView.js b/lib/module/ReactNativeZoomableView.js deleted file mode 100644 index 2f6c9e6..0000000 --- a/lib/module/ReactNativeZoomableView.js +++ /dev/null @@ -1,924 +0,0 @@ -"use strict"; - -import { debounce, defaults } from 'lodash'; -import React, { useEffect, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from 'react'; -import { Animated, PanResponder, StyleSheet, View } from 'react-native'; -import { getZoomToAnimation } from './animations'; -import { AnimatedTouchFeedback } from './components'; -import { StaticPin } from './components/StaticPin'; -import { DebugTouchPoint } from './debugHelper'; -import { calcGestureCenterPoint, calcGestureTouchDistance, calcNewScaledOffsetForZoomCentering } from './helper'; -import { viewportPositionToImagePosition } from './helper/coordinateConversion'; -import { useLatestCallback } from './hooks/useLatestCallback'; -import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; -const ReactNativeZoomableView = (props, ref) => { - const [originalWidth, setOriginalWidth] = useState(0); - const [originalHeight, setOriginalHeight] = useState(0); - const [originalPageX, setOriginalPageX] = useState(0); - const [originalPageY, setOriginalPageY] = useState(0); - const [originalX, setOriginalX] = useState(0); - const [originalY, setOriginalY] = useState(0); - const [pinSize, setPinSize] = useState({ - width: 0, - height: 0 - }); - const [debugPoints, setDebugPoints] = useState([]); - const [stateTouches, setStateTouches] = useState([]); - const zoomSubjectWrapperRef = useRef(null); - const gestureHandlers = useRef(); - const doubleTapFirstTapReleaseTimestamp = useRef(); - props = defaults({}, props, { - zoomEnabled: true, - panEnabled: true, - initialZoom: 1, - initialOffsetX: 0, - initialOffsetY: 0, - maxZoom: 1.5, - minZoom: 0.5, - pinchToZoomInSensitivity: 1, - pinchToZoomOutSensitivity: 1, - movementSensibility: 1, - doubleTapDelay: 300, - zoomStep: 0.5, - onLongPress: undefined, - longPressDuration: 700, - contentWidth: undefined, - contentHeight: undefined, - visualTouchFeedbackEnabled: true, - staticPinPosition: undefined, - staticPinIcon: undefined, - onStaticPinPositionChange: undefined, - onStaticPinPositionMove: undefined, - disablePanOnInitialZoom: false - }); - const panAnim = useRef(new Animated.ValueXY({ - x: 0, - y: 0 - })); - const zoomAnim = useRef(new Animated.Value(1)); - const offsetX = useRef(0); - const offsetY = useRef(0); - const zoomLevel = useRef(1); - const lastGestureCenterPosition = useRef(null); - const lastGestureTouchDistance = useRef(150); - const gestureType = useRef(); - const gestureStarted = useRef(false); - - /** - * Last press time (used to evaluate whether user double tapped) - */ - const longPressTimeout = useRef(); - const onTransformInvocationInitialized = useRef(); - const singleTapTimeoutId = useRef(); - const touches = useRef([]); - const doubleTapFirstTap = useRef(); - const measureZoomSubjectInterval = useRef(); - useLayoutEffect(() => { - gestureHandlers.current = PanResponder.create({ - onStartShouldSetPanResponder: _handleStartShouldSetPanResponder, - onPanResponderGrant: _handlePanResponderGrant, - onPanResponderMove: _handlePanResponderMove, - onPanResponderRelease: _handlePanResponderEnd, - onPanResponderTerminate: (evt, gestureState) => { - // We should also call _handlePanResponderEnd - // to properly perform cleanups when the gesture is terminated - // (aka gesture handling responsibility is taken over by another component). - // This also fixes a weird issue where - // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, - // but onPanResponderTerminate is called instead for no apparent reason. - _handlePanResponderEnd(evt, gestureState); - props.onPanResponderTerminate?.(evt, gestureState, _getZoomableViewEventObject()); - }, - onPanResponderTerminationRequest: (evt, gestureState) => !!props.onPanResponderTerminationRequest?.(evt, gestureState, _getZoomableViewEventObject()), - // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => props.onShouldBlockNativeResponder?.(evt, gestureState, _getZoomableViewEventObject()) ?? true, - onStartShouldSetPanResponderCapture: (evt, gestureState) => !!props.onStartShouldSetPanResponderCapture?.(evt, gestureState), - onMoveShouldSetPanResponderCapture: (evt, gestureState) => !!props.onMoveShouldSetPanResponderCapture?.(evt, gestureState) - }); - if (props.zoomAnimatedValue) zoomAnim.current = props.zoomAnimatedValue; - if (props.panAnimatedValueXY) panAnim.current = props.panAnimatedValueXY; - if (props.initialZoom) zoomLevel.current = props.initialZoom; - if (props.initialOffsetX != null) offsetX.current = props.initialOffsetX; - if (props.initialOffsetY != null) offsetY.current = props.initialOffsetY; - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - zoomAnim.current.setValue(zoomLevel.current); - panAnim.current.addListener(({ - x, - y - }) => { - offsetX.current = x; - offsetY.current = y; - }); - zoomAnim.current.addListener(({ - value - }) => { - zoomLevel.current = value; - }); - }, []); - const { - zoomEnabled - } = props; - const initialZoom = useRef(props.initialZoom); - initialZoom.current = props.initialZoom; - useLayoutEffect(() => { - if (!zoomEnabled && initialZoom.current) { - zoomLevel.current = initialZoom.current; - zoomAnim.current.setValue(zoomLevel.current); - } - }, [zoomEnabled]); - useLayoutEffect(() => { - if (!onTransformInvocationInitialized.current && _invokeOnTransform().successful) { - panAnim.current.addListener(() => _invokeOnTransform()); - zoomAnim.current.addListener(() => _invokeOnTransform()); - onTransformInvocationInitialized.current = true; - } - }, - // FIXME: deps has implicit coupling with internal _invokeOnTransform logic - [originalWidth, originalHeight]); - const onLayout = useRef(props.onLayout); - onLayout.current = props.onLayout; - - // Handle original measurements changed - useLayoutEffect(() => { - // We use a custom `onLayout` event, so the clients can stay in-sync - // with when the internal measurements are actually saved to the state, - // thus helping them apply transformations at more accurate timings - const layout = { - width: originalWidth, - height: originalHeight, - x: originalX, - y: originalY - }; - onLayout.current?.({ - nativeEvent: { - layout - } - }); - if (onTransformInvocationInitialized.current) _invokeOnTransform(); - }, [originalHeight, originalWidth, originalPageX, originalPageY, originalX, originalY]); - - // Handle staticPinPosition changed - useLayoutEffect(() => { - if (onTransformInvocationInitialized.current) _invokeOnTransform(); - }, [props.staticPinPosition?.x, props.staticPinPosition?.y]); - useEffect(() => { - measureZoomSubject(); - // We've already run `grabZoomSubjectOriginalMeasurements` at various events - // to make sure the measurements are promptly updated. - // However, there might be cases we haven't accounted for, especially when - // native processes are involved. To account for those cases, - // we'll use an interval here to ensure we're always up-to-date. - // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender - // if the values given haven't changed, so we're not running performance risk here. - measureZoomSubjectInterval.current = setInterval(measureZoomSubject, 1e3); - return () => { - measureZoomSubjectInterval.current && clearInterval(measureZoomSubjectInterval.current); - }; - }, []); - const onStaticPinPositionChange = useLatestCallback(props.onStaticPinPositionChange || (() => undefined)); - const debouncedOnStaticPinPositionChange = useMemo(() => debounce(onStaticPinPositionChange, 100), []); - - /** - * try to invoke onTransform - * @private - */ - const _invokeOnTransform = useLatestCallback(() => { - const zoomableViewEvent = _getZoomableViewEventObject(); - const position = _staticPinPosition(); - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { - successful: false - }; - props.onTransform?.(zoomableViewEvent); - if (position) { - props.onStaticPinPositionMove?.(position); - debouncedOnStaticPinPositionChange(position); - } - return { - successful: true - }; - }); - - /** - * Returns additional information about components current state for external event hooks - * - * @returns {{}} - * @private - */ - const _getZoomableViewEventObject = useLatestCallback((overwriteObj = {}) => { - return { - zoomLevel: zoomLevel.current, - offsetX: offsetX.current, - offsetY: offsetY.current, - originalHeight, - originalWidth, - originalPageX, - originalPageY, - ...overwriteObj - }; - }); - - /** - * Get the original box dimensions and save them for later use. - * (They will be used to calculate boxBorders) - * - * @private - */ - const measureZoomSubject = useLatestCallback(() => { - // make sure we measure after animations are complete - requestAnimationFrame(() => { - // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` - // when navigating back (react-navigation stack) from another view - // while closing the keyboard at the same time - setTimeout(() => { - // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper. - // However, our zoomSubject may have been transformed by an initial zoomLevel or offset, - // in which case these measurements will not represent the true "original" measurements. - // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject - // (no border, space, or anything between them) - zoomSubjectWrapperRef.current?.measure((x, y, width, height, pageX, pageY) => { - // When the component is off-screen, these become all 0s, so we don't set them - // to avoid messing up calculations, especially ones that are done right after - // the component transitions from hidden to visible. - if (!pageX && !pageY && !width && !height) return; - setOriginalX(x); - setOriginalY(y); - setOriginalWidth(width); - setOriginalHeight(height); - setOriginalPageX(pageX); - setOriginalPageY(pageY); - }); - }); - }); - }); - - /** - * Handles the start of touch events and checks for taps - * - * @param e - * @param gestureState - * @returns {boolean} - * - * @private - */ - const _handleStartShouldSetPanResponder = useLatestCallback((e, gestureState) => { - if (props.onStartShouldSetPanResponder) { - props.onStartShouldSetPanResponder(e, gestureState, _getZoomableViewEventObject(), false); - } - - // Always set pan responder on start - // of gesture so we can handle tap. - // "Pan threshold validation" will be handled - // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder` - return true; - }); - - /** - * Calculates pinch distance - * - * @param e - * @param gestureState - * @private - */ - const _handlePanResponderGrant = useLatestCallback((e, gestureState) => { - if (props.onLongPress) { - e.persist(); - longPressTimeout.current = setTimeout(() => { - props.onLongPress?.(e, gestureState, _getZoomableViewEventObject()); - longPressTimeout.current = undefined; - }, props.longPressDuration); - } - props.onPanResponderGrant?.(e, gestureState, _getZoomableViewEventObject()); - panAnim.current.stopAnimation(); - zoomAnim.current.stopAnimation(); - gestureStarted.current = true; - }); - - /** - * Handles the end of touch events - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePanResponderEnd = useLatestCallback((e, gestureState) => { - if (!gestureType.current) { - _resolveAndHandleTap(e); - } - setDebugPoints([]); - lastGestureCenterPosition.current = null; - if (longPressTimeout.current) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - props.onPanResponderEnd?.(e, gestureState, _getZoomableViewEventObject()); - if (gestureType.current === 'pinch') { - props.onZoomEnd?.(e, gestureState, _getZoomableViewEventObject()); - } else if (gestureType.current === 'shift') { - props.onShiftingEnd?.(e, gestureState, _getZoomableViewEventObject()); - } - if (props.staticPinPosition) { - _updateStaticPin(); - } - gestureType.current = undefined; - gestureStarted.current = false; - }); - - /** - * Handles the actual movement of our pan responder - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePanResponderMove = useLatestCallback((e, gestureState) => { - if (props.onPanResponderMove) { - if (props.onPanResponderMove(e, gestureState, _getZoomableViewEventObject())) { - return false; - } - } - - // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - if (gestureState.numberActiveTouches <= 2) { - if (!gestureStarted.current) { - _handlePanResponderGrant(e, gestureState); - } - } else { - if (gestureStarted.current) { - _handlePanResponderEnd(e, gestureState); - } - return true; - } - if (gestureState.numberActiveTouches === 2) { - if (longPressTimeout.current) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - - // change some measurement states when switching gesture to ensure a smooth transition - if (gestureType.current !== 'pinch') { - lastGestureCenterPosition.current = calcGestureCenterPoint(e, gestureState); - lastGestureTouchDistance.current = calcGestureTouchDistance(e, gestureState); - } - gestureType.current = 'pinch'; - _handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if (longPressTimeout.current && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - // change some measurement states when switching gesture to ensure a smooth transition - if (gestureType.current !== 'shift') { - lastGestureCenterPosition.current = calcGestureCenterPoint(e, gestureState); - } - const { - dx, - dy - } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - if (isShiftGesture) { - gestureType.current = 'shift'; - _handleShifting(gestureState); - } - } - }); - - /** - * Handles the pinch movement and zooming - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePinching = useLatestCallback((e, gestureState) => { - if (!props.zoomEnabled) return; - const { - maxZoom, - minZoom, - pinchToZoomInSensitivity, - pinchToZoomOutSensitivity - } = props; - const distance = calcGestureTouchDistance(e, gestureState); - if (props.onZoomBefore && props.onZoomBefore(e, gestureState, _getZoomableViewEventObject())) { - return; - } - if (!distance) return; - if (!lastGestureTouchDistance.current) return; - - // define the new zoom level and take zoom level sensitivity into consideration - const zoomGrowthFromLastGestureState = distance / lastGestureTouchDistance.current; - lastGestureTouchDistance.current = distance; - const pinchToZoomSensitivity = zoomGrowthFromLastGestureState < 1 ? pinchToZoomOutSensitivity : pinchToZoomInSensitivity; - if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; - // 0 - no resistance - // 10 - 90% resistance - const deltaGrowthAdjustedBySensitivity = deltaGrowth * (1 - pinchToZoomSensitivity * 9 / 100); - let newZoomLevel = zoomLevel.current * (1 + deltaGrowthAdjustedBySensitivity); - - // make sure max and min zoom levels are respected - if (maxZoom != null && newZoomLevel > maxZoom) { - newZoomLevel = maxZoom; - } - if (minZoom != null && newZoomLevel < minZoom) { - newZoomLevel = minZoom; - } - const gestureCenterPoint = calcGestureCenterPoint(e, gestureState); - if (!gestureCenterPoint) return; - let zoomCenter = { - x: gestureCenterPoint.x - originalPageX, - y: gestureCenterPoint.y - originalPageY - }; - if (props.staticPinPosition) { - // When we use a static pin position, the zoom centre is the same as that position, - // otherwise the pin moves around way too much while zooming. - zoomCenter = { - x: props.staticPinPosition.x, - y: props.staticPinPosition.y - }; - } - - // Uncomment to debug - props.debug && _setPinchDebugPoints(e, zoomCenter); - const oldOffsetX = offsetX.current; - const oldOffsetY = offsetY.current; - const oldScale = zoomLevel.current; - const newScale = newZoomLevel; - if (!originalHeight || !originalWidth) return; - let newOffsetY = calcNewScaledOffsetForZoomCentering(oldOffsetY, originalHeight, oldScale, newScale, zoomCenter.y); - let newOffsetX = calcNewScaledOffsetForZoomCentering(oldOffsetX, originalWidth, oldScale, newScale, zoomCenter.x); - const offsetShift = _calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - if (offsetShift) { - newOffsetX += offsetShift.x; - newOffsetY += offsetShift.y; - } - offsetX.current = newOffsetX; - offsetY.current = newOffsetY; - zoomLevel.current = newScale; - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - zoomAnim.current.setValue(zoomLevel.current); - props.onZoomAfter?.(e, gestureState, _getZoomableViewEventObject()); - }); - - /** - * Used to debug pinch events - * @param gestureResponderEvent - * @param zoomCenter - * @param points - */ - const _setPinchDebugPoints = useLatestCallback((gestureResponderEvent, zoomCenter, ...points) => { - const { - touches - } = gestureResponderEvent.nativeEvent; - setDebugPoints([{ - x: touches[0].pageX - originalPageX, - y: touches[0].pageY - originalPageY - }, { - x: touches[1].pageX - originalPageX, - y: touches[1].pageY - originalPageY - }, zoomCenter, ...points]); - }); - - /** - * Calculates the amount the offset should shift since the last position during panning - * - * @param {Vec2D} gestureCenterPoint - * - * @private - */ - const _calcOffsetShiftSinceLastGestureState = useLatestCallback(gestureCenterPoint => { - const { - movementSensibility - } = props; - let shift = null; - if (lastGestureCenterPosition.current && movementSensibility) { - const dx = gestureCenterPoint.x - lastGestureCenterPosition.current.x; - const dy = gestureCenterPoint.y - lastGestureCenterPosition.current.y; - const shiftX = dx / zoomLevel.current / movementSensibility; - const shiftY = dy / zoomLevel.current / movementSensibility; - shift = { - x: shiftX, - y: shiftY - }; - } - lastGestureCenterPosition.current = gestureCenterPoint; - return shift; - }); - - /** - * Handles movement by tap and move - * - * @param gestureState - * - * @private - */ - const _handleShifting = useLatestCallback(gestureState => { - // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level - if (!props.panEnabled || props.disablePanOnInitialZoom && zoomLevel.current === props.initialZoom) { - return; - } - const shift = _calcOffsetShiftSinceLastGestureState({ - x: gestureState.moveX, - y: gestureState.moveY - }); - if (!shift) return; - const newOffsetX = offsetX.current + shift.x; - const newOffsetY = offsetY.current + shift.y; - if (props.debug && originalPageX && originalPageY) { - const x = gestureState.moveX - originalPageX; - const y = gestureState.moveY - originalPageY; - setDebugPoints([{ - x, - y - }]); - } - _setNewOffsetPosition(newOffsetX, newOffsetY); - }); - - /** - * Set the state to offset moved - * - * @param {number} newOffsetX - * @param {number} newOffsetY - * @returns - */ - const _setNewOffsetPosition = useLatestCallback((newOffsetX, newOffsetY) => { - const { - onShiftingBefore, - onShiftingAfter - } = props; - if (onShiftingBefore?.(null, null, _getZoomableViewEventObject())) { - return; - } - offsetX.current = newOffsetX; - offsetY.current = newOffsetY; - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - zoomAnim.current.setValue(zoomLevel.current); - onShiftingAfter?.(null, null, _getZoomableViewEventObject()); - }); - - /** - * Check whether the press event is double tap - * or single tap and handle the event accordingly - * - * @param e - * - * @private - */ - const _resolveAndHandleTap = useLatestCallback(e => { - const now = Date.now(); - if (doubleTapFirstTapReleaseTimestamp.current && props.doubleTapDelay && now - doubleTapFirstTapReleaseTimestamp.current < props.doubleTapDelay) { - doubleTapFirstTap.current && _addTouch({ - ...doubleTapFirstTap.current, - id: now.toString(), - isSecondTap: true - }); - singleTapTimeoutId.current && clearTimeout(singleTapTimeoutId.current); - delete doubleTapFirstTapReleaseTimestamp.current; - delete singleTapTimeoutId.current; - delete doubleTapFirstTap.current; - _handleDoubleTap(e); - } else { - doubleTapFirstTapReleaseTimestamp.current = now; - doubleTapFirstTap.current = { - id: now.toString(), - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY - }; - _addTouch(doubleTapFirstTap.current); - - // persist event so e.nativeEvent is preserved after a timeout delay - e.persist(); - singleTapTimeoutId.current = setTimeout(() => { - delete doubleTapFirstTapReleaseTimestamp.current; - delete singleTapTimeoutId.current; - - // Pan to the tapped location - if (props.staticPinPosition && doubleTapFirstTap.current) { - const tapX = props.staticPinPosition.x - doubleTapFirstTap.current.x; - const tapY = props.staticPinPosition.y - doubleTapFirstTap.current.y; - Animated.timing(panAnim.current, { - toValue: { - x: offsetX.current + tapX / zoomLevel.current, - y: offsetY.current + tapY / zoomLevel.current - }, - useNativeDriver: true, - duration: 200 - }).start(() => { - _updateStaticPin(); - }); - } - props.onSingleTap?.(e, _getZoomableViewEventObject()); - }, props.doubleTapDelay); - } - }); - const publicMoveStaticPinTo = useLatestCallback((position, duration) => { - const { - staticPinPosition, - contentWidth, - contentHeight - } = props; - if (!staticPinPosition) return; - if (!originalWidth || !originalHeight) return; - if (!contentWidth || !contentHeight) return; - - // Offset for the static pin - const pinX = staticPinPosition.x - originalWidth / 2; - const pinY = staticPinPosition.y - originalHeight / 2; - offsetX.current = contentWidth / 2 - position.x + pinX / zoomLevel.current; - offsetY.current = contentHeight / 2 - position.y + pinY / zoomLevel.current; - if (duration) { - Animated.timing(panAnim.current, { - toValue: { - x: offsetX.current, - y: offsetY.current - }, - useNativeDriver: true, - duration - }).start(); - } else { - panAnim.current.setValue({ - x: offsetX.current, - y: offsetY.current - }); - } - }); - const _staticPinPosition = useLatestCallback(() => { - if (!props.staticPinPosition) return; - if (!props.contentWidth || !props.contentHeight) return; - return viewportPositionToImagePosition({ - viewportPosition: { - x: props.staticPinPosition.x, - y: props.staticPinPosition.y - }, - imageSize: { - height: props.contentHeight, - width: props.contentWidth - }, - zoomableEvent: { - ..._getZoomableViewEventObject(), - offsetX: offsetX.current, - offsetY: offsetY.current, - zoomLevel: zoomLevel.current - } - }); - }); - const _updateStaticPin = useLatestCallback(() => { - const position = _staticPinPosition(); - if (!position) return; - props.onStaticPinPositionChange?.(position); - }); - const _addTouch = useLatestCallback(touch => { - touches.current.push(touch); - setStateTouches([...touches.current]); - }); - const _removeTouch = useLatestCallback(touch => { - touches.current.splice(touches.current.indexOf(touch), 1); - setStateTouches([...touches.current]); - }); - - /** - * Handles the double tap event - * - * @param e - * - * @private - */ - const _handleDoubleTap = useLatestCallback(e => { - const { - onDoubleTapBefore, - onDoubleTapAfter, - doubleTapZoomToCenter - } = props; - onDoubleTapBefore?.(e, _getZoomableViewEventObject()); - const nextZoomStep = _getNextZoomStep(); - if (nextZoomStep == null) return; - - // define new zoom position coordinates - const zoomPositionCoordinates = { - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY - }; - - // if doubleTapZoomToCenter enabled -> always zoom to center instead - if (doubleTapZoomToCenter) { - zoomPositionCoordinates.x = 0; - zoomPositionCoordinates.y = 0; - } - publicZoomTo(nextZoomStep, zoomPositionCoordinates); - onDoubleTapAfter?.(e, _getZoomableViewEventObject({ - zoomLevel: nextZoomStep - })); - }); - - /** - * Returns the next zoom step based on current step and zoomStep property. - * If we are zoomed all the way in -> return to initialzoom - * - * @returns {*} - */ - const _getNextZoomStep = useLatestCallback(() => { - const { - zoomStep, - maxZoom, - initialZoom - } = props; - if (maxZoom == null) return; - if (zoomLevel.current.toFixed(2) === maxZoom.toFixed(2)) { - return initialZoom; - } - if (zoomStep == null) return; - const nextZoomStep = zoomLevel.current * (1 + zoomStep); - if (nextZoomStep > maxZoom) { - return maxZoom; - } - return nextZoomStep; - }); - - /** - * Zooms to a specific level. A "zoom center" can be provided, which specifies - * the point that will remain in the same position on the screen after the zoom. - * The coordinates of the zoom center is relative to the zoom subject. - * { x: 0, y: 0 } is the very center of the zoom subject. - * - * @param newZoomLevel - * @param zoomCenter - If not supplied, the container's center is the zoom center - */ - const publicZoomTo = useLatestCallback((newZoomLevel, zoomCenter) => { - if (!props.zoomEnabled) return false; - if (props.maxZoom && newZoomLevel > props.maxZoom) return false; - if (props.minZoom && newZoomLevel < props.minZoom) return false; - props.onZoomBefore?.(null, null, _getZoomableViewEventObject()); - - // == Perform Pan Animation to preserve the zoom center while zooming == - let listenerId = ''; - if (zoomCenter) { - // Calculates panAnim values based on changes in zoomAnim. - let prevScale = zoomLevel.current; - // Since zoomAnim is calculated in native driver, - // it will jitter panAnim once in a while, - // because here panAnim is being calculated in js. - // However the jittering should mostly occur in simulator. - listenerId = zoomAnim.current.addListener(({ - value: newScale - }) => { - panAnim.current.setValue({ - x: calcNewScaledOffsetForZoomCentering(offsetX.current, originalWidth, prevScale, newScale, zoomCenter.x), - y: calcNewScaledOffsetForZoomCentering(offsetY.current, originalHeight, prevScale, newScale, zoomCenter.y) - }); - prevScale = newScale; - }); - } - - // == Perform Zoom Animation == - getZoomToAnimation(zoomAnim.current, newZoomLevel).start(() => { - zoomAnim.current.removeListener(listenerId); - }); - // == Zoom Animation Ends == - - props.onZoomAfter?.(null, null, _getZoomableViewEventObject()); - return true; - }); - - /** - * Zooms in or out by a specified change level - * Use a positive number for `zoomLevelChange` to zoom in - * Use a negative number for `zoomLevelChange` to zoom out - * - * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. - * - * @param {number | null} zoomLevelChange - * - * @return {bool} - */ - const publicZoomBy = useLatestCallback(zoomLevelChange => { - // if no zoom level Change given -> just use zoom step - zoomLevelChange ||= props.zoomStep || 0; - return publicZoomTo(zoomLevel.current + zoomLevelChange); - }); - - /** - * Moves the zoomed view to a specified position - * Returns a promise when finished - * - * @param {number} newOffsetX the new position we want to move it to (x-axis) - * @param {number} newOffsetY the new position we want to move it to (y-axis) - * - * @return {bool} - */ - const publicMoveTo = useLatestCallback((newOffsetX, newOffsetY) => { - if (!originalWidth || !originalHeight) return; - const offsetX = (newOffsetX - originalWidth / 2) / zoomLevel.current; - const offsetY = (newOffsetY - originalHeight / 2) / zoomLevel.current; - _setNewOffsetPosition(-offsetX, -offsetY); - }); - - /** - * Moves the zoomed view by a certain amount. - * - * Returns a promise when finished - * - * @param {number} offsetChangeX the amount we want to move the offset by (x-axis) - * @param {number} offsetChangeY the amount we want to move the offset by (y-axis) - * - * @return {bool} - */ - const publicMoveBy = useLatestCallback((offsetChangeX, offsetChangeY) => { - const newOffsetX = (offsetX.current * zoomLevel.current - offsetChangeX) / zoomLevel.current; - const newOffsetY = (offsetY.current * zoomLevel.current - offsetChangeY) / zoomLevel.current; - _setNewOffsetPosition(newOffsetX, newOffsetY); - }); - useImperativeHandle(ref, () => ({ - zoomTo: publicZoomTo, - zoomBy: publicZoomBy, - moveTo: publicMoveTo, - moveBy: publicMoveBy, - moveStaticPinTo: publicMoveStaticPinTo, - get gestureStarted() { - return gestureStarted.current; - } - })); - const { - staticPinIcon, - children, - visualTouchFeedbackEnabled, - doubleTapDelay, - staticPinPosition, - onStaticPinLongPress, - onStaticPinPress, - pinProps - } = props; - return /*#__PURE__*/_jsxs(View, { - style: styles.container, - ...gestureHandlers.current?.panHandlers, - ref: zoomSubjectWrapperRef, - onLayout: measureZoomSubject, - children: [/*#__PURE__*/_jsx(Animated.View, { - style: [styles.zoomSubject, props.style, { - transform: [ - // In RN79, we need to split the scale into X and Y to avoid - // the content getting pixelated when zooming in - { - scaleX: zoomAnim.current - }, { - scaleY: zoomAnim.current - }, ...panAnim.current.getTranslateTransform()] - }], - children: children - }), visualTouchFeedbackEnabled && stateTouches.map(touch => doubleTapDelay && /*#__PURE__*/_jsx(AnimatedTouchFeedback, { - x: touch.x, - y: touch.y, - animationDuration: doubleTapDelay, - onAnimationDone: () => { - _removeTouch(touch); - } - }, touch.id)), debugPoints.map(({ - x, - y - }, index) => { - return /*#__PURE__*/_jsx(DebugTouchPoint, { - x: x, - y: y - }, index); - }), staticPinPosition && /*#__PURE__*/_jsx(StaticPin, { - staticPinIcon: staticPinIcon, - staticPinPosition: staticPinPosition, - pinSize: pinSize, - onPress: onStaticPinPress, - onLongPress: onStaticPinLongPress, - onParentMove: _handlePanResponderMove, - setPinSize: setPinSize, - pinProps: pinProps - })] - }); -}; -const styles = StyleSheet.create({ - container: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - overflow: 'hidden', - position: 'relative' - }, - zoomSubject: { - alignItems: 'center', - flex: 1, - justifyContent: 'center', - width: '100%' - } -}); -export default ReactNativeZoomableView; -export { ReactNativeZoomableView }; -//# sourceMappingURL=ReactNativeZoomableView.js.map \ No newline at end of file diff --git a/lib/module/ReactNativeZoomableView.js.map b/lib/module/ReactNativeZoomableView.js.map deleted file mode 100644 index 4c655bd..0000000 --- a/lib/module/ReactNativeZoomableView.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["debounce","defaults","React","useEffect","useImperativeHandle","useLayoutEffect","useMemo","useRef","useState","Animated","PanResponder","StyleSheet","View","getZoomToAnimation","AnimatedTouchFeedback","StaticPin","DebugTouchPoint","calcGestureCenterPoint","calcGestureTouchDistance","calcNewScaledOffsetForZoomCentering","viewportPositionToImagePosition","useLatestCallback","jsx","_jsx","jsxs","_jsxs","ReactNativeZoomableView","props","ref","originalWidth","setOriginalWidth","originalHeight","setOriginalHeight","originalPageX","setOriginalPageX","originalPageY","setOriginalPageY","originalX","setOriginalX","originalY","setOriginalY","pinSize","setPinSize","width","height","debugPoints","setDebugPoints","stateTouches","setStateTouches","zoomSubjectWrapperRef","gestureHandlers","doubleTapFirstTapReleaseTimestamp","zoomEnabled","panEnabled","initialZoom","initialOffsetX","initialOffsetY","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","movementSensibility","doubleTapDelay","zoomStep","onLongPress","undefined","longPressDuration","contentWidth","contentHeight","visualTouchFeedbackEnabled","staticPinPosition","staticPinIcon","onStaticPinPositionChange","onStaticPinPositionMove","disablePanOnInitialZoom","panAnim","ValueXY","x","y","zoomAnim","Value","offsetX","offsetY","zoomLevel","lastGestureCenterPosition","lastGestureTouchDistance","gestureType","gestureStarted","longPressTimeout","onTransformInvocationInitialized","singleTapTimeoutId","touches","doubleTapFirstTap","measureZoomSubjectInterval","current","create","onStartShouldSetPanResponder","_handleStartShouldSetPanResponder","onPanResponderGrant","_handlePanResponderGrant","onPanResponderMove","_handlePanResponderMove","onPanResponderRelease","_handlePanResponderEnd","onPanResponderTerminate","evt","gestureState","_getZoomableViewEventObject","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomAnimatedValue","panAnimatedValueXY","setValue","addListener","value","_invokeOnTransform","successful","onLayout","layout","nativeEvent","measureZoomSubject","setInterval","clearInterval","debouncedOnStaticPinPositionChange","zoomableViewEvent","position","_staticPinPosition","onTransform","overwriteObj","requestAnimationFrame","setTimeout","measure","pageX","pageY","e","persist","stopAnimation","_resolveAndHandleTap","clearTimeout","onPanResponderEnd","onZoomEnd","onShiftingEnd","_updateStaticPin","numberActiveTouches","_handlePinching","Math","abs","dx","dy","isShiftGesture","_handleShifting","distance","onZoomBefore","zoomGrowthFromLastGestureState","pinchToZoomSensitivity","deltaGrowth","deltaGrowthAdjustedBySensitivity","newZoomLevel","gestureCenterPoint","zoomCenter","debug","_setPinchDebugPoints","oldOffsetX","oldOffsetY","oldScale","newScale","newOffsetY","newOffsetX","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","onShiftingBefore","onShiftingAfter","now","Date","_addTouch","id","toString","isSecondTap","_handleDoubleTap","tapX","tapY","timing","toValue","useNativeDriver","duration","start","onSingleTap","publicMoveStaticPinTo","pinX","pinY","viewportPosition","imageSize","zoomableEvent","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","publicZoomTo","toFixed","listenerId","prevScale","removeListener","publicZoomBy","zoomLevelChange","publicMoveTo","publicMoveBy","offsetChangeX","offsetChangeY","zoomTo","zoomBy","moveTo","moveBy","moveStaticPinTo","children","onStaticPinLongPress","onStaticPinPress","pinProps","style","styles","container","panHandlers","zoomSubject","transform","scaleX","scaleY","getTranslateTransform","map","animationDuration","onAnimationDone","index","onPress","onParentMove","alignItems","flex","justifyContent","overflow"],"sourceRoot":"../../src","sources":["ReactNativeZoomableView.tsx"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,QAAQ,QAAQ,QAAQ;AAC3C,OAAOC,KAAK,IAEVC,SAAS,EACTC,mBAAmB,EACnBC,eAAe,EACfC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACH,OAAO;AACd,SACEC,QAAQ,EAERC,YAAY,EAIZC,UAAU,EACVC,IAAI,QACC,cAAc;AAErB,SAASC,kBAAkB,QAAQ,cAAc;AACjD,SAASC,qBAAqB,QAAQ,cAAc;AACpD,SAASC,SAAS,QAAQ,wBAAwB;AAClD,SAASC,eAAe,QAAQ,eAAe;AAC/C,SACEC,sBAAsB,EACtBC,wBAAwB,EACxBC,mCAAmC,QAC9B,UAAU;AACjB,SAASC,+BAA+B,QAAQ,+BAA+B;AAC/E,SAASC,iBAAiB,QAAQ,2BAA2B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiB9D,MAAMC,uBAGL,GAAGA,CAACC,KAAK,EAAEC,GAAG,KAAK;EAClB,MAAM,CAACC,aAAa,EAAEC,gBAAgB,CAAC,GAAGtB,QAAQ,CAAC,CAAC,CAAC;EACrD,MAAM,CAACuB,cAAc,EAAEC,iBAAiB,CAAC,GAAGxB,QAAQ,CAAC,CAAC,CAAC;EACvD,MAAM,CAACyB,aAAa,EAAEC,gBAAgB,CAAC,GAAG1B,Q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A,uBAAuB","ignoreList":[]} diff --git a/lib/module/animations/index.js b/lib/module/animations/index.js deleted file mode 100644 index 3cf33e8..0000000 --- a/lib/module/animations/index.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; - -import { Animated, Easing } from 'react-native'; -export function getZoomToAnimation(animValue, toValue) { - return Animated.timing(animValue, { - easing: Easing.out(Easing.ease), - toValue, - useNativeDriver: true - }); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/animations/index.js.map b/lib/module/animations/index.js.map deleted file mode 100644 index 7c5e7f2..0000000 --- a/lib/module/animations/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["Animated","Easing","getZoomToAnimation","animValue","toValue","timing","easing","out","ease","useNativeDriver"],"sourceRoot":"../../../src","sources":["animations/index.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,cAAc;AAE/C,OAAO,SAASC,kBAAkBA,CAACC,SAAyB,EAAEC,OAAe,EAAE;EAC7E,OAAOJ,QAAQ,CAACK,MAAM,CAACF,SAAS,EAAE;IAChCG,MAAM,EAAEL,MAAM,CAACM,GAAG,CAACN,MAAM,CAACO,IAAI,CAAC;IAC/BJ,OAAO;IACPK,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ","ignoreList":[]} diff --git a/lib/module/assets/pin.png b/lib/module/assets/pin.png deleted file mode 100644 index 471a758..0000000 Binary files a/lib/module/assets/pin.png and /dev/null differ diff --git a/lib/module/components/AnimatedTouchFeedback.js b/lib/module/components/AnimatedTouchFeedback.js deleted file mode 100644 index 391b2e1..0000000 --- a/lib/module/components/AnimatedTouchFeedback.js +++ /dev/null @@ -1,60 +0,0 @@ -"use strict"; - -import React, { useEffect, useRef } from 'react'; -import { Animated, Easing, StyleSheet } from 'react-native'; -import { jsx as _jsx } from "react/jsx-runtime"; -export const AnimatedTouchFeedback = ({ - x, - y, - animationDelay, - animationDuration, - onAnimationDone -}) => { - const appearDisappearAnimRef = useRef(new Animated.Value(0)); - const onAnimationDoneRef = useRef(onAnimationDone); - onAnimationDoneRef.current = onAnimationDone; - useEffect(() => { - appearDisappearAnimRef.current.setValue(0); - const inDuration = animationDuration * 0.8; - const outDuration = animationDuration - inDuration; - Animated.sequence([Animated.timing(appearDisappearAnimRef.current, { - delay: animationDelay || 0, - toValue: 1, - duration: inDuration, - easing: Easing.linear, - useNativeDriver: true - }), Animated.timing(appearDisappearAnimRef.current, { - toValue: 0, - duration: outDuration, - easing: Easing.out(Easing.ease), - useNativeDriver: true - })]).start(() => onAnimationDoneRef.current?.()); - }, [animationDelay, animationDuration]); - return /*#__PURE__*/_jsx(Animated.View, { - pointerEvents: "none", - style: [styles.animatedTouchFeedback, { - opacity: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0, 0.3] - }), - left: x - 20, - top: y - 20, - transform: [{ - scale: appearDisappearAnimRef.current.interpolate({ - inputRange: [0, 1], - outputRange: [0.5, 1] - }) - }] - }] - }); -}; -const styles = StyleSheet.create({ - animatedTouchFeedback: { - backgroundColor: 'lightgray', - borderRadius: 40, - height: 40, - position: 'absolute', - width: 40 - } -}); -//# sourceMappingURL=AnimatedTouchFeedback.js.map \ No newline at end of file diff --git a/lib/module/components/AnimatedTouchFeedback.js.map b/lib/module/components/AnimatedTouchFeedback.js.map deleted file mode 100644 index 0f745d8..0000000 --- a/lib/module/components/AnimatedTouchFeedback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","useEffect","useRef","Animated","Easing","StyleSheet","jsx","_jsx","AnimatedTouchFeedback","x","y","animationDelay","animationDuration","onAnimationDone","appearDisappearAnimRef","Value","onAnimationDoneRef","current","setValue","inDuration","outDuration","sequence","timing","delay","toValue","duration","easing","linear","useNativeDriver","out","ease","start","View","pointerEvents","style","styles","animatedTouchFeedback","opacity","interpolate","inputRange","outputRange","left","top","transform","scale","create","backgroundColor","borderRadius","height","position","width"],"sourceRoot":"../../../src","sources":["components/AnimatedTouchFeedback.tsx"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AC,EAAE,CAACN,cAAc,EAAEC,iBAAiB,CAAC,CAAC;EAEvC,oBACEL,IAAA,CAACJ,QAAQ,CAAC6B,IAAI;IACZC,aAAa,EAAC,MAAM;IACpBC,KAAK,EAAE,CACLC,MAAM,CAACC,qBAAqB,EAC5B;MACEC,OAAO,EAAEvB,sBAAsB,CAACG,OAAO,CAACqB,WAAW,CAAC;QAClDC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;QAClBC,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG;MACtB,CAAC,CAAC;MACFC,IAAI,EAAEhC,CAAC,GAAG,EAAE;MACZiC,GAAG,EAAEhC,CAAC,GAAG,EAAE;MACXiC,SAAS,EAAE,CACT;QACEC,KAAK,EAAE9B,sBAAsB,CAACG,OAAO,CAACqB,WAAW,CAAC;UAChDC,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;UAClBC,WAAW,EAAE,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC;MACH,CAAC;IAEL,CAAC;EACD,CACH,CAAC;AAEN,CAAC;AAED,MAAML,MAAM,GAAG9B,UAAU,CAACwC,MAAM,CAAC;EAC/BT,qBAAqB,EAAE;IACrBU,eAAe,EAAE,WAAW;IAC5BC,YAAY,EAAE,EAAE;IAChBC,MAAM,EAAE,EAAE;IACVC,QAAQ,EAAE,UAAU;IACpBC,KAAK,EAAE;EACT;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/module/components/StaticPin.js b/lib/module/components/StaticPin.js deleted file mode 100644 index 310dc3e..0000000 --- a/lib/module/components/StaticPin.js +++ /dev/null @@ -1,84 +0,0 @@ -"use strict"; - -import React from 'react'; -import { Animated, Image, PanResponder, StyleSheet, View } from 'react-native'; -import { jsx as _jsx } from "react/jsx-runtime"; -export const StaticPin = ({ - staticPinPosition, - staticPinIcon, - pinSize, - onParentMove, - onPress, - onLongPress, - setPinSize, - pinProps = {} -}) => { - const tapTime = React.useRef(0); - const transform = [{ - translateY: -pinSize.height - }, { - translateX: -pinSize.width / 2 - }]; - const opacity = pinSize.width && pinSize.height ? 1 : 0; - const panResponder = React.useRef(PanResponder.create({ - onStartShouldSetPanResponder: () => { - tapTime.current = Date.now(); - - // We want to handle tap on this so set true - return true; - }, - onPanResponderMove: (evt, gestureState) => { - // However if the user moves finger we want to pass this evt to parent - // to handle panning (tap not recognized) - if (Math.abs(gestureState.dx) > 5 && Math.abs(gestureState.dy) > 5) onParentMove(evt, gestureState); - }, - onPanResponderRelease: (evt, gestureState) => { - if (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) return; - const dt = Date.now() - tapTime.current; - if (onPress && dt < 500) { - onPress(evt); - } - if (onLongPress && dt > 500) { - // RN long press is 500ms - onLongPress(evt); - } - } - })).current; - return /*#__PURE__*/_jsx(Animated.View, { - style: [{ - left: staticPinPosition.x, - top: staticPinPosition.y - }, styles.pinWrapper, { - opacity, - transform - }], - ...pinProps, - children: /*#__PURE__*/_jsx(View, { - onLayout: ({ - nativeEvent: { - layout - } - }) => { - setPinSize(layout); - }, - ...panResponder.panHandlers, - children: staticPinIcon || - /*#__PURE__*/ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - _jsx(Image, { - source: require('../assets/pin.png'), - style: styles.pin - }) - }) - }); -}; -const styles = StyleSheet.create({ - pin: { - height: 64, - width: 48 - }, - pinWrapper: { - position: 'absolute' - } -}); -//# sourceMappingURL=StaticPin.js.map \ No newline at end of file diff --git a/lib/module/components/StaticPin.js.map b/lib/module/components/StaticPin.js.map deleted file mode 100644 index a40cc35..0000000 --- a/lib/module/components/StaticPin.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","Animated","Image","PanResponder","StyleSheet","View","jsx","_jsx","StaticPin","staticPinPosition","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","useRef","transform","translateY","height","translateX","width","opacity","panResponder","create","onStartShouldSetPanResponder","current","Date","now","onPanResponderMove","evt","gestureState","Math","abs","dx","dy","onPanResponderRelease","dt","style","left","x","top","y","styles","pinWrapper","children","onLayout","nativeEvent","layout","panHandlers","source","require","pin","position"],"sourceRoot":"../../../src","sources":["components/StaticPin.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,QAAQ,EAERC,KAAK,EACLC,YAAY,EAEZC,UAAU,EACVC,IAAI,QAEC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtB,OAAO,MAAMC,SAAS,GAAGA,CAAC;EACxBC,iBAAiB;EACjBC,aAAa;EACbC,OAAO;EACPC,YAAY;EACZC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,QAAQ,GAAG,CAAC;AAcd,CAAC,KAAK;EACJ,MAAMC,OAAO,GAAGjB,KAAK,CAACkB,MAAM,CAAC,CAAC,CAAC;EAC/B,MAAMC,SAAS,GAAG,CAChB;IAAEC,UAAU,EAAE,CAACT,OAAO,CAACU;EAAO,CAAC,EAC/B;IAAEC,UAAU,EAAE,CAACX,OAAO,CAACY,KAAK,GAAG;EAAE,CAAC,CACnC;EAED,MAAMC,OAAO,GAAGb,OAAO,CAACY,KAAK,IAAIZ,OAAO,CAACU,MAAM,GAAG,CAAC,GAAG,CAAC;EAEvD,MAAMI,YAAY,GAAGzB,KAAK,CAACkB,MAAM,CAC/Bf,YAAY,CAACuB,MAAM,CAAC;IAClBC,4BAA4B,EAAEA,CAAA,KAAM;MAClCV,OAAO,CAACW,OAAO,GAAGC,IAAI,CAACC,GAAG,CAAC,CAAC;;MAE5B;MACA,OAAO,IAAI;IACb,CAAC;IACDC,kBAAkB,EAAEA,CAACC,GAAG,EAAEC,YAAY,KAAK;MACzC;MACA;MACA,IAAIC,IAAI,CAACC,GAAG,CAACF,YAAY,CAACG,EAAE,CAAC,GAAG,CAAC,IAAIF,IAAI,CAACC,GAAG,CAACF,YAAY,CAACI,EAAE,CAAC,GAAG,CAAC,EAChEzB,YAAY,CAACoB,GAAG,EAAEC,YAAY,CAA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EAAE;IACHjC,MAAM,EAAE,EAAE;IACVE,KAAK,EAAE;EACT,CAAC;EACDuB,UAAU,EAAE;IACVS,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/module/components/index.js b/lib/module/components/index.js deleted file mode 100644 index 040fe35..0000000 --- a/lib/module/components/index.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; - -export { AnimatedTouchFeedback } from './AnimatedTouchFeedback'; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/components/index.js.map b/lib/module/components/index.js.map deleted file mode 100644 index 16f3c60..0000000 --- a/lib/module/components/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["AnimatedTouchFeedback"],"sourceRoot":"../../../src","sources":["components/index.tsx"],"mappings":";;AAAA,SAASA,qBAAqB,QAAQ,yBAAyB","ignoreList":[]} diff --git a/lib/module/debugHelper/index.js b/lib/module/debugHelper/index.js deleted file mode 100644 index f689e53..0000000 --- a/lib/module/debugHelper/index.js +++ /dev/null @@ -1,53 +0,0 @@ -"use strict"; - -import React from 'react'; -import { StyleSheet, View } from 'react-native'; -import { jsx as _jsx } from "react/jsx-runtime"; -export const DebugTouchPoint = ({ - diameter = 20, - x = 0, - y = 0, - color = 'yellow' -}) => { - const radius = diameter / 2; - return /*#__PURE__*/_jsx(View, { - style: [styles.debugPoint, { - width: diameter, - height: diameter, - borderRadius: diameter, - backgroundColor: color, - left: x - radius, - top: y - radius - }], - pointerEvents: "none" - }); -}; -export const DebugRect = ({ - height, - x = 0, - y = 0, - color = 'yellow' -}) => { - const width = 5; - return /*#__PURE__*/_jsx(View, { - style: [styles.debugRect, { - width, - height, - backgroundColor: color, - left: x - width / 2, - top: y - }], - pointerEvents: "none" - }); -}; -const styles = StyleSheet.create({ - debugPoint: { - opacity: 0.7, - position: 'absolute' - }, - debugRect: { - opacity: 0.5, - position: 'absolute' - } -}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/debugHelper/index.js.map b/lib/module/debugHelper/index.js.map deleted file mode 100644 index c87cf2b..0000000 --- a/lib/module/debugHelper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["React","StyleSheet","View","jsx","_jsx","DebugTouchPoint","diameter","x","y","color","radius","style","styles","debugPoint","width","height","borderRadius","backgroundColor","left","top","pointerEvents","DebugRect","debugRect","create","opacity","position"],"sourceRoot":"../../../src","sources":["debugHelper/index.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAEhD,OAAO,MAAMC,eAAe,GAAGA,CAAC;EAC9BC,QAAQ,GAAG,EAAE;EACbC,CAAC,GAAG,CAAC;EACLC,CAAC,GAAG,CAAC;EACLC,KAAK,GAAG;AACV,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGJ,QAAQ,GAAG,CAAC;EAC3B,oBACEF,IAAA,CAACF,IAAI;IACHS,KAAK,EAAE,CACLC,MAAM,CAACC,UAAU,EACjB;MACEC,KAAK,EAAER,QAAQ;MACfS,MAAM,EAAET,QAAQ;MAChBU,YAAY,EAAEV,QAAQ;MACtBW,eAAe,EAAER,KAAK;MACtBS,IAAI,EAAEX,CAAC,GAAGG,MAAM;MAChBS,GAAG,EAAEX,CAAC,GAAGE;IACX,CAAC,CACD;IACFU,aAAa,EAAC;EAAM,CACrB,CAAC;AAEN,CAAC;AACD,OAAO,MAAMC,SAAS,GAAGA,CAAC;EACxBN,MAAM;EACNR,CAAC,GAAG,CAAC;EACLC,CAAC,GAAG,CAAC;EACLC,KAAK,GAAG;AAMV,CAAC,KAAK;EACJ,MAAMK,KAAK,GAAG,CAAC;EACf,oBACEV,IAAA,CAACF,IAAI;IACHS,KAAK,EAAE,CACLC,MAAM,CAACU,SAAS,EAChB;MACER,KAAK;MACLC,MAAM;MACNE,eAAe,EAAER,KAAK;MACtBS,IAAI,EAAEX,CAAC,GAAGO,KAAK,GAAG,CAAC;MACnBK,GAAG,EAAEX;IACP,CAAC,CACD;IACFY,aAAa,EAAC;EAAM,CACrB,CAAC;AAEN,CAAC;AAED,MAAMR,MAAM,GAAGX,UAAU,CAACsB,MAAM,CAAC;EAC/BV,UAAU,EAAE;IACVW,OAAO,EAAE,GAAG;IACZC,QAAQ,EAAE;EACZ,CAAC;EACDH,SAAS,EAAE;IACTE,OAAO,EAAE,GAAG;IACZC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js deleted file mode 100644 index 7ac687e..0000000 --- a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; - -/** - * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming. - * Parameters should correspond to whether we need the offset for the X or Y axis - * - * ## Terms Used: - * - * - Zoom Subject: the view that's being zoomed and panned - * - Zoom Center: the point whose relative position to the window is retained - * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes - * - Scaled: a measurement in pixels scaled to the "scale transformation" of the zoom subject to match with its true size. - * *For example:* - * If the scale on the zoom subject is 0.5, - * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px - * 8px is the scaled measurement - * - * ## Overall idea of this algorithm: - * - * When users perform zooming by pinching the screen, - * we need to shift the zoom subject so that the position of the zoom center is always the same. - * The offset amount to shift the layer is the returned value. - * - * - * ## How we achieve our goal: - * - * To retain, the zoom center position, whenever a zoom action is performed, - * we just need to make sure the distances from all the points in the zoom subject - * to the zoom center increases or decreases by the growth rate of the scale. - * - * ``` - * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale) - * ``` - * - * We can't calculate that for all the points because there are unlimited points on a plain. - * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center. - * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center. - * - * ``` - * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale) - * ``` - * - * Once we have `newDistanceZoomSubjectCenterToZoomCenter`, - * we can easily calculate the position of the new center, which leads us to the offset amount. - * Refer to the code for more details - * - * @param oldOffsetXOrYScaled - * @param zoomSubjectOriginalWidthOrHeight - * @param oldScale - * @param newScale - * @param zoomCenterXOrY - */ -export function calcNewScaledOffsetForZoomCentering(oldOffsetXOrYScaled, zoomSubjectOriginalWidthOrHeight, oldScale, newScale, zoomCenterXOrY) { - const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale; - const growthRate = newScale / oldScale; - - // these act like namespaces just for the sake of readability - const zoomSubjectOriginalCenter = {}; - const zoomSubjectCurrentCenter = {}; - const zoomSubjectNewCenter = {}; - zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2; - zoomSubjectCurrentCenter.xOrY = zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled; - zoomSubjectCurrentCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY; - zoomSubjectNewCenter.distanceToZoomCenter = zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate; - zoomSubjectNewCenter.xOrY = zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY; - const newOffsetUnscaled = zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY; - return newOffsetUnscaled / newScale; -} -//# sourceMappingURL=calcNewScaledOffsetForZoomCentering.js.map \ No newline at end of file diff --git a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map deleted file mode 100644 index a84ce62..0000000 --- a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["calcNewScaledOffsetForZoomCentering","oldOffsetXOrYScaled","zoomSubjectOriginalWidthOrHeight","oldScale","newScale","zoomCenterXOrY","oldOffSetUnscaled","growthRate","zoomSubjectOriginalCenter","zoomSubjectCurrentCenter","zoomSubjectNewCenter","xOrY","distanceToZoomCenter","newOffsetUnscaled"],"sourceRoot":"../../../src","sources":["helper/calcNewScaledOffsetForZoomCentering.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mCAAmCA,CACjDC,mBAA2B,EAC3BC,gCAAwC,EACxCC,QAAgB,EAChBC,QAAgB,EAChBC,cAAsB,EACtB;EACA,MAAMC,iBAAiB,GAAGL,mBAAmB,GAAGE,QAAQ;EACxD,MAAMI,UAAU,GAAGH,QAAQ,GAAGD,QAAQ;;EAEtC;EACA,MAAMK,yBAAyB,GAAG,CAAC,CAAW;EAC9C,MAAMC,wBAAwB,GAAG,CAAC,CAAW;EAC7C,MAAMC,oBAAoB,GAAG,CAAC,CAAW;EAEzCF,yBAAyB,CAACG,IAAI,GAAGT,gCAAgC,GAAG,CAAC;EACrEO,wBAAwB,CAACE,IAAI,GAC3BH,yBAAyB,CAACG,IAAI,GAAGL,iBAAiB;EACpDG,wBAAwB,CAACG,oBAAoB,GAC3CH,wBAAwB,CAACE,IAAI,GAAGN,cAAc;EAEhDK,oBAAoB,CAACE,oBAAoB,GACvCH,wBAAwB,CAACG,oBAAoB,GAAGL,UAAU;EAC5DG,oBAAoB,CAACC,IAAI,GACvBD,oBAAoB,CAACE,oBAAoB,GAAGP,cAAc;EAE5D,MAAMQ,iBAAiB,GACrBH,oBAAoB,CAACC,IAAI,GAAGH,yBAAyB,CAACG,IAAI;EAE5D,OAAOE,iBAAiB,GAAGT,QAAQ;AACrC","ignoreList":[]} diff --git a/lib/module/helper/coordinateConversion.js b/lib/module/helper/coordinateConversion.js deleted file mode 100644 index 97c2442..0000000 --- a/lib/module/helper/coordinateConversion.js +++ /dev/null @@ -1,110 +0,0 @@ -"use strict"; - -export const defaultTransformSubjectData = { - offsetX: 0, - offsetY: 0, - zoomLevel: 0, - originalWidth: 0, - originalHeight: 0, - originalPageX: 0, - originalPageY: 0 -}; - -/** - * Assuming you have an image that's being resized to fit into a container - * using the "contain" resize mode. You can use this function to calculate the - * size of the image after fitting. - * - * Since our sheet is resized in this manner, we need this function - * for things like pan boundaries and marker placement - * - * @param imgSize - * @param containerSize - */ -export function applyContainResizeMode(imgSize, containerSize) { - const { - width: imageWidth, - height: imageHeight - } = imgSize; - const { - width: areaWidth, - height: areaHeight - } = containerSize; - const imageAspect = imageWidth / imageHeight; - const areaAspect = areaWidth / areaHeight; - let newSize; - if (imageAspect >= areaAspect) { - // longest edge is horizontal - newSize = { - width: areaWidth, - height: areaWidth / imageAspect - }; - } else { - // longest edge is vertical - newSize = { - width: areaHeight * imageAspect, - height: areaHeight - }; - } - if (isNaN(newSize.height)) newSize.height = areaHeight; - if (isNaN(newSize.width)) newSize.width = areaWidth; - const scale = imageWidth ? newSize.width / imageWidth : newSize.height / imageHeight; - if (!isFinite(scale)) return { - size: null, - scale: null - }; - return { - size: newSize, - scale - }; -} - -/** - * get the coord of image's origin relative to the transformSubject - * @param resizedImageSize - * @param transformSubject - */ -export function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { - const { - offsetX, - offsetY, - zoomLevel, - originalWidth, - originalHeight - } = transformSubject; - return { - x: offsetX * zoomLevel + originalWidth / 2 - resizedImageSize.width / 2 * zoomLevel, - y: offsetY * zoomLevel + originalHeight / 2 - resizedImageSize.height / 2 * zoomLevel - }; -} - -/** - * Translates the coord system of a point from the viewport's space to the image's space - * - * @param pointOnContainer - * @param sheetImageSize - * @param transformSubject - * - * @return {Vec2D} returns null if point is out of the sheet's bound - */ -export function viewportPositionToImagePosition({ - viewportPosition, - imageSize, - zoomableEvent -}) { - const { - size: resizedImgSize, - scale: resizedImgScale - } = applyContainResizeMode(imageSize, { - width: zoomableEvent.originalWidth, - height: zoomableEvent.originalHeight - }); - if (resizedImgScale == null) return null; - const sheetOriginOnContainer = getImageOriginOnTransformSubject(resizedImgSize, zoomableEvent); - const pointOnSheet = { - x: (viewportPosition.x - sheetOriginOnContainer.x) / zoomableEvent.zoomLevel / resizedImgScale, - y: (viewportPosition.y - sheetOriginOnContainer.y) / zoomableEvent.zoomLevel / resizedImgScale - }; - return pointOnSheet; -} -//# sourceMappingURL=coordinateConversion.js.map \ No newline at end of file diff --git a/lib/module/helper/coordinateConversion.js.map b/lib/module/helper/coordinateConversion.js.map deleted file mode 100644 index b6b0ab8..0000000 --- a/lib/module/helper/coordinateConversion.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["defaultTransformSubjectData","offsetX","offsetY","zoomLevel","originalWidth","originalHeight","originalPageX","originalPageY","applyContainResizeMode","imgSize","containerSize","width","imageWidth","height","imageHeight","areaWidth","areaHeight","imageAspect","areaAspect","newSize","isNaN","scale","isFinite","size","getImageOriginOnTransformSubject","resizedImageSize","transformSubject","x","y","viewportPositionToImagePosition","viewportPosition","imageSize","zoomableEvent","resizedImgSize","resizedImgScale","sheetOriginOnContainer","pointOnSheet"],"sourceRoot":"../../../src","sources":["helper/coordinateConversion.ts"],"mappings":";;AAEA,OAAO,MAAMA,2BAA8C,GAAG;EAC5DC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,SAAS,EAAE,CAAC;EACZC,aAAa,EAAE,CAAC;EAChBC,cAAc,EAAE,CAAC;EACjBC,aAAa,EAAE,CAAC;EAChBC,aAAa,EAAE;AACjB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,OAAe,EACfC,aAAqB,EAC0C;EAC/D,MAA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ACnBC,aAAa,GAAG,CAAC,GAChBqB,gBAAgB,CAACd,KAAK,GAAG,CAAC,GAAIR,SAAS;IAC1CyB,CAAC,EACC1B,OAAO,GAAGC,SAAS,GACnBE,cAAc,GAAG,CAAC,GACjBoB,gBAAgB,CAACZ,MAAM,GAAG,CAAC,GAAIV;EACpC,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAAS0B,+BAA+BA,CAAC;EAC9CC,gBAAgB;EAChBC,SAAS;EACTC;AAKF,CAAC,EAAgB;EACf,MAAM;IAAET,IAAI,EAAEU,cAAc;IAAEZ,KAAK,EAAEa;EAAgB,CAAC,GACpD1B,sBAAsB,CAACuB,SAAS,EAAE;IAChCpB,KAAK,EAAEqB,aAAa,CAAC5B,aAAa;IAClCS,MAAM,EAAEmB,aAAa,CAAC3B;EACxB,CAAC,CAAC;EAEJ,IAAI6B,eAAe,IAAI,IAAI,EAAE,OAAO,IAAI;EAExC,MAAMC,sBAAsB,GAAGX,gCAAgC,CAC7DS,cAAc,EACdD,aACF,CAAC;EAED,MAAMI,YAAY,GAAG;IACnBT,CAAC,EACC,CAACG,gBAAgB,CAACH,CAAC,GAAGQ,sBAAsB,CAACR,CAAC,IAC9CK,aAAa,CAAC7B,SAAS,GACvB+B,eAAe;IACjBN,CAAC,EACC,CAACE,gBAAgB,CAACF,CAAC,GAAGO,sBAAsB,CAACP,CAAC,IAC9CI,aAAa,CAAC7B,SAAS,GACvB+B;EACJ,CAAC;EAED,OAAOE,YAAY;AACrB","ignoreList":[]} diff --git a/lib/module/helper/index.js b/lib/module/helper/index.js deleted file mode 100644 index bdce1d5..0000000 --- a/lib/module/helper/index.js +++ /dev/null @@ -1,41 +0,0 @@ -"use strict"; - -export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering'; - -/** - * Calculates the gesture center point relative to the page coordinate system - * - * We're unable to use touch.locationX/Y - * because locationX uses the axis system of the leaf element that the touch occurs on, - * which makes it even more complicated to translate into our container's axis system. - * - * We're also unable to use gestureState.moveX/Y - * because gestureState.moveX/Y is messed up on real device - * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches) - */ -export function calcGestureCenterPoint(e, gestureState) { - const touches = e.nativeEvent.touches; - if (!touches[0]) return null; - if (gestureState.numberActiveTouches === 2) { - if (!touches[1]) return null; - return { - x: (touches[0].pageX + touches[1].pageX) / 2, - y: (touches[0].pageY + touches[1].pageY) / 2 - }; - } - if (gestureState.numberActiveTouches === 1) { - return { - x: touches[0].pageX, - y: touches[0].pageY - }; - } - return null; -} -export function calcGestureTouchDistance(e, gestureState) { - const touches = e.nativeEvent.touches; - if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1]) return null; - const dx = Math.abs(touches[0].pageX - touches[1].pageX); - const dy = Math.abs(touches[0].pageY - touches[1].pageY); - return Math.sqrt(dx * dx + dy * dy); -} -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/helper/index.js.map b/lib/module/helper/index.js.map deleted file mode 100644 index 0631c9e..0000000 --- a/lib/module/helper/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["calcNewScaledOffsetForZoomCentering","calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","sqrt"],"sourceRoot":"../../../src","sources":["helper/index.ts"],"mappings":";;AAIA,SAASA,mCAAmC,QAAQ,uCAAuC;;AAE3F;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CACpCC,CAAwB,EACxBC,YAAsC,EACxB;EACd,MAAMC,OAAO,GAAGF,CAAC,CAACG,WAAW,CAACD,OAAO;EACrC,IAAI,CAACA,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI;EAE5B,IAAID,YAAY,CAACG,mBAAmB,KAAK,CAAC,EAAE;IAC1C,IAAI,CAACF,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,IAAI;IAC5B,OAAO;MACLG,CAAC,EAAE,CAACH,OAAO,CAAC,CAAC,CAAC,CAACI,KAAK,GAAGJ,OAAO,CAAC,CAAC,CAAC,CAACI,KAAK,IAAI,CAAC;MAC5CC,CAAC,EAAE,CAACL,OAAO,CAAC,CAAC,CAAC,CAACM,KAAK,GAAGN,OAAO,CAAC,CAAC,CAAC,CAACM,KAAK,IAAI;IAC7C,CAAC;EACH;EACA,IAAIP,YAAY,CAACG,mBAAmB,KAAK,CAAC,EAAE;IAC1C,OAAO;MACLC,CAAC,EAAEH,OAAO,CAAC,CAAC,CAAC,CAACI,KAAK;MACnBC,CAAC,EAAEL,OAAO,CAAC,CAAC,CAAC,CAACM;IAChB,CAAC;EACH;EAEA,OAAO,IAAI;AACb;AAEA,OAAO,SAASC,wBAAwBA,CACtCT,CAAwB,EACxBC,YAAsC,EACvB;EACf,MAAMC,OAAO,GAAGF,CAAC,CAACG,WAAW,CAACD,OAAO;EACrC,IAAID,YAAY,CAACG,mBAAmB,KAAK,CAAC,IAAI,CAACF,OAAO,CAAC,CAAC,CAAC,IAAI,CAACA,OAAO,CAAC,CAAC,CAAC,EACtE,OAAO,IAAI;EAEb,MAAMQ,EAAE,GAAGC,IAAI,CAACC,GAAG,CAACV,OAAO,CAAC,CAAC,CAAC,CAACI,KAAK,GAAGJ,OAAO,CAAC,CAAC,CAAC,CAACI,KAAK,CAAC;EACxD,MAAMO,EAAE,GAAGF,IAAI,CAACC,GAAG,CAACV,OAAO,CAAC,CAAC,CAAC,CAACM,KAAK,GAAGN,OAAO,CAAC,CAAC,CAAC,CAACM,KAAK,CAAC;EACxD,OAAOG,IAAI,CAACG,IAAI,CAACJ,EAAE,GAAGA,EAAE,GAAGG,EAAE,GAAGA,EAAE,CAAC;AACrC","ignoreList":[]} diff --git a/lib/module/hooks/useLatestCallback.js b/lib/module/hooks/useLatestCallback.js deleted file mode 100644 index 23305ce..0000000 --- a/lib/module/hooks/useLatestCallback.js +++ /dev/null @@ -1,14 +0,0 @@ -"use strict"; - -import { useRef } from 'react'; - -/** - * A hook that returns a stable callback reference that always calls the latest version of the function. - * This avoids the need to include the callback in dependency arrays while ensuring the latest version is called. - */ -export const useLatestCallback = callback => { - const ref = useRef(callback); - ref.current = callback; - return useRef((...args) => ref.current(...args)).current; -}; -//# sourceMappingURL=useLatestCallback.js.map \ No newline at end of file diff --git a/lib/module/hooks/useLatestCallback.js.map b/lib/module/hooks/useLatestCallback.js.map deleted file mode 100644 index 98921a8..0000000 --- a/lib/module/hooks/useLatestCallback.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["useRef","useLatestCallback","callback","ref","current","args"],"sourceRoot":"../../../src","sources":["hooks/useLatestCallback.ts"],"mappings":";;AAAA,SAASA,MAAM,QAAQ,OAAO;;AAE9B;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAC5BC,QAAmC,IAChC;EACH,MAAMC,GAAG,GAAGH,MAAM,CAACE,QAAQ,CAAC;EAC5BC,GAAG,CAACC,OAAO,GAAGF,QAAQ;EAEtB,OAAOF,MAAM,CAAkB,CAAC,GAAGK,IAAI,KAAKF,GAAG,CAACC,OAAO,CAAC,GAAGC,IAAI,CAAC,CAAC,CAACD,OAAO;AAC3E,CAAC","ignoreList":[]} diff --git a/lib/module/index.js b/lib/module/index.js deleted file mode 100644 index bd05c56..0000000 --- a/lib/module/index.js +++ /dev/null @@ -1,8 +0,0 @@ -"use strict"; - -import { applyContainResizeMode, getImageOriginOnTransformSubject, viewportPositionToImagePosition } from './helper/coordinateConversion'; -import ReactNativeZoomableView from './ReactNativeZoomableView'; -export { -// Helper functions for coordinate conversion -applyContainResizeMode, getImageOriginOnTransformSubject, ReactNativeZoomableView, viewportPositionToImagePosition }; -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/index.js.map b/lib/module/index.js.map deleted file mode 100644 index add721f..0000000 --- a/lib/module/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["applyContainResizeMode","getImageOriginOnTransformSubject","viewportPositionToImagePosition","ReactNativeZoomableView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SACEA,sBAAsB,EACtBC,gCAAgC,EAChCC,+BAA+B,QAC1B,+BAA+B;AACtC,OAAOC,uBAAuB,MAAM,2BAA2B;AAM/D;AACE;AACAH,sBAAsB,EACtBC,gCAAgC,EAChCE,uBAAuB,EAEvBD,+BAA+B","ignoreList":[]} diff --git a/lib/module/package.json b/lib/module/package.json deleted file mode 100644 index 089153b..0000000 --- a/lib/module/package.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"module"} diff --git a/lib/module/typings/index.js b/lib/module/typings/index.js deleted file mode 100644 index f9391cf..0000000 --- a/lib/module/typings/index.js +++ /dev/null @@ -1,10 +0,0 @@ -"use strict"; - -export let SwipeDirection = /*#__PURE__*/function (SwipeDirection) { - SwipeDirection["SWIPE_UP"] = "SWIPE_UP"; - SwipeDirection["SWIPE_DOWN"] = "SWIPE_DOWN"; - SwipeDirection["SWIPE_LEFT"] = "SWIPE_LEFT"; - SwipeDirection["SWIPE_RIGHT"] = "SWIPE_RIGHT"; - return SwipeDirection; -}({}); -//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/lib/module/typings/index.js.map b/lib/module/typings/index.js.map deleted file mode 100644 index 533f3a9..0000000 --- a/lib/module/typings/index.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"names":["SwipeDirection"],"sourceRoot":"../../../src","sources":["typings/index.ts"],"mappings":";;AASA,WAAYA,cAAc,0BAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]} diff --git a/lib/typescript/ReactNativeZoomableView.d.ts b/lib/typescript/ReactNativeZoomableView.d.ts deleted file mode 100644 index 590c1b1..0000000 --- a/lib/typescript/ReactNativeZoomableView.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { ForwardRefRenderFunction } from 'react'; -import { ReactNativeZoomableViewProps, Vec2D } from './typings'; -type ReactNativeZoomableView = { - moveTo(newOffsetX: number, newOffsetY: number): void; - moveBy(offsetChangeX: number, offsetChangeY: number): void; - zoomTo(newZoomLevel: number, zoomCenter?: Vec2D): boolean; - zoomBy(zoomLevelChange: number): boolean; - moveStaticPinTo: (position: Vec2D, duration?: number) => void; - readonly gestureStarted: boolean; -}; -declare const ReactNativeZoomableView: ForwardRefRenderFunction; -export default ReactNativeZoomableView; -export { ReactNativeZoomableView }; -//# sourceMappingURL=ReactNativeZoomableView.d.ts.map \ No newline at end of file diff --git a/lib/typescript/ReactNativeZoomableView.d.ts.map b/lib/typescript/ReactNativeZoomableView.d.ts.map deleted file mode 100644 index fe4cb85..0000000 --- a/lib/typescript/ReactNativeZoomableView.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"ReactNativeZoomableView.d.ts","sourceRoot":"","sources":["../../src/ReactNativeZoomableView.tsx"],"names":[],"mappings":"AACA,OAAc,EACZ,wBAAwB,EAOzB,MAAM,OAAO,CAAC;AAuBf,OAAO,EACL,4BAA4B,EAE5B,KAAK,EAEN,MAAM,WAAW,CAAC;AAEnB,KAAK,uBAAuB,GAAG;IAC7B,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IACrD,MAAM,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3D,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC;IAC1D,MAAM,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC;IACzC,eAAe,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9D,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC,CAAC;AAEF,QAAA,MAAM,uBAAuB,EAAE,wBAAwB,CACrD,uBAAuB,EACvB,4BAA4B,CAmkC7B,CAAC;AAkBF,eAAe,uBAAuB,CAAC;AAEvC,OAAO,EAAE,uBAAuB,EAAE,CAAC"} \ No newline at end of file diff --git a/lib/typescript/animations/index.d.ts b/lib/typescript/animations/index.d.ts deleted file mode 100644 index 06cf7dd..0000000 --- a/lib/typescript/animations/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Animated } from 'react-native'; -export declare function getZoomToAnimation(animValue: Animated.Value, toValue: number): Animated.CompositeAnimation; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/animations/index.d.ts.map b/lib/typescript/animations/index.d.ts.map deleted file mode 100644 index d11620f..0000000 --- a/lib/typescript/animations/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/animations/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,MAAM,cAAc,CAAC;AAEhD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,+BAM5E"} \ No newline at end of file diff --git a/lib/typescript/components/AnimatedTouchFeedback.d.ts b/lib/typescript/components/AnimatedTouchFeedback.d.ts deleted file mode 100644 index dd75f5a..0000000 --- a/lib/typescript/components/AnimatedTouchFeedback.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import React from 'react'; -export declare const AnimatedTouchFeedback: ({ x, y, animationDelay, animationDuration, onAnimationDone, }: { - x: number; - y: number; - animationDuration: number; - animationDelay?: number | undefined; - onAnimationDone?: (() => void) | undefined; -}) => React.JSX.Element; -//# sourceMappingURL=AnimatedTouchFeedback.d.ts.map \ No newline at end of file diff --git a/lib/typescript/components/AnimatedTouchFeedback.d.ts.map b/lib/typescript/components/AnimatedTouchFeedback.d.ts.map deleted file mode 100644 index 47da034..0000000 --- a/lib/typescript/components/AnimatedTouchFeedback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"AnimatedTouchFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/AnimatedTouchFeedback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAGjD,eAAO,MAAM,qBAAqB;OAO7B,MAAM;OACN,MAAM;uBACU,MAAM;;6BAED,IAAI;uBAmD7B,CAAC"} \ No newline at end of file diff --git a/lib/typescript/components/StaticPin.d.ts b/lib/typescript/components/StaticPin.d.ts deleted file mode 100644 index c19536f..0000000 --- a/lib/typescript/components/StaticPin.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import React from 'react'; -import { GestureResponderEvent, PanResponderGestureState, ViewProps } from 'react-native'; -import { Size2D } from 'src/typings'; -export declare const StaticPin: ({ staticPinPosition, staticPinIcon, pinSize, onParentMove, onPress, onLongPress, setPinSize, pinProps, }: { - staticPinPosition: { - x: number; - y: number; - }; - staticPinIcon: React.ReactNode; - pinSize: Size2D; - /** Internal handler for passing move event to parent */ - onParentMove: (evt: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean | undefined; - onPress?: ((evt: GestureResponderEvent) => void) | undefined; - onLongPress?: ((evt: GestureResponderEvent) => void) | undefined; - setPinSize: (size: Size2D) => void; - pinProps?: ViewProps | undefined; -}) => React.JSX.Element; -//# sourceMappingURL=StaticPin.d.ts.map \ No newline at end of file diff --git a/lib/typescript/components/StaticPin.d.ts.map b/lib/typescript/components/StaticPin.d.ts.map deleted file mode 100644 index b968077..0000000 --- a/lib/typescript/components/StaticPin.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"StaticPin.d.ts","sourceRoot":"","sources":["../../../src/components/StaticPin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAEL,qBAAqB,EAGrB,wBAAwB,EAGxB,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAO,MAAM,SAAS;uBAUD;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;mBAC5B,MAAM,SAAS;aACrB,MAAM;IACf,wDAAwD;wBAEjD,qBAAqB,gBACZ,wBAAwB,KACnC,OAAO,GAAG,SAAS;qBACR,qBAAqB,KAAK,IAAI;yBAC1B,qBAAqB,KAAK,IAAI;uBAC/B,MAAM,KAAK,IAAI;;uBAiEnC,CAAC"} \ No newline at end of file diff --git a/lib/typescript/components/index.d.ts b/lib/typescript/components/index.d.ts deleted file mode 100644 index dbcaede..0000000 --- a/lib/typescript/components/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { AnimatedTouchFeedback } from './AnimatedTouchFeedback'; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/components/index.d.ts.map b/lib/typescript/components/index.d.ts.map deleted file mode 100644 index 7c9cccd..0000000 --- a/lib/typescript/components/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"} \ No newline at end of file diff --git a/lib/typescript/debugHelper/index.d.ts b/lib/typescript/debugHelper/index.d.ts deleted file mode 100644 index b17e292..0000000 --- a/lib/typescript/debugHelper/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react'; -export declare const DebugTouchPoint: ({ diameter, x, y, color, }: { - diameter?: number | undefined; - x?: number | undefined; - y?: number | undefined; - color?: string | undefined; -}) => React.JSX.Element; -export declare const DebugRect: ({ height, x, y, color, }: { - height: number; - x: number; - y: number; - color: string; -}) => React.JSX.Element; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/debugHelper/index.d.ts.map b/lib/typescript/debugHelper/index.d.ts.map deleted file mode 100644 index 86a4d35..0000000 --- a/lib/typescript/debugHelper/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/debugHelper/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,eAAO,MAAM,eAAe;;;;;uBAuB3B,CAAC;AACF,eAAO,MAAM,SAAS;YAMZ,MAAM;OACX,MAAM;OACN,MAAM;WACF,MAAM;uBAkBd,CAAC"} \ No newline at end of file diff --git a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts deleted file mode 100644 index 7503b33..0000000 --- a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/** - * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming. - * Parameters should correspond to whether we need the offset for the X or Y axis - * - * ## Terms Used: - * - * - Zoom Subject: the view that's being zoomed and panned - * - Zoom Center: the point whose relative position to the window is retained - * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes - * - Scaled: a measurement in pixels scaled to the "scale transformation" of the zoom subject to match with its true size. - * *For example:* - * If the scale on the zoom subject is 0.5, - * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px - * 8px is the scaled measurement - * - * ## Overall idea of this algorithm: - * - * When users perform zooming by pinching the screen, - * we need to shift the zoom subject so that the position of the zoom center is always the same. - * The offset amount to shift the layer is the returned value. - * - * - * ## How we achieve our goal: - * - * To retain, the zoom center position, whenever a zoom action is performed, - * we just need to make sure the distances from all the points in the zoom subject - * to the zoom center increases or decreases by the growth rate of the scale. - * - * ``` - * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale) - * ``` - * - * We can't calculate that for all the points because there are unlimited points on a plain. - * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center. - * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center. - * - * ``` - * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale) - * ``` - * - * Once we have `newDistanceZoomSubjectCenterToZoomCenter`, - * we can easily calculate the position of the new center, which leads us to the offset amount. - * Refer to the code for more details - * - * @param oldOffsetXOrYScaled - * @param zoomSubjectOriginalWidthOrHeight - * @param oldScale - * @param newScale - * @param zoomCenterXOrY - */ -export declare function calcNewScaledOffsetForZoomCentering(oldOffsetXOrYScaled: number, zoomSubjectOriginalWidthOrHeight: number, oldScale: number, newScale: number, zoomCenterXOrY: number): number; -//# sourceMappingURL=calcNewScaledOffsetForZoomCentering.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map deleted file mode 100644 index 4ffc3f5..0000000 --- a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"calcNewScaledOffsetForZoomCentering.d.ts","sourceRoot":"","sources":["../../../src/helper/calcNewScaledOffsetForZoomCentering.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,mCAAmC,CACjD,mBAAmB,EAAE,MAAM,EAC3B,gCAAgC,EAAE,MAAM,EACxC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,EAChB,cAAc,EAAE,MAAM,UAyBvB"} \ No newline at end of file diff --git a/lib/typescript/helper/coordinateConversion.d.ts b/lib/typescript/helper/coordinateConversion.d.ts deleted file mode 100644 index c8bfdc0..0000000 --- a/lib/typescript/helper/coordinateConversion.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { Size2D, Vec2D, ZoomableViewEvent } from 'src/typings'; -export declare const defaultTransformSubjectData: ZoomableViewEvent; -/** - * Assuming you have an image that's being resized to fit into a container - * using the "contain" resize mode. You can use this function to calculate the - * size of the image after fitting. - * - * Since our sheet is resized in this manner, we need this function - * for things like pan boundaries and marker placement - * - * @param imgSize - * @param containerSize - */ -export declare function applyContainResizeMode(imgSize: Size2D, containerSize: Size2D): { - size: Size2D; - scale: number; -} | { - size: null; - scale: null; -}; -/** - * get the coord of image's origin relative to the transformSubject - * @param resizedImageSize - * @param transformSubject - */ -export declare function getImageOriginOnTransformSubject(resizedImageSize: Size2D, transformSubject: ZoomableViewEvent): { - x: number; - y: number; -}; -/** - * Translates the coord system of a point from the viewport's space to the image's space - * - * @param pointOnContainer - * @param sheetImageSize - * @param transformSubject - * - * @return {Vec2D} returns null if point is out of the sheet's bound - */ -export declare function viewportPositionToImagePosition({ viewportPosition, imageSize, zoomableEvent, }: { - viewportPosition: Vec2D; - imageSize: Size2D; - zoomableEvent: ZoomableViewEvent; -}): Vec2D | null; -//# sourceMappingURL=coordinateConversion.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/coordinateConversion.d.ts.map b/lib/typescript/helper/coordinateConversion.d.ts.map deleted file mode 100644 index c43dfee..0000000 --- a/lib/typescript/helper/coordinateConversion.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"coordinateConversion.d.ts","sourceRoot":"","sources":["../../../src/helper/coordinateConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,2BAA2B,EAAE,iBAQzC,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE,CA4B/D;AAED;;;;GAIG;AACH,wBAAgB,gCAAgC,CAC9C,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,iBAAiB;;;EAcpC;AAED;;;;;;;;GAQG;AACH,wBAAgB,+BAA+B,CAAC,EAC9C,gBAAgB,EAChB,SAAS,EACT,aAAa,GACd,EAAE;IACD,gBAAgB,EAAE,KAAK,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,iBAAiB,CAAC;CAClC,GAAG,KAAK,GAAG,IAAI,CA0Bf"} \ No newline at end of file diff --git a/lib/typescript/helper/index.d.ts b/lib/typescript/helper/index.d.ts deleted file mode 100644 index bc85ca3..0000000 --- a/lib/typescript/helper/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { GestureResponderEvent, PanResponderGestureState } from 'react-native'; -import { Vec2D } from '../typings'; -export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering'; -/** - * Calculates the gesture center point relative to the page coordinate system - * - * We're unable to use touch.locationX/Y - * because locationX uses the axis system of the leaf element that the touch occurs on, - * which makes it even more complicated to translate into our container's axis system. - * - * We're also unable to use gestureState.moveX/Y - * because gestureState.moveX/Y is messed up on real device - * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches) - */ -export declare function calcGestureCenterPoint(e: GestureResponderEvent, gestureState: PanResponderGestureState): Vec2D | null; -export declare function calcGestureTouchDistance(e: GestureResponderEvent, gestureState: PanResponderGestureState): number | null; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/index.d.ts.map b/lib/typescript/helper/index.d.ts.map deleted file mode 100644 index fe42758..0000000 --- a/lib/typescript/helper/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/helper/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAE,mCAAmC,EAAE,MAAM,uCAAuC,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,qBAAqB,EACxB,YAAY,EAAE,wBAAwB,GACrC,KAAK,GAAG,IAAI,CAmBd;AAED,wBAAgB,wBAAwB,CACtC,CAAC,EAAE,qBAAqB,EACxB,YAAY,EAAE,wBAAwB,GACrC,MAAM,GAAG,IAAI,CAQf"} \ No newline at end of file diff --git a/lib/typescript/hooks/useLatestCallback.d.ts b/lib/typescript/hooks/useLatestCallback.d.ts deleted file mode 100644 index 3a1afed..0000000 --- a/lib/typescript/hooks/useLatestCallback.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/** - * A hook that returns a stable callback reference that always calls the latest version of the function. - * This avoids the need to include the callback in dependency arrays while ensuring the latest version is called. - */ -export declare const useLatestCallback: (callback: (...args: Args) => Return) => (...args: Args) => Return; -//# sourceMappingURL=useLatestCallback.d.ts.map \ No newline at end of file diff --git a/lib/typescript/hooks/useLatestCallback.d.ts.map b/lib/typescript/hooks/useLatestCallback.d.ts.map deleted file mode 100644 index fd1ec86..0000000 --- a/lib/typescript/hooks/useLatestCallback.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"useLatestCallback.d.ts","sourceRoot":"","sources":["../../../src/hooks/useLatestCallback.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,iBAAiB,oGAO7B,CAAC"} \ No newline at end of file diff --git a/lib/typescript/index.d.ts b/lib/typescript/index.d.ts deleted file mode 100644 index 7b02103..0000000 --- a/lib/typescript/index.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { applyContainResizeMode, getImageOriginOnTransformSubject, viewportPositionToImagePosition } from './helper/coordinateConversion'; -import ReactNativeZoomableView from './ReactNativeZoomableView'; -import type { ReactNativeZoomableViewProps, ZoomableViewEvent } from './typings'; -export { applyContainResizeMode, getImageOriginOnTransformSubject, ReactNativeZoomableView, ReactNativeZoomableViewProps, viewportPositionToImagePosition, ZoomableViewEvent, }; -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/index.d.ts.map b/lib/typescript/index.d.ts.map deleted file mode 100644 index 2a3655b..0000000 --- a/lib/typescript/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,sBAAsB,EACtB,gCAAgC,EAChC,+BAA+B,EAChC,MAAM,+BAA+B,CAAC;AACvC,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EACV,4BAA4B,EAC5B,iBAAiB,EAClB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAEL,sBAAsB,EACtB,gCAAgC,EAChC,uBAAuB,EACvB,4BAA4B,EAC5B,+BAA+B,EAC/B,iBAAiB,GAClB,CAAC"} \ No newline at end of file diff --git a/lib/typescript/typings/index.d.ts b/lib/typescript/typings/index.d.ts deleted file mode 100644 index 303e666..0000000 --- a/lib/typescript/typings/index.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { ReactNode } from 'react'; -import { Animated, GestureResponderEvent, LayoutChangeEvent, PanResponderGestureState, ViewProps } from 'react-native'; -export declare enum SwipeDirection { - SWIPE_UP = "SWIPE_UP", - SWIPE_DOWN = "SWIPE_DOWN", - SWIPE_LEFT = "SWIPE_LEFT", - SWIPE_RIGHT = "SWIPE_RIGHT" -} -export interface ZoomableViewEvent { - zoomLevel: number; - offsetX: number; - offsetY: number; - originalHeight: number; - originalWidth: number; - originalPageX: number; - originalPageY: number; -} -export interface ReactNativeZoomableViewProps { - style?: ViewProps['style']; - children?: ReactNode; - zoomEnabled?: boolean; - panEnabled?: boolean; - initialZoom?: number; - initialOffsetX?: number; - initialOffsetY?: number; - contentWidth?: number; - contentHeight?: number; - panBoundaryPadding?: number; - maxZoom?: number; - minZoom?: number; - doubleTapDelay?: number; - doubleTapZoomToCenter?: boolean; - zoomStep?: number; - pinchToZoomInSensitivity?: number; - pinchToZoomOutSensitivity?: number; - movementSensibility?: number; - longPressDuration?: number; - visualTouchFeedbackEnabled?: boolean; - disablePanOnInitialZoom?: boolean; - zoomAnimatedValue?: Animated.Value; - panAnimatedValueXY?: Animated.ValueXY; - debug?: boolean; - onLayout?: (event: Pick) => void; - onTransform?: (zoomableViewEventObject: ZoomableViewEvent) => void; - onSingleTap?: (event: GestureResponderEvent, zoomableViewEventObject: ZoomableViewEvent) => void; - onDoubleTapBefore?: (event: GestureResponderEvent, zoomableViewEventObject: ZoomableViewEvent) => void; - onDoubleTapAfter?: (event: GestureResponderEvent, zoomableViewEventObject: ZoomableViewEvent) => void; - onShiftingBefore?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onShiftingAfter?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onShiftingEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onZoomBefore?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => boolean | undefined; - onZoomAfter?: (event: GestureResponderEvent | null, gestureState: PanResponderGestureState | null, zoomableViewEventObject: ZoomableViewEvent) => void; - onZoomEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onLongPress?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onStartShouldSetPanResponder?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent, baseComponentResult: boolean) => boolean; - onPanResponderGrant?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onPanResponderEnd?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onPanResponderMove?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onPanResponderTerminate?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => void; - onPanResponderTerminationRequest?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onShouldBlockNativeResponder?: (event: GestureResponderEvent, gestureState: PanResponderGestureState, zoomableViewEventObject: ZoomableViewEvent) => boolean; - onStartShouldSetPanResponderCapture?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean; - onMoveShouldSetPanResponderCapture?: (event: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean; - onStaticPinPress?: (event: GestureResponderEvent) => void; - onStaticPinLongPress?: (event: GestureResponderEvent) => void; - staticPinPosition?: Vec2D; - staticPinIcon?: React.ReactElement; - onStaticPinPositionChange?: (position: Vec2D) => void; - onStaticPinPositionMove?: (position: Vec2D) => void; - pinProps?: ViewProps; -} -export interface Vec2D { - x: number; - y: number; -} -export interface Size2D { - width: number; - height: number; -} -export interface TouchPoint extends Vec2D { - id: string; - isSecondTap?: boolean; -} -export interface ReactNativeZoomableViewState { - touches?: TouchPoint[]; - originalWidth: number; - originalHeight: number; - originalPageX: number; - originalPageY: number; - originalX: number; - originalY: number; - debugPoints?: undefined | Vec2D[]; - pinSize: Size2D; -} -export interface ReactNativeZoomableViewWithGesturesProps extends ReactNativeZoomableViewProps { - swipeLengthThreshold?: number; - swipeVelocityThreshold?: number; - swipeDirectionalThreshold?: number; - swipeMinZoom?: number; - swipeMaxZoom?: number; - swipeDisabled?: boolean; - onSwipe?: (swipeDirection: SwipeDirection, gestureState: PanResponderGestureState) => void; - onSwipeUp?: (gestureState: PanResponderGestureState) => void; - onSwipeDown?: (gestureState: PanResponderGestureState) => void; - onSwipeLeft?: (gestureState: PanResponderGestureState) => void; - onSwipeRight?: (gestureState: PanResponderGestureState) => void; -} -//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/lib/typescript/typings/index.d.ts.map b/lib/typescript/typings/index.d.ts.map deleted file mode 100644 index dfc9f21..0000000 --- a/lib/typescript/typings/index.d.ts.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/typings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,wBAAwB,EACxB,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB,oBAAY,cAAc;IACxB,QAAQ,aAAa;IACrB,UAAU,eAAe;IACzB,UAAU,eAAe;IACzB,WAAW,gBAAgB;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAE3C,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;IAC3B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACj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X,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAC3C,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,GAAG,KAAK,EAAE,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,wCACf,SAAQ,4BAA4B;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,OAAO,CAAC,EAAE,CACR,cAAc,EAAE,cAAc,EAC9B,YAAY,EAAE,wBAAwB,KACnC,IAAI,CAAC;IACV,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC7D,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC/D,WAAW,CAAC,EAAE,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAC/D,YAAY,CAAC,EAAE,CAAC,YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACjE"} \ No newline at end of file diff --git a/package.json b/package.json index 7b027da..a476ee0 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,11 @@ "!**/__mocks__" ], "scripts": { + "prepublishOnly": "yarn build", "test": "jest", "typescript": "tsc --noEmit", "lint": "eslint \"**/*.{js,ts,tsx}\"", + "build": "bob build", "release": "release-it", "example": "yarn --cwd example", "pods": "cd example && pod-install --quiet", @@ -77,7 +79,6 @@ "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-simple-import-sort": "^12.1.1", "husky": "^4.2.5", - "lodash": "^4.17.21", "pod-install": "^0.1.0", "prettier": "^2.0.5", "react": "17.0.2", @@ -100,7 +101,7 @@ }, "husky": { "hooks": { - "pre-commit": "yarn lint && yarn typescript && bob build && git add lib" + "pre-commit": "yarn lint && yarn typescript" } }, "commitlint": { @@ -114,7 +115,7 @@ "tagName": "v${version}" }, "npm": { - "publish": true + "publish": false }, "github": { "release": true @@ -155,6 +156,7 @@ } ], "react-native/no-color-literals": "off", + "react-native/no-inline-styles": "off", "simple-import-sort/imports": "error", "simple-import-sort/exports": "error" }, @@ -182,6 +184,16 @@ { "allowNumber": true } + ], + "@typescript-eslint/no-use-before-define": [ + "error", + { + "functions": true, + "variables": true, + "enums": false, + "classes": false, + "typedefs": false + } ] } } diff --git a/src/ReactNativeZoomableView.tsx b/src/ReactNativeZoomableView.tsx index b517c88..25f13a9 100644 --- a/src/ReactNativeZoomableView.tsx +++ b/src/ReactNativeZoomableView.tsx @@ -1,7 +1,6 @@ import { debounce, defaults } from 'lodash'; import React, { ForwardRefRenderFunction, - useEffect, useImperativeHandle, useLayoutEffect, useMemo, @@ -29,7 +28,10 @@ import { calcNewScaledOffsetForZoomCentering, } from './helper'; import { viewportPositionToImagePosition } from './helper/coordinateConversion'; +import { getNextZoomStep } from './helper/getNextZoomStep'; +import { useDebugPoints } from './hooks/useDebugPoints'; import { useLatestCallback } from './hooks/useLatestCallback'; +import { useZoomSubject } from './hooks/useZoomSubject'; import { ReactNativeZoomableViewProps, TouchPoint, @@ -50,17 +52,25 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< ReactNativeZoomableView, ReactNativeZoomableViewProps > = (props, ref) => { - const [originalWidth, setOriginalWidth] = useState(0); - const [originalHeight, setOriginalHeight] = useState(0); - const [originalPageX, setOriginalPageX] = useState(0); - const [originalPageY, setOriginalPageY] = useState(0); - const [originalX, setOriginalX] = useState(0); - const [originalY, setOriginalY] = useState(0); + const { + wrapperRef: zoomSubjectWrapperRef, + measure: measureZoomSubject, + originalWidth, + originalHeight, + originalPageX, + originalPageY, + originalX, + originalY, + } = useZoomSubject(); + const [pinSize, setPinSize] = useState({ width: 0, height: 0 }); - const [debugPoints, setDebugPoints] = useState([]); const [stateTouches, setStateTouches] = useState([]); - const zoomSubjectWrapperRef = useRef(null); + const { debugPoints, setDebugPoints, setPinchDebugPoints } = useDebugPoints({ + originalPageX, + originalPageY, + }); + const gestureHandlers = useRef(); const doubleTapFirstTapReleaseTimestamp = useRef(); @@ -89,6 +99,17 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< disablePanOnInitialZoom: false, }); + const { + staticPinIcon, + children, + visualTouchFeedbackEnabled, + doubleTapDelay, + staticPinPosition, + onStaticPinLongPress, + onStaticPinPress, + pinProps, + } = props; + const panAnim = useRef(new Animated.ValueXY({ x: 0, y: 0 })); const zoomAnim = useRef(new Animated.Value(1)); @@ -112,47 +133,97 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< const singleTapTimeoutId = useRef(); const touches = useRef([]); const doubleTapFirstTap = useRef(); - const measureZoomSubjectInterval = useRef(); - useLayoutEffect(() => { - gestureHandlers.current = PanResponder.create({ - onStartShouldSetPanResponder: _handleStartShouldSetPanResponder, - onPanResponderGrant: _handlePanResponderGrant, - onPanResponderMove: _handlePanResponderMove, - onPanResponderRelease: _handlePanResponderEnd, - onPanResponderTerminate: (evt, gestureState) => { - // We should also call _handlePanResponderEnd - // to properly perform cleanups when the gesture is terminated - // (aka gesture handling responsibility is taken over by another component). - // This also fixes a weird issue where - // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, - // but onPanResponderTerminate is called instead for no apparent reason. - _handlePanResponderEnd(evt, gestureState); - props.onPanResponderTerminate?.( - evt, - gestureState, - _getZoomableViewEventObject() - ); + /** + * Returns additional information about components current state for external event hooks + * + * @returns {{}} + * @private + */ + const _getZoomableViewEventObject = useLatestCallback( + (overwriteObj: Partial = {}): ZoomableViewEvent => { + return { + zoomLevel: zoomLevel.current, + offsetX: offsetX.current, + offsetY: offsetY.current, + originalHeight, + originalWidth, + originalPageX, + originalPageY, + ...overwriteObj, + }; + } + ); + + const _staticPinPosition = useLatestCallback(() => { + if (!props.staticPinPosition) return; + if (!props.contentWidth || !props.contentHeight) return; + + return viewportPositionToImagePosition({ + viewportPosition: { + x: props.staticPinPosition.x, + y: props.staticPinPosition.y, + }, + imageSize: { + height: props.contentHeight, + width: props.contentWidth, + }, + zoomableEvent: { + ..._getZoomableViewEventObject(), + offsetX: offsetX.current, + offsetY: offsetY.current, + zoomLevel: zoomLevel.current, }, - onPanResponderTerminationRequest: (evt, gestureState) => - !!props.onPanResponderTerminationRequest?.( - evt, - gestureState, - _getZoomableViewEventObject() - ), - // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => - props.onShouldBlockNativeResponder?.( - evt, - gestureState, - _getZoomableViewEventObject() - ) ?? true, - onStartShouldSetPanResponderCapture: (evt, gestureState) => - !!props.onStartShouldSetPanResponderCapture?.(evt, gestureState), - onMoveShouldSetPanResponderCapture: (evt, gestureState) => - !!props.onMoveShouldSetPanResponderCapture?.(evt, gestureState), }); + }); + + const _updateStaticPin = useLatestCallback(() => { + const position = _staticPinPosition(); + if (!position) return; + props.onStaticPinPositionChange?.(position); + }); + + const _addTouch = useLatestCallback((touch: TouchPoint) => { + touches.current.push(touch); + setStateTouches([...touches.current]); + }); + + const _removeTouch = useLatestCallback((touch: TouchPoint) => { + touches.current.splice(touches.current.indexOf(touch), 1); + setStateTouches([...touches.current]); + }); + + const onStaticPinPositionChange = useLatestCallback( + props.onStaticPinPositionChange || (() => undefined) + ); + + const debouncedOnStaticPinPositionChange = useMemo( + () => debounce(onStaticPinPositionChange, 100), + [] + ); + + /** + * try to invoke onTransform + * @private + */ + const _invokeOnTransform = useLatestCallback(() => { + const zoomableViewEvent = _getZoomableViewEventObject(); + const position = _staticPinPosition(); + + if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) + return { successful: false }; + + props.onTransform?.(zoomableViewEvent); + + if (position) { + props.onStaticPinPositionMove?.(position); + debouncedOnStaticPinPositionChange(position); + } + + return { successful: true }; + }); + useLayoutEffect(() => { if (props.zoomAnimatedValue) zoomAnim.current = props.zoomAnimatedValue; if (props.panAnimatedValueXY) panAnim.current = props.panAnimatedValueXY; @@ -227,111 +298,6 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< if (onTransformInvocationInitialized.current) _invokeOnTransform(); }, [props.staticPinPosition?.x, props.staticPinPosition?.y]); - useEffect(() => { - measureZoomSubject(); - // We've already run `grabZoomSubjectOriginalMeasurements` at various events - // to make sure the measurements are promptly updated. - // However, there might be cases we haven't accounted for, especially when - // native processes are involved. To account for those cases, - // we'll use an interval here to ensure we're always up-to-date. - // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender - // if the values given haven't changed, so we're not running performance risk here. - measureZoomSubjectInterval.current = setInterval(measureZoomSubject, 1e3); - - return () => { - measureZoomSubjectInterval.current && - clearInterval(measureZoomSubjectInterval.current); - }; - }, []); - - const onStaticPinPositionChange = useLatestCallback( - props.onStaticPinPositionChange || (() => undefined) - ); - - const debouncedOnStaticPinPositionChange = useMemo( - () => debounce(onStaticPinPositionChange, 100), - [] - ); - - /** - * try to invoke onTransform - * @private - */ - const _invokeOnTransform = useLatestCallback(() => { - const zoomableViewEvent = _getZoomableViewEventObject(); - const position = _staticPinPosition(); - - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) - return { successful: false }; - - props.onTransform?.(zoomableViewEvent); - - if (position) { - props.onStaticPinPositionMove?.(position); - debouncedOnStaticPinPositionChange(position); - } - - return { successful: true }; - }); - - /** - * Returns additional information about components current state for external event hooks - * - * @returns {{}} - * @private - */ - const _getZoomableViewEventObject = useLatestCallback( - (overwriteObj: Partial = {}): ZoomableViewEvent => { - return { - zoomLevel: zoomLevel.current, - offsetX: offsetX.current, - offsetY: offsetY.current, - originalHeight, - originalWidth, - originalPageX, - originalPageY, - ...overwriteObj, - }; - } - ); - - /** - * Get the original box dimensions and save them for later use. - * (They will be used to calculate boxBorders) - * - * @private - */ - const measureZoomSubject = useLatestCallback(() => { - // make sure we measure after animations are complete - requestAnimationFrame(() => { - // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` - // when navigating back (react-navigation stack) from another view - // while closing the keyboard at the same time - setTimeout(() => { - // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper. - // However, our zoomSubject may have been transformed by an initial zoomLevel or offset, - // in which case these measurements will not represent the true "original" measurements. - // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject - // (no border, space, or anything between them) - zoomSubjectWrapperRef.current?.measure( - (x, y, width, height, pageX, pageY) => { - // When the component is off-screen, these become all 0s, so we don't set them - // to avoid messing up calculations, especially ones that are done right after - // the component transitions from hidden to visible. - if (!pageX && !pageY && !width && !height) return; - - setOriginalX(x); - setOriginalY(y); - setOriginalWidth(width); - setOriginalHeight(height); - setOriginalPageX(pageX); - setOriginalPageY(pageY); - } - ); - }); - }); - }); - /** * Handles the start of touch events and checks for taps * @@ -386,124 +352,36 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< }); /** - * Handles the end of touch events + * Calculates the amount the offset should shift since the last position during panning * - * @param e - * @param gestureState + * @param {Vec2D} gestureCenterPoint * * @private */ - const _handlePanResponderEnd: NonNullable< - PanResponderCallbacks['onPanResponderEnd'] - > = useLatestCallback((e, gestureState) => { - if (!gestureType.current) { - _resolveAndHandleTap(e); - } + const _calcOffsetShiftSinceLastGestureState = useLatestCallback( + (gestureCenterPoint: Vec2D) => { + const { movementSensibility } = props; - setDebugPoints([]); + let shift = null; - lastGestureCenterPosition.current = null; + if (lastGestureCenterPosition.current && movementSensibility) { + const dx = gestureCenterPoint.x - lastGestureCenterPosition.current.x; + const dy = gestureCenterPoint.y - lastGestureCenterPosition.current.y; - if (longPressTimeout.current) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } + const shiftX = dx / zoomLevel.current / movementSensibility; + const shiftY = dy / zoomLevel.current / movementSensibility; - props.onPanResponderEnd?.(e, gestureState, _getZoomableViewEventObject()); + shift = { + x: shiftX, + y: shiftY, + }; + } - if (gestureType.current === 'pinch') { - props.onZoomEnd?.(e, gestureState, _getZoomableViewEventObject()); - } else if (gestureType.current === 'shift') { - props.onShiftingEnd?.(e, gestureState, _getZoomableViewEventObject()); - } + lastGestureCenterPosition.current = gestureCenterPoint; - if (props.staticPinPosition) { - _updateStaticPin(); + return shift; } - - gestureType.current = undefined; - gestureStarted.current = false; - }); - - /** - * Handles the actual movement of our pan responder - * - * @param e - * @param gestureState - * - * @private - */ - const _handlePanResponderMove = useLatestCallback( - (e: GestureResponderEvent, gestureState: PanResponderGestureState) => { - if (props.onPanResponderMove) { - if ( - props.onPanResponderMove( - e, - gestureState, - _getZoomableViewEventObject() - ) - ) { - return false; - } - } - - // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - if (gestureState.numberActiveTouches <= 2) { - if (!gestureStarted.current) { - _handlePanResponderGrant(e, gestureState); - } - } else { - if (gestureStarted.current) { - _handlePanResponderEnd(e, gestureState); - } - return true; - } - - if (gestureState.numberActiveTouches === 2) { - if (longPressTimeout.current) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - - // change some measurement states when switching gesture to ensure a smooth transition - if (gestureType.current !== 'pinch') { - lastGestureCenterPosition.current = calcGestureCenterPoint( - e, - gestureState - ); - lastGestureTouchDistance.current = calcGestureTouchDistance( - e, - gestureState - ); - } - gestureType.current = 'pinch'; - _handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if ( - longPressTimeout.current && - (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) - ) { - clearTimeout(longPressTimeout.current); - longPressTimeout.current = undefined; - } - // change some measurement states when switching gesture to ensure a smooth transition - if (gestureType.current !== 'shift') { - lastGestureCenterPosition.current = calcGestureCenterPoint( - e, - gestureState - ); - } - - const { dx, dy } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - if (isShiftGesture) { - gestureType.current = 'shift'; - _handleShifting(gestureState); - } - } - } - ); + ); /** * Handles the pinch movement and zooming @@ -584,7 +462,7 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< } // Uncomment to debug - props.debug && _setPinchDebugPoints(e, zoomCenter); + props.debug && setPinchDebugPoints(e, zoomCenter); const oldOffsetX = offsetX.current; const oldOffsetY = offsetY.current; @@ -627,63 +505,27 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< ); /** - * Used to debug pinch events - * @param gestureResponderEvent - * @param zoomCenter - * @param points - */ - const _setPinchDebugPoints = useLatestCallback( - ( - gestureResponderEvent: GestureResponderEvent, - zoomCenter: Vec2D, - ...points: Vec2D[] - ) => { - const { touches } = gestureResponderEvent.nativeEvent; - - setDebugPoints([ - { - x: touches[0].pageX - originalPageX, - y: touches[0].pageY - originalPageY, - }, - { - x: touches[1].pageX - originalPageX, - y: touches[1].pageY - originalPageY, - }, - zoomCenter, - ...points, - ]); - } - ); - - /** - * Calculates the amount the offset should shift since the last position during panning - * - * @param {Vec2D} gestureCenterPoint + * Set the state to offset moved * - * @private + * @param {number} newOffsetX + * @param {number} newOffsetY + * @returns */ - const _calcOffsetShiftSinceLastGestureState = useLatestCallback( - (gestureCenterPoint: Vec2D) => { - const { movementSensibility } = props; - - let shift = null; - - if (lastGestureCenterPosition.current && movementSensibility) { - const dx = gestureCenterPoint.x - lastGestureCenterPosition.current.x; - const dy = gestureCenterPoint.y - lastGestureCenterPosition.current.y; - - const shiftX = dx / zoomLevel.current / movementSensibility; - const shiftY = dy / zoomLevel.current / movementSensibility; + const _setNewOffsetPosition = useLatestCallback( + (newOffsetX: number, newOffsetY: number) => { + const { onShiftingBefore, onShiftingAfter } = props; - shift = { - x: shiftX, - y: shiftY, - }; + if (onShiftingBefore?.(null, null, _getZoomableViewEventObject())) { + return; } - lastGestureCenterPosition.current = gestureCenterPoint; + offsetX.current = newOffsetX; + offsetY.current = newOffsetY; - return shift; + panAnim.current.setValue({ x: offsetX.current, y: offsetY.current }); + zoomAnim.current.setValue(zoomLevel.current); + + onShiftingAfter?.(null, null, _getZoomableViewEventObject()); } ); @@ -724,30 +566,104 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< ); /** - * Set the state to offset moved + * Zooms to a specific level. A "zoom center" can be provided, which specifies + * the point that will remain in the same position on the screen after the zoom. + * The coordinates of the zoom center is relative to the zoom subject. + * { x: 0, y: 0 } is the very center of the zoom subject. * - * @param {number} newOffsetX - * @param {number} newOffsetY - * @returns + * @param newZoomLevel + * @param zoomCenter - If not supplied, the container's center is the zoom center */ - const _setNewOffsetPosition = useLatestCallback( - (newOffsetX: number, newOffsetY: number) => { - const { onShiftingBefore, onShiftingAfter } = props; + const publicZoomTo = useLatestCallback( + (newZoomLevel: number, zoomCenter?: Vec2D) => { + if (!props.zoomEnabled) return false; + if (props.maxZoom && newZoomLevel > props.maxZoom) return false; + if (props.minZoom && newZoomLevel < props.minZoom) return false; - if (onShiftingBefore?.(null, null, _getZoomableViewEventObject())) { - return; - } + props.onZoomBefore?.(null, null, _getZoomableViewEventObject()); - offsetX.current = newOffsetX; - offsetY.current = newOffsetY; + // == Perform Pan Animation to preserve the zoom center while zooming == + let listenerId = ''; + if (zoomCenter) { + // Calculates panAnim values based on changes in zoomAnim. + let prevScale = zoomLevel.current; + // Since zoomAnim is calculated in native driver, + // it will jitter panAnim once in a while, + // because here panAnim is being calculated in js. + // However the jittering should mostly occur in simulator. + listenerId = zoomAnim.current.addListener(({ value: newScale }) => { + panAnim.current.setValue({ + x: calcNewScaledOffsetForZoomCentering( + offsetX.current, + originalWidth, + prevScale, + newScale, + zoomCenter.x + ), + y: calcNewScaledOffsetForZoomCentering( + offsetY.current, + originalHeight, + prevScale, + newScale, + zoomCenter.y + ), + }); + prevScale = newScale; + }); + } - panAnim.current.setValue({ x: offsetX.current, y: offsetY.current }); - zoomAnim.current.setValue(zoomLevel.current); + // == Perform Zoom Animation == + getZoomToAnimation(zoomAnim.current, newZoomLevel).start(() => { + zoomAnim.current.removeListener(listenerId); + }); + // == Zoom Animation Ends == - onShiftingAfter?.(null, null, _getZoomableViewEventObject()); + props.onZoomAfter?.(null, null, _getZoomableViewEventObject()); + return true; } ); + /** + * Handles the double tap event + * + * @param e + * + * @private + */ + const _handleDoubleTap = useLatestCallback((e: GestureResponderEvent) => { + const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } = + props; + + onDoubleTapBefore?.(e, _getZoomableViewEventObject()); + + const nextZoomStep = getNextZoomStep({ + zoomLevel: zoomLevel.current, + zoomStep: props.zoomStep, + maxZoom: props.maxZoom, + initialZoom: props.initialZoom, + }); + if (nextZoomStep == null) return; + + // define new zoom position coordinates + const zoomPositionCoordinates = { + x: e.nativeEvent.pageX - originalPageX, + y: e.nativeEvent.pageY - originalPageY, + }; + + // if doubleTapZoomToCenter enabled -> always zoom to center instead + if (doubleTapZoomToCenter) { + zoomPositionCoordinates.x = 0; + zoomPositionCoordinates.y = 0; + } + + publicZoomTo(nextZoomStep, zoomPositionCoordinates); + + onDoubleTapAfter?.( + e, + _getZoomableViewEventObject({ zoomLevel: nextZoomStep }) + ); + }); + /** * Check whether the press event is double tap * or single tap and handle the event accordingly @@ -840,178 +756,21 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< } ); - const _staticPinPosition = useLatestCallback(() => { - if (!props.staticPinPosition) return; - if (!props.contentWidth || !props.contentHeight) return; - - return viewportPositionToImagePosition({ - viewportPosition: { - x: props.staticPinPosition.x, - y: props.staticPinPosition.y, - }, - imageSize: { - height: props.contentHeight, - width: props.contentWidth, - }, - zoomableEvent: { - ..._getZoomableViewEventObject(), - offsetX: offsetX.current, - offsetY: offsetY.current, - zoomLevel: zoomLevel.current, - }, - }); - }); - - const _updateStaticPin = useLatestCallback(() => { - const position = _staticPinPosition(); - if (!position) return; - props.onStaticPinPositionChange?.(position); - }); - - const _addTouch = useLatestCallback((touch: TouchPoint) => { - touches.current.push(touch); - setStateTouches([...touches.current]); - }); - - const _removeTouch = useLatestCallback((touch: TouchPoint) => { - touches.current.splice(touches.current.indexOf(touch), 1); - setStateTouches([...touches.current]); - }); - - /** - * Handles the double tap event - * - * @param e - * - * @private - */ - const _handleDoubleTap = useLatestCallback((e: GestureResponderEvent) => { - const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } = - props; - - onDoubleTapBefore?.(e, _getZoomableViewEventObject()); - - const nextZoomStep = _getNextZoomStep(); - if (nextZoomStep == null) return; - - // define new zoom position coordinates - const zoomPositionCoordinates = { - x: e.nativeEvent.pageX - originalPageX, - y: e.nativeEvent.pageY - originalPageY, - }; - - // if doubleTapZoomToCenter enabled -> always zoom to center instead - if (doubleTapZoomToCenter) { - zoomPositionCoordinates.x = 0; - zoomPositionCoordinates.y = 0; - } - - publicZoomTo(nextZoomStep, zoomPositionCoordinates); - - onDoubleTapAfter?.( - e, - _getZoomableViewEventObject({ zoomLevel: nextZoomStep }) - ); - }); - - /** - * Returns the next zoom step based on current step and zoomStep property. - * If we are zoomed all the way in -> return to initialzoom - * - * @returns {*} - */ - const _getNextZoomStep = useLatestCallback(() => { - const { zoomStep, maxZoom, initialZoom } = props; - - if (maxZoom == null) return; - - if (zoomLevel.current.toFixed(2) === maxZoom.toFixed(2)) { - return initialZoom; - } - - if (zoomStep == null) return; - - const nextZoomStep = zoomLevel.current * (1 + zoomStep); - if (nextZoomStep > maxZoom) { - return maxZoom; - } - - return nextZoomStep; - }); - - /** - * Zooms to a specific level. A "zoom center" can be provided, which specifies - * the point that will remain in the same position on the screen after the zoom. - * The coordinates of the zoom center is relative to the zoom subject. - * { x: 0, y: 0 } is the very center of the zoom subject. - * - * @param newZoomLevel - * @param zoomCenter - If not supplied, the container's center is the zoom center - */ - const publicZoomTo = useLatestCallback( - (newZoomLevel: number, zoomCenter?: Vec2D) => { - if (!props.zoomEnabled) return false; - if (props.maxZoom && newZoomLevel > props.maxZoom) return false; - if (props.minZoom && newZoomLevel < props.minZoom) return false; - - props.onZoomBefore?.(null, null, _getZoomableViewEventObject()); - - // == Perform Pan Animation to preserve the zoom center while zooming == - let listenerId = ''; - if (zoomCenter) { - // Calculates panAnim values based on changes in zoomAnim. - let prevScale = zoomLevel.current; - // Since zoomAnim is calculated in native driver, - // it will jitter panAnim once in a while, - // because here panAnim is being calculated in js. - // However the jittering should mostly occur in simulator. - listenerId = zoomAnim.current.addListener(({ value: newScale }) => { - panAnim.current.setValue({ - x: calcNewScaledOffsetForZoomCentering( - offsetX.current, - originalWidth, - prevScale, - newScale, - zoomCenter.x - ), - y: calcNewScaledOffsetForZoomCentering( - offsetY.current, - originalHeight, - prevScale, - newScale, - zoomCenter.y - ), - }); - prevScale = newScale; - }); - } - - // == Perform Zoom Animation == - getZoomToAnimation(zoomAnim.current, newZoomLevel).start(() => { - zoomAnim.current.removeListener(listenerId); - }); - // == Zoom Animation Ends == - - props.onZoomAfter?.(null, null, _getZoomableViewEventObject()); - return true; - } - ); - - /** - * Zooms in or out by a specified change level - * Use a positive number for `zoomLevelChange` to zoom in - * Use a negative number for `zoomLevelChange` to zoom out - * - * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. - * - * @param {number | null} zoomLevelChange - * - * @return {bool} - */ - const publicZoomBy = useLatestCallback((zoomLevelChange: number) => { - // if no zoom level Change given -> just use zoom step - zoomLevelChange ||= props.zoomStep || 0; - return publicZoomTo(zoomLevel.current + zoomLevelChange); + /** + * Zooms in or out by a specified change level + * Use a positive number for `zoomLevelChange` to zoom in + * Use a negative number for `zoomLevelChange` to zoom out + * + * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits. + * + * @param {number | null} zoomLevelChange + * + * @return {bool} + */ + const publicZoomBy = useLatestCallback((zoomLevelChange: number) => { + // if no zoom level Change given -> just use zoom step + zoomLevelChange ||= props.zoomStep || 0; + return publicZoomTo(zoomLevel.current + zoomLevelChange); }); /** @@ -1068,19 +827,169 @@ const ReactNativeZoomableView: ForwardRefRenderFunction< }, })); - const { - staticPinIcon, - children, - visualTouchFeedbackEnabled, - doubleTapDelay, - staticPinPosition, - onStaticPinLongPress, - onStaticPinPress, - pinProps, - } = props; + /** + * Handles the end of touch events + * + * @param e + * @param gestureState + * + * @private + */ + const _handlePanResponderEnd: NonNullable< + PanResponderCallbacks['onPanResponderEnd'] + > = useLatestCallback((e, gestureState) => { + if (!gestureType.current) { + _resolveAndHandleTap(e); + } + + setDebugPoints([]); + + lastGestureCenterPosition.current = null; + + if (longPressTimeout.current) { + clearTimeout(longPressTimeout.current); + longPressTimeout.current = undefined; + } + + props.onPanResponderEnd?.(e, gestureState, _getZoomableViewEventObject()); + + if (gestureType.current === 'pinch') { + props.onZoomEnd?.(e, gestureState, _getZoomableViewEventObject()); + } else if (gestureType.current === 'shift') { + props.onShiftingEnd?.(e, gestureState, _getZoomableViewEventObject()); + } + + if (props.staticPinPosition) { + _updateStaticPin(); + } + + gestureType.current = undefined; + gestureStarted.current = false; + }); + + /** + * Handles the actual movement of our pan responder + * + * @param e + * @param gestureState + * + * @private + */ + const _handlePanResponderMove = useLatestCallback( + (e: GestureResponderEvent, gestureState: PanResponderGestureState) => { + if (props.onPanResponderMove) { + if ( + props.onPanResponderMove( + e, + gestureState, + _getZoomableViewEventObject() + ) + ) { + return false; + } + } + + // Only supports 2 touches and below, + // any invalid number will cause the gesture to end. + if (gestureState.numberActiveTouches <= 2) { + if (!gestureStarted.current) { + _handlePanResponderGrant(e, gestureState); + } + } else { + if (gestureStarted.current) { + _handlePanResponderEnd(e, gestureState); + } + return true; + } + + if (gestureState.numberActiveTouches === 2) { + if (longPressTimeout.current) { + clearTimeout(longPressTimeout.current); + longPressTimeout.current = undefined; + } + + // change some measurement states when switching gesture to ensure a smooth transition + if (gestureType.current !== 'pinch') { + lastGestureCenterPosition.current = calcGestureCenterPoint( + e, + gestureState + ); + lastGestureTouchDistance.current = calcGestureTouchDistance( + e, + gestureState + ); + } + gestureType.current = 'pinch'; + _handlePinching(e, gestureState); + } else if (gestureState.numberActiveTouches === 1) { + if ( + longPressTimeout.current && + (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5) + ) { + clearTimeout(longPressTimeout.current); + longPressTimeout.current = undefined; + } + // change some measurement states when switching gesture to ensure a smooth transition + if (gestureType.current !== 'shift') { + lastGestureCenterPosition.current = calcGestureCenterPoint( + e, + gestureState + ); + } + + const { dx, dy } = gestureState; + const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; + if (isShiftGesture) { + gestureType.current = 'shift'; + _handleShifting(gestureState); + } + } + } + ); + + useLayoutEffect(() => { + gestureHandlers.current = PanResponder.create({ + onStartShouldSetPanResponder: _handleStartShouldSetPanResponder, + onPanResponderGrant: _handlePanResponderGrant, + onPanResponderMove: _handlePanResponderMove, + onPanResponderRelease: _handlePanResponderEnd, + onPanResponderTerminate: (evt, gestureState) => { + // We should also call _handlePanResponderEnd + // to properly perform cleanups when the gesture is terminated + // (aka gesture handling responsibility is taken over by another component). + // This also fixes a weird issue where + // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, + // but onPanResponderTerminate is called instead for no apparent reason. + _handlePanResponderEnd(evt, gestureState); + props.onPanResponderTerminate?.( + evt, + gestureState, + _getZoomableViewEventObject() + ); + }, + onPanResponderTerminationRequest: (evt, gestureState) => + !!props.onPanResponderTerminationRequest?.( + evt, + gestureState, + _getZoomableViewEventObject() + ), + // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. + onShouldBlockNativeResponder: (evt, gestureState) => + props.onShouldBlockNativeResponder?.( + evt, + gestureState, + _getZoomableViewEventObject() + ) ?? true, + onStartShouldSetPanResponderCapture: (evt, gestureState) => + !!props.onStartShouldSetPanResponderCapture?.(evt, gestureState), + onMoveShouldSetPanResponderCapture: (evt, gestureState) => + !!props.onMoveShouldSetPanResponderCapture?.(evt, gestureState), + }); + }, []); return ( {staticPinIcon || ( - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment,@typescript-eslint/no-use-before-define )} diff --git a/src/debugHelper/index.tsx b/src/debugHelper/index.tsx index d9a3f7d..d088b9b 100644 --- a/src/debugHelper/index.tsx +++ b/src/debugHelper/index.tsx @@ -11,6 +11,7 @@ export const DebugTouchPoint = ({ return ( return to initialzoom + * + * @returns {*} + */ +export const getNextZoomStep = ({ + zoomStep, + maxZoom, + initialZoom, + zoomLevel, +}: { + zoomStep: number | undefined; + maxZoom: number | undefined; + initialZoom: number | undefined; + zoomLevel: number; +}) => { + if (maxZoom == null) return; + + if (zoomLevel.toFixed(2) === maxZoom.toFixed(2)) { + return initialZoom; + } + + if (zoomStep == null) return; + + const nextZoomStep = zoomLevel * (1 + zoomStep); + if (nextZoomStep > maxZoom) { + return maxZoom; + } + + return nextZoomStep; +}; diff --git a/src/hooks/useDebugPoints.ts b/src/hooks/useDebugPoints.ts new file mode 100644 index 0000000..5f6b736 --- /dev/null +++ b/src/hooks/useDebugPoints.ts @@ -0,0 +1,46 @@ +import { useState } from 'react'; +import { GestureResponderEvent } from 'react-native'; + +import { Vec2D } from '../typings'; +import { useLatestCallback } from './useLatestCallback'; + +export const useDebugPoints = ({ + originalPageX, + originalPageY, +}: { + originalPageX: number; + originalPageY: number; +}) => { + const [debugPoints, setDebugPoints] = useState([]); + + /** + * Used to debug pinch events + * @param gestureResponderEvent + * @param zoomCenter + * @param points + */ + const setPinchDebugPoints = useLatestCallback( + ( + gestureResponderEvent: GestureResponderEvent, + zoomCenter: Vec2D, + ...points: Vec2D[] + ) => { + const { touches } = gestureResponderEvent.nativeEvent; + + setDebugPoints([ + { + x: touches[0].pageX - originalPageX, + y: touches[0].pageY - originalPageY, + }, + { + x: touches[1].pageX - originalPageX, + y: touches[1].pageY - originalPageY, + }, + zoomCenter, + ...points, + ]); + } + ); + + return { debugPoints, setDebugPoints, setPinchDebugPoints }; +}; diff --git a/src/hooks/useZoomSubject.ts b/src/hooks/useZoomSubject.ts new file mode 100644 index 0000000..c1f6526 --- /dev/null +++ b/src/hooks/useZoomSubject.ts @@ -0,0 +1,78 @@ +import { useEffect, useRef, useState } from 'react'; +import { View } from 'react-native'; + +import { useLatestCallback } from './useLatestCallback'; + +export const useZoomSubject = () => { + const wrapperRef = useRef(null); + const [originalWidth, setOriginalWidth] = useState(0); + const [originalHeight, setOriginalHeight] = useState(0); + const [originalPageX, setOriginalPageX] = useState(0); + const [originalPageY, setOriginalPageY] = useState(0); + const [originalX, setOriginalX] = useState(0); + const [originalY, setOriginalY] = useState(0); + const measureZoomSubjectInterval = useRef(); + + /** + * Get the original box dimensions and save them for later use. + * (They will be used to calculate boxBorders) + * + * @private + */ + const measure = useLatestCallback(() => { + // make sure we measure after animations are complete + requestAnimationFrame(() => { + // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0` + // when navigating back (react-navigation stack) from another view + // while closing the keyboard at the same time + setTimeout(() => { + // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper. + // However, our zoomSubject may have been transformed by an initial zoomLevel or offset, + // in which case these measurements will not represent the true "original" measurements. + // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject + // (no border, space, or anything between them) + wrapperRef.current?.measure((x, y, width, height, pageX, pageY) => { + // When the component is off-screen, these become all 0s, so we don't set them + // to avoid messing up calculations, especially ones that are done right after + // the component transitions from hidden to visible. + if (!pageX && !pageY && !width && !height) return; + + setOriginalX(x); + setOriginalY(y); + setOriginalWidth(width); + setOriginalHeight(height); + setOriginalPageX(pageX); + setOriginalPageY(pageY); + }); + }); + }); + }); + + useEffect(() => { + measure(); + // We've already run `grabZoomSubjectOriginalMeasurements` at various events + // to make sure the measurements are promptly updated. + // However, there might be cases we haven't accounted for, especially when + // native processes are involved. To account for those cases, + // we'll use an interval here to ensure we're always up-to-date. + // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender + // if the values given haven't changed, so we're not running performance risk here. + measureZoomSubjectInterval.current = setInterval(measure, 1e3); + + return () => { + measureZoomSubjectInterval.current && + clearInterval(measureZoomSubjectInterval.current); + }; + }, []); + + return { + wrapperRef, + measure, + originalWidth, + originalHeight, + originalPageX, + originalPageY, + originalX, + originalY, + }; +};