diff --git a/lib/commonjs/ReactNativeZoomableView.js b/lib/commonjs/ReactNativeZoomableView.js index cd0ced3..a682c4b 100644 --- a/lib/commonjs/ReactNativeZoomableView.js +++ b/lib/commonjs/ReactNativeZoomableView.js @@ -4,35 +4,18 @@ 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 _applyPanBoundariesToOffset = require("./helper/applyPanBoundariesToOffset"); - var _coordinateConversion = require("./helper/coordinateConversion"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } - +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 initialState = { originalWidth: 0, originalHeight: 0, @@ -45,380 +28,77 @@ const initialState = { height: 0 } }; - class ReactNativeZoomableView extends _react.Component { + static defaultProps = { + zoomEnabled: true, + panEnabled: true, + initialZoom: 1, + initialOffsetX: 0, + initialOffsetY: 0, + maxZoom: 1.5, + minZoom: 0.5, + pinchToZoomInSensitivity: 1, + pinchToZoomOutSensitivity: 1, + movementSensibility: 1, + doubleTapDelay: 300, + bindToBorders: true, + zoomStep: 0.5, + onLongPress: null, + longPressDuration: 700, + contentWidth: undefined, + contentHeight: undefined, + panBoundaryPadding: 0, + visualTouchFeedbackEnabled: true, + staticPinPosition: undefined, + staticPinIcon: undefined, + onStaticPinPositionChange: undefined, + onStaticPinPositionMove: undefined, + animatePin: true, + disablePanOnInitialZoom: false + }; + panAnim = new _reactNative.Animated.ValueXY({ + x: 0, + y: 0 + }); + zoomAnim = new _reactNative.Animated.Value(1); + pinAnim = new _reactNative.Animated.ValueXY({ + x: 0, + y: 0 + }); + __offsets = { + x: { + value: 0, + boundaryCrossedAnimInEffect: false + }, + y: { + value: 0, + boundaryCrossedAnimInEffect: false + } + }; + zoomLevel = 1; + lastGestureCenterPosition = null; + lastGestureTouchDistance = null; + _gestureStarted = false; set gestureStarted(v) { this._gestureStarted = v; } - get gestureStarted() { return this._gestureStarted; } + /** * Last press time (used to evaluate whether user double tapped) * @type {number} */ - - + longPressTimeout = null; + touches = []; constructor(props) { - super(props); // This needs to be done before anything else to initialize the state. + super(props); + // This needs to be done before anything else to initialize the state. // Otherwise, the logic below may reference the state when it's undefined, // causing runtime errors. - - _defineProperty(this, "zoomSubjectWrapperRef", void 0); - - _defineProperty(this, "gestureHandlers", void 0); - - _defineProperty(this, "doubleTapFirstTapReleaseTimestamp", void 0); - - _defineProperty(this, "panAnim", new _reactNative.Animated.ValueXY({ - x: 0, - y: 0 - })); - - _defineProperty(this, "zoomAnim", new _reactNative.Animated.Value(1)); - - _defineProperty(this, "pinAnim", new _reactNative.Animated.ValueXY({ - x: 0, - y: 0 - })); - - _defineProperty(this, "__offsets", { - x: { - value: 0, - boundaryCrossedAnimInEffect: false - }, - y: { - value: 0, - boundaryCrossedAnimInEffect: false - } - }); - - _defineProperty(this, "zoomLevel", 1); - - _defineProperty(this, "lastGestureCenterPosition", null); - - _defineProperty(this, "lastGestureTouchDistance", null); - - _defineProperty(this, "gestureType", void 0); - - _defineProperty(this, "_gestureStarted", false); - - _defineProperty(this, "longPressTimeout", null); - - _defineProperty(this, "onTransformInvocationInitialized", void 0); - - _defineProperty(this, "singleTapTimeoutId", void 0); - - _defineProperty(this, "touches", []); - - _defineProperty(this, "doubleTapFirstTap", void 0); - - _defineProperty(this, "measureZoomSubjectInterval", void 0); - - _defineProperty(this, "debouncedOnStaticPinPositionChange", (0, _lodash.debounce)(position => { - var _this$props$onStaticP, _this$props; - - return (_this$props$onStaticP = (_this$props = this.props).onStaticPinPositionChange) === null || _this$props$onStaticP === void 0 ? void 0 : _this$props$onStaticP.call(_this$props, position); - }, 100)); - - _defineProperty(this, "measureZoomSubject", () => { - // 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(() => { - var _this$zoomSubjectWrap; - - // 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) - (_this$zoomSubjectWrap = this.zoomSubjectWrapperRef.current) === null || _this$zoomSubjectWrap === void 0 ? void 0 : _this$zoomSubjectWrap.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; // If these values are all the same, don't re-set them in state - // this way we don't re-render - - if (this.state.originalX === x && this.state.originalY === y && this.state.originalWidth === width && this.state.originalHeight === height && this.state.originalPageX === pageX && this.state.originalPageY === pageY) { - return; - } - - this.setState({ - originalX: x, - originalY: y, - originalWidth: width, - originalHeight: height, - originalPageX: pageX, - originalPageY: pageY - }); - }); - }); - }); - }); - - _defineProperty(this, "_handleStartShouldSetPanResponder", (e, gestureState) => { - if (this.props.onStartShouldSetPanResponder) { - this.props.onStartShouldSetPanResponder(e, gestureState, this._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; - }); - - _defineProperty(this, "_handlePanResponderGrant", (e, gestureState) => { - var _this$props$onPanResp, _this$props3; - - if (this.props.onLongPress) { - e.persist(); - this.longPressTimeout = setTimeout(() => { - var _this$props$onLongPre, _this$props2; - - (_this$props$onLongPre = (_this$props2 = this.props).onLongPress) === null || _this$props$onLongPre === void 0 ? void 0 : _this$props$onLongPre.call(_this$props2, e, gestureState, this._getZoomableViewEventObject()); - this.longPressTimeout = null; - }, this.props.longPressDuration); - } - - (_this$props$onPanResp = (_this$props3 = this.props).onPanResponderGrant) === null || _this$props$onPanResp === void 0 ? void 0 : _this$props$onPanResp.call(_this$props3, e, gestureState, this._getZoomableViewEventObject()); - this.panAnim.stopAnimation(); - this.zoomAnim.stopAnimation(); - this.gestureStarted = true; - this.raisePin(); - }); - - _defineProperty(this, "_handlePanResponderEnd", (e, gestureState) => { - var _this$props$onPanResp2, _this$props4; - - if (!this.gestureType) { - this._resolveAndHandleTap(e); - } - - this.setState({ - debugPoints: [] - }); - this.lastGestureCenterPosition = null; - const disableMomentum = this.props.disableMomentum || this.props.panEnabled && this.gestureType === 'shift' && this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom; // Trigger final shift animation unless disablePanOnInitialZoom is set and we're on the initial zoom level - // or disableMomentum - - if (!disableMomentum) { - (0, _animations.getPanMomentumDecayAnim)(this.panAnim, { - x: gestureState.vx / this.zoomLevel, - y: gestureState.vy / this.zoomLevel - }).start(); - } - - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } - - (_this$props$onPanResp2 = (_this$props4 = this.props).onPanResponderEnd) === null || _this$props$onPanResp2 === void 0 ? void 0 : _this$props$onPanResp2.call(_this$props4, e, gestureState, this._getZoomableViewEventObject()); - - if (this.gestureType === 'pinch') { - var _this$props$onZoomEnd, _this$props5; - - (_this$props$onZoomEnd = (_this$props5 = this.props).onZoomEnd) === null || _this$props$onZoomEnd === void 0 ? void 0 : _this$props$onZoomEnd.call(_this$props5, e, gestureState, this._getZoomableViewEventObject()); - } else if (this.gestureType === 'shift') { - var _this$props$onShiftin, _this$props6; - - (_this$props$onShiftin = (_this$props6 = this.props).onShiftingEnd) === null || _this$props$onShiftin === void 0 ? void 0 : _this$props$onShiftin.call(_this$props6, e, gestureState, this._getZoomableViewEventObject()); - } - - if (this.props.staticPinPosition) { - this._updateStaticPin(); - } - - this.dropPin(); - this.gestureType = null; - this.gestureStarted = false; - }); - - _defineProperty(this, "_handlePanResponderMove", (e, gestureState) => { - if (this.props.onPanResponderMove) { - if (this.props.onPanResponderMove(e, gestureState, this._getZoomableViewEventObject())) { - return false; - } - } // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - - - if (gestureState.numberActiveTouches <= 2) { - if (!this.gestureStarted) { - this._handlePanResponderGrant(e, gestureState); - } - } else { - if (this.gestureStarted) { - this._handlePanResponderEnd(e, gestureState); - } - - return true; - } - - if (gestureState.numberActiveTouches === 2) { - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'pinch') { - this.lastGestureCenterPosition = (0, _helper.calcGestureCenterPoint)(e, gestureState); - this.lastGestureTouchDistance = (0, _helper.calcGestureTouchDistance)(e, gestureState); - } - - this.gestureType = 'pinch'; - - this._handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if (this.longPressTimeout && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'shift') { - this.lastGestureCenterPosition = (0, _helper.calcGestureCenterPoint)(e, gestureState); - } - - const { - dx, - dy - } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - - if (isShiftGesture) { - this.gestureType = 'shift'; - - this._handleShifting(gestureState); - } - } - }); - - _defineProperty(this, "_resolveAndHandleTap", e => { - const now = Date.now(); - - if (this.doubleTapFirstTapReleaseTimestamp && this.props.doubleTapDelay && now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay) { - this.doubleTapFirstTap && this._addTouch({ ...this.doubleTapFirstTap, - id: now.toString(), - isSecondTap: true - }); - this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; - delete this.doubleTapFirstTap; - - this._handleDoubleTap(e); - } else { - this.doubleTapFirstTapReleaseTimestamp = now; - this.doubleTapFirstTap = { - id: now.toString(), - x: e.nativeEvent.pageX - this.state.originalPageX, - y: e.nativeEvent.pageY - this.state.originalPageY - }; - - this._addTouch(this.doubleTapFirstTap); // persist event so e.nativeEvent is preserved after a timeout delay - - - e.persist(); - this.singleTapTimeoutId = setTimeout(() => { - var _this$props$onSingleT, _this$props7; - - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; // Pan to the tapped location - - if (this.props.staticPinPosition && this.doubleTapFirstTap) { - const tapX = this.props.staticPinPosition.x - this.doubleTapFirstTap.x; - const tapY = this.props.staticPinPosition.y - this.doubleTapFirstTap.y; - - _reactNative.Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX + tapX / this.zoomLevel, - y: this.offsetY + tapY / this.zoomLevel - }, - useNativeDriver: true, - duration: 200 - }).start(() => { - this._updateStaticPin(); - }); - } - - (_this$props$onSingleT = (_this$props7 = this.props).onSingleTap) === null || _this$props$onSingleT === void 0 ? void 0 : _this$props$onSingleT.call(_this$props7, e, this._getZoomableViewEventObject()); - }, this.props.doubleTapDelay); - } - }); - - _defineProperty(this, "moveStaticPinTo", (position, duration) => { - const { - originalWidth, - originalHeight - } = this.state; - const { - staticPinPosition, - contentWidth, - contentHeight - } = this.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; - this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; - this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; - - if (duration) { - _reactNative.Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX, - y: this.offsetY - }, - useNativeDriver: true, - duration - }).start(); - } else { - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - } - }); - - _defineProperty(this, "_staticPinPosition", () => { - if (!this.props.staticPinPosition) return; - if (!this.props.contentWidth || !this.props.contentHeight) return; - return (0, _coordinateConversion.viewportPositionToImagePosition)({ - viewportPosition: { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y - }, - imageSize: { - height: this.props.contentHeight, - width: this.props.contentWidth - }, - zoomableEvent: { ...this._getZoomableViewEventObject(), - offsetX: this.offsetX, - offsetY: this.offsetY, - zoomLevel: this.zoomLevel - } - }); - }); - - _defineProperty(this, "_updateStaticPin", () => { - var _this$props$onStaticP2, _this$props8; - - const position = this._staticPinPosition(); - - if (!position) return; - (_this$props$onStaticP2 = (_this$props8 = this.props).onStaticPinPositionChange) === null || _this$props$onStaticP2 === void 0 ? void 0 : _this$props$onStaticP2.call(_this$props8, position); - }); - - this.state = { ...initialState + this.state = { + ...initialState }; this.gestureHandlers = _reactNative.PanResponder.create({ onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, @@ -426,8 +106,6 @@ class ReactNativeZoomableView extends _react.Component { onPanResponderMove: this._handlePanResponderMove, onPanResponderRelease: this._handlePanResponderEnd, onPanResponderTerminate: (evt, gestureState) => { - var _this$props$onPanResp3, _this$props9; - // We should also call _handlePanResponderEnd // to properly perform cleanups when the gesture is terminated // (aka gesture handling responsibility is taken over by another component). @@ -435,30 +113,13 @@ class ReactNativeZoomableView extends _react.Component { // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, // but onPanResponderTerminate is called instead for no apparent reason. this._handlePanResponderEnd(evt, gestureState); - - (_this$props$onPanResp3 = (_this$props9 = this.props).onPanResponderTerminate) === null || _this$props$onPanResp3 === void 0 ? void 0 : _this$props$onPanResp3.call(_this$props9, evt, gestureState, this._getZoomableViewEventObject()); - }, - onPanResponderTerminationRequest: (evt, gestureState) => { - var _this$props$onPanResp4, _this$props10; - - return !!((_this$props$onPanResp4 = (_this$props10 = this.props).onPanResponderTerminationRequest) !== null && _this$props$onPanResp4 !== void 0 && _this$props$onPanResp4.call(_this$props10, evt, gestureState, this._getZoomableViewEventObject())); + this.props.onPanResponderTerminate?.(evt, gestureState, this._getZoomableViewEventObject()); }, + onPanResponderTerminationRequest: (evt, gestureState) => !!this.props.onPanResponderTerminationRequest?.(evt, gestureState, this._getZoomableViewEventObject()), // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => { - var _this$props$onShouldB, _this$props$onShouldB2, _this$props11; - - return (_this$props$onShouldB = (_this$props$onShouldB2 = (_this$props11 = this.props).onShouldBlockNativeResponder) === null || _this$props$onShouldB2 === void 0 ? void 0 : _this$props$onShouldB2.call(_this$props11, evt, gestureState, this._getZoomableViewEventObject())) !== null && _this$props$onShouldB !== void 0 ? _this$props$onShouldB : true; - }, - onStartShouldSetPanResponderCapture: (evt, gestureState) => { - var _this$props$onStartSh, _this$props12; - - return !!((_this$props$onStartSh = (_this$props12 = this.props).onStartShouldSetPanResponderCapture) !== null && _this$props$onStartSh !== void 0 && _this$props$onStartSh.call(_this$props12, evt, gestureState)); - }, - onMoveShouldSetPanResponderCapture: (evt, gestureState) => { - var _this$props$onMoveSho, _this$props13; - - return !!((_this$props$onMoveSho = (_this$props13 = this.props).onMoveShouldSetPanResponderCapture) !== null && _this$props$onMoveSho !== void 0 && _this$props$onMoveSho.call(_this$props13, evt, gestureState)); - } + onShouldBlockNativeResponder: (evt, gestureState) => this.props.onShouldBlockNativeResponder?.(evt, gestureState, this._getZoomableViewEventObject()) ?? true, + onStartShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState), + onMoveShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState) }); this.zoomSubjectWrapperRef = /*#__PURE__*/(0, _react.createRef)(); if (this.props.zoomAnimatedValue) this.zoomAnim = this.props.zoomAnimatedValue; @@ -486,10 +147,8 @@ class ReactNativeZoomableView extends _react.Component { this.lastGestureTouchDistance = 150; this.gestureType = null; } - raisePin() { if (!this.props.animatePin) return; - _reactNative.Animated.timing(this.pinAnim, { toValue: { x: 0, @@ -500,10 +159,8 @@ class ReactNativeZoomableView extends _react.Component { duration: 100 }).start(); } - dropPin() { if (!this.props.animatePin) return; - _reactNative.Animated.timing(this.pinAnim, { toValue: { x: 0, @@ -514,34 +171,26 @@ class ReactNativeZoomableView extends _react.Component { duration: 100 }).start(); } - set offsetX(x) { this.__setOffset('x', x); } - set offsetY(y) { this.__setOffset('y', y); } - get offsetX() { return this.__getOffset('x'); } - get offsetY() { return this.__getOffset('y'); } - __setOffset(axis, offset) { const offsetState = this.__offsets[axis]; - if (this.props.bindToBorders) { const containerSize = axis === 'x' ? this.state.originalWidth : this.state.originalHeight; const contentSize = axis === 'x' ? this.props.contentWidth || this.state.originalWidth : this.props.contentHeight || this.state.originalHeight; const boundOffset = contentSize && containerSize && this.props.panBoundaryPadding != null ? (0, _applyPanBoundariesToOffset.applyPanBoundariesToOffset)(offset, containerSize, contentSize, this.zoomLevel, this.props.panBoundaryPadding) : offset; - if (!this.gestureType && !offsetState.boundaryCrossedAnimInEffect) { const boundariesApplied = boundOffset !== offset && boundOffset.toFixed(3) !== offset.toFixed(3); - if (boundariesApplied) { offsetState.boundaryCrossedAnimInEffect = true; (0, _animations.getBoundaryCrossedAnim)(this.panAnim[axis], boundOffset).start(() => { @@ -551,111 +200,91 @@ class ReactNativeZoomableView extends _react.Component { } } } - offsetState.value = offset; } - __getOffset(axis) { return this.__offsets[axis].value; } - componentDidUpdate(prevProps, prevState) { - var _prevProps$staticPinP, _this$props$staticPin, _prevProps$staticPinP2, _this$props$staticPin2; - const { zoomEnabled, initialZoom } = this.props; - if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) { this.zoomLevel = initialZoom; this.zoomAnim.setValue(this.zoomLevel); } - if (!this.onTransformInvocationInitialized && this._invokeOnTransform().successful) { this.panAnim.addListener(() => this._invokeOnTransform()); this.zoomAnim.addListener(() => this._invokeOnTransform()); this.onTransformInvocationInitialized = true; } - const currState = this.state; const originalMeasurementsChanged = currState.originalHeight !== prevState.originalHeight || currState.originalWidth !== prevState.originalWidth || currState.originalPageX !== prevState.originalPageX || currState.originalPageY !== prevState.originalPageY || currState.originalX !== prevState.originalX || currState.originalY !== prevState.originalY; - const staticPinPositionChanged = ((_prevProps$staticPinP = prevProps.staticPinPosition) === null || _prevProps$staticPinP === void 0 ? void 0 : _prevProps$staticPinP.x) !== ((_this$props$staticPin = this.props.staticPinPosition) === null || _this$props$staticPin === void 0 ? void 0 : _this$props$staticPin.x) || ((_prevProps$staticPinP2 = prevProps.staticPinPosition) === null || _prevProps$staticPinP2 === void 0 ? void 0 : _prevProps$staticPinP2.y) !== ((_this$props$staticPin2 = this.props.staticPinPosition) === null || _this$props$staticPin2 === void 0 ? void 0 : _this$props$staticPin2.y); // We use a custom `onLayout` event, so the clients can stay in-sync + const staticPinPositionChanged = prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x || prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y; + + // 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 - if (originalMeasurementsChanged) { - var _this$props$onLayout, _this$props14; - const layout = { width: currState.originalWidth, height: currState.originalHeight, x: currState.originalX, y: currState.originalY }; - (_this$props$onLayout = (_this$props14 = this.props).onLayout) === null || _this$props$onLayout === void 0 ? void 0 : _this$props$onLayout.call(_this$props14, { + this.props.onLayout?.({ nativeEvent: { layout } }); } - if (this.onTransformInvocationInitialized && (originalMeasurementsChanged || staticPinPositionChanged)) { this._invokeOnTransform(); } } - componentDidMount() { - this.measureZoomSubject(); // We've already run `grabZoomSubjectOriginalMeasurements` at various events + this.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. - this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3); } - componentWillUnmount() { this.measureZoomSubjectInterval && clearInterval(this.measureZoomSubjectInterval); } + debouncedOnStaticPinPositionChange = (0, _lodash.debounce)(position => this.props.onStaticPinPositionChange?.(position), 100); /** * try to invoke onTransform * @private */ _invokeOnTransform() { - var _this$props$onTransfo, _this$props15; - const zoomableViewEvent = this._getZoomableViewEventObject(); - const position = this._staticPinPosition(); - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { successful: false }; - (_this$props$onTransfo = (_this$props15 = this.props).onTransform) === null || _this$props$onTransfo === void 0 ? void 0 : _this$props$onTransfo.call(_this$props15, zoomableViewEvent); - + this.props.onTransform?.(zoomableViewEvent); if (position) { - var _this$props$onStaticP3, _this$props16; - - (_this$props$onStaticP3 = (_this$props16 = this.props).onStaticPinPositionMove) === null || _this$props$onStaticP3 === void 0 ? void 0 : _this$props$onStaticP3.call(_this$props16, position); + this.props.onStaticPinPositionMove?.(position); this.debouncedOnStaticPinPositionChange(position); } - return { successful: true }; } + /** * Returns additional information about components current state for external event hooks * * @returns {{}} * @private */ - - _getZoomableViewEventObject(overwriteObj = {}) { return { zoomLevel: this.zoomLevel, @@ -668,13 +297,196 @@ class ReactNativeZoomableView extends _react.Component { ...overwriteObj }; } + /** * Get the original box dimensions and save them for later use. * (They will be used to calculate boxBorders) * * @private */ + measureZoomSubject = () => { + // 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) + this.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; + + // If these values are all the same, don't re-set them in state + // this way we don't re-render + if (this.state.originalX === x && this.state.originalY === y && this.state.originalWidth === width && this.state.originalHeight === height && this.state.originalPageX === pageX && this.state.originalPageY === pageY) { + return; + } + this.setState({ + originalX: x, + originalY: y, + originalWidth: width, + originalHeight: height, + originalPageX: pageX, + originalPageY: pageY + }); + }); + }); + }); + }; + + /** + * Handles the start of touch events and checks for taps + * + * @param e + * @param gestureState + * @returns {boolean} + * + * @private + */ + _handleStartShouldSetPanResponder = (e, gestureState) => { + if (this.props.onStartShouldSetPanResponder) { + this.props.onStartShouldSetPanResponder(e, gestureState, this._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 + */ + _handlePanResponderGrant = (e, gestureState) => { + if (this.props.onLongPress) { + e.persist(); + this.longPressTimeout = setTimeout(() => { + this.props.onLongPress?.(e, gestureState, this._getZoomableViewEventObject()); + this.longPressTimeout = null; + }, this.props.longPressDuration); + } + this.props.onPanResponderGrant?.(e, gestureState, this._getZoomableViewEventObject()); + this.panAnim.stopAnimation(); + this.zoomAnim.stopAnimation(); + this.gestureStarted = true; + this.raisePin(); + }; + /** + * Handles the end of touch events + * + * @param e + * @param gestureState + * + * @private + */ + _handlePanResponderEnd = (e, gestureState) => { + if (!this.gestureType) { + this._resolveAndHandleTap(e); + } + this.setState({ + debugPoints: [] + }); + this.lastGestureCenterPosition = null; + const disableMomentum = this.props.disableMomentum || this.props.panEnabled && this.gestureType === 'shift' && this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom; + + // Trigger final shift animation unless disablePanOnInitialZoom is set and we're on the initial zoom level + // or disableMomentum + if (!disableMomentum) { + (0, _animations.getPanMomentumDecayAnim)(this.panAnim, { + x: gestureState.vx / this.zoomLevel, + y: gestureState.vy / this.zoomLevel + }).start(); + } + if (this.longPressTimeout) { + clearTimeout(this.longPressTimeout); + this.longPressTimeout = null; + } + this.props.onPanResponderEnd?.(e, gestureState, this._getZoomableViewEventObject()); + if (this.gestureType === 'pinch') { + this.props.onZoomEnd?.(e, gestureState, this._getZoomableViewEventObject()); + } else if (this.gestureType === 'shift') { + this.props.onShiftingEnd?.(e, gestureState, this._getZoomableViewEventObject()); + } + if (this.props.staticPinPosition) { + this._updateStaticPin(); + } + this.dropPin(); + this.gestureType = null; + this.gestureStarted = false; + }; + + /** + * Handles the actual movement of our pan responder + * + * @param e + * @param gestureState + * + * @private + */ + _handlePanResponderMove = (e, gestureState) => { + if (this.props.onPanResponderMove) { + if (this.props.onPanResponderMove(e, gestureState, this._getZoomableViewEventObject())) { + return false; + } + } + + // Only supports 2 touches and below, + // any invalid number will cause the gesture to end. + if (gestureState.numberActiveTouches <= 2) { + if (!this.gestureStarted) { + this._handlePanResponderGrant(e, gestureState); + } + } else { + if (this.gestureStarted) { + this._handlePanResponderEnd(e, gestureState); + } + return true; + } + if (gestureState.numberActiveTouches === 2) { + if (this.longPressTimeout) { + clearTimeout(this.longPressTimeout); + this.longPressTimeout = null; + } + + // change some measurement states when switching gesture to ensure a smooth transition + if (this.gestureType !== 'pinch') { + this.lastGestureCenterPosition = (0, _helper.calcGestureCenterPoint)(e, gestureState); + this.lastGestureTouchDistance = (0, _helper.calcGestureTouchDistance)(e, gestureState); + } + this.gestureType = 'pinch'; + this._handlePinching(e, gestureState); + } else if (gestureState.numberActiveTouches === 1) { + if (this.longPressTimeout && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { + clearTimeout(this.longPressTimeout); + this.longPressTimeout = null; + } + // change some measurement states when switching gesture to ensure a smooth transition + if (this.gestureType !== 'shift') { + this.lastGestureCenterPosition = (0, _helper.calcGestureCenterPoint)(e, gestureState); + } + const { + dx, + dy + } = gestureState; + const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; + if (isShiftGesture) { + this.gestureType = 'shift'; + this._handleShifting(gestureState); + } + } + }; /** * Handles the pinch movement and zooming @@ -685,8 +497,6 @@ class ReactNativeZoomableView extends _react.Component { * @private */ _handlePinching(e, gestureState) { - var _this$props$onZoomAft, _this$props17; - if (!this.props.zoomEnabled) return; const { maxZoom, @@ -695,39 +505,36 @@ class ReactNativeZoomableView extends _react.Component { pinchToZoomOutSensitivity } = this.props; const distance = (0, _helper.calcGestureTouchDistance)(e, gestureState); - if (this.props.onZoomBefore && this.props.onZoomBefore(e, gestureState, this._getZoomableViewEventObject())) { return; } - if (!distance) return; - if (!this.lastGestureTouchDistance) return; // define the new zoom level and take zoom level sensitivity into consideration + if (!this.lastGestureTouchDistance) return; + // define the new zoom level and take zoom level sensitivity into consideration const zoomGrowthFromLastGestureState = distance / this.lastGestureTouchDistance; this.lastGestureTouchDistance = distance; const pinchToZoomSensitivity = zoomGrowthFromLastGestureState < 1 ? pinchToZoomOutSensitivity : pinchToZoomInSensitivity; if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; // 0 - no resistance + const deltaGrowth = zoomGrowthFromLastGestureState - 1; + // 0 - no resistance // 10 - 90% resistance - const deltaGrowthAdjustedBySensitivity = deltaGrowth * (1 - pinchToZoomSensitivity * 9 / 100); - let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity); // make sure max and min zoom levels are respected + let newZoomLevel = this.zoomLevel * (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 - this.state.originalPageX, y: gestureCenterPoint.y - this.state.originalPageY }; - if (this.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. @@ -735,9 +542,9 @@ class ReactNativeZoomableView extends _react.Component { x: this.props.staticPinPosition.x, y: this.props.staticPinPosition.y }; - } // Uncomment to debug - + } + // Uncomment to debug this.props.debug && this._setPinchDebugPoints(e, zoomCenter); const { originalHeight, @@ -750,14 +557,11 @@ class ReactNativeZoomableView extends _react.Component { if (!originalHeight || !originalWidth) return; let offsetY = (0, _helper.calcNewScaledOffsetForZoomCentering)(oldOffsetY, originalHeight, oldScale, newScale, zoomCenter.y); let offsetX = (0, _helper.calcNewScaledOffsetForZoomCentering)(oldOffsetX, originalWidth, oldScale, newScale, zoomCenter.x); - const offsetShift = this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - if (offsetShift) { offsetX += offsetShift.x; offsetY += offsetShift.y; } - this.offsetX = offsetX; this.offsetY = offsetY; this.zoomLevel = newScale; @@ -766,16 +570,15 @@ class ReactNativeZoomableView extends _react.Component { y: this.offsetY }); this.zoomAnim.setValue(this.zoomLevel); - (_this$props$onZoomAft = (_this$props17 = this.props).onZoomAfter) === null || _this$props$onZoomAft === void 0 ? void 0 : _this$props$onZoomAft.call(_this$props17, e, gestureState, this._getZoomableViewEventObject()); + this.props.onZoomAfter?.(e, gestureState, this._getZoomableViewEventObject()); } + /** * Used to debug pinch events * @param gestureResponderEvent * @param zoomCenter * @param points */ - - _setPinchDebugPoints(gestureResponderEvent, zoomCenter, ...points) { const { touches @@ -794,6 +597,7 @@ class ReactNativeZoomableView extends _react.Component { }, zoomCenter, ...points] }); } + /** * Calculates the amount the offset should shift since the last position during panning * @@ -801,14 +605,11 @@ class ReactNativeZoomableView extends _react.Component { * * @private */ - - _calcOffsetShiftSinceLastGestureState(gestureCenterPoint) { const { movementSensibility } = this.props; let shift = null; - if (this.lastGestureCenterPosition && movementSensibility) { const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x; const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y; @@ -819,10 +620,10 @@ class ReactNativeZoomableView extends _react.Component { y: shiftY }; } - this.lastGestureCenterPosition = gestureCenterPoint; return shift; } + /** * Handles movement by tap and move * @@ -830,23 +631,18 @@ class ReactNativeZoomableView extends _react.Component { * * @private */ - - _handleShifting(gestureState) { // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level if (!this.props.panEnabled || this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom) { return; } - const shift = this._calcOffsetShiftSinceLastGestureState({ x: gestureState.moveX, y: gestureState.moveY }); - if (!shift) return; const offsetX = this.offsetX + shift.x; const offsetY = this.offsetY + shift.y; - if (this.props.debug && this.state.originalPageX && this.state.originalPageY) { const x = gestureState.moveX - this.state.originalPageX; const y = gestureState.moveY - this.state.originalPageY; @@ -857,11 +653,10 @@ class ReactNativeZoomableView extends _react.Component { }] }); } - this._setNewOffsetPosition(offsetX, offsetY); - this.raisePin(); } + /** * Set the state to offset moved * @@ -869,18 +664,14 @@ class ReactNativeZoomableView extends _react.Component { * @param {number} newOffsetY * @returns */ - - _setNewOffsetPosition(newOffsetX, newOffsetY) { const { onShiftingBefore, onShiftingAfter } = this.props; - - if (onShiftingBefore !== null && onShiftingBefore !== void 0 && onShiftingBefore(null, null, this._getZoomableViewEventObject())) { + if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) { return; } - this.offsetX = newOffsetX; this.offsetY = newOffsetY; this.panAnim.setValue({ @@ -888,8 +679,9 @@ class ReactNativeZoomableView extends _react.Component { y: this.offsetY }); this.zoomAnim.setValue(this.zoomLevel); - onShiftingAfter === null || onShiftingAfter === void 0 ? void 0 : onShiftingAfter(null, null, this._getZoomableViewEventObject()); + onShiftingAfter?.(null, null, this._getZoomableViewEventObject()); } + /** * Check whether the press event is double tap * or single tap and handle the event accordingly @@ -898,21 +690,126 @@ class ReactNativeZoomableView extends _react.Component { * * @private */ + _resolveAndHandleTap = e => { + const now = Date.now(); + if (this.doubleTapFirstTapReleaseTimestamp && this.props.doubleTapDelay && now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay) { + this.doubleTapFirstTap && this._addTouch({ + ...this.doubleTapFirstTap, + id: now.toString(), + isSecondTap: true + }); + this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); + delete this.doubleTapFirstTapReleaseTimestamp; + delete this.singleTapTimeoutId; + delete this.doubleTapFirstTap; + this._handleDoubleTap(e); + } else { + this.doubleTapFirstTapReleaseTimestamp = now; + this.doubleTapFirstTap = { + id: now.toString(), + x: e.nativeEvent.pageX - this.state.originalPageX, + y: e.nativeEvent.pageY - this.state.originalPageY + }; + this._addTouch(this.doubleTapFirstTap); + // persist event so e.nativeEvent is preserved after a timeout delay + e.persist(); + this.singleTapTimeoutId = setTimeout(() => { + delete this.doubleTapFirstTapReleaseTimestamp; + delete this.singleTapTimeoutId; + // Pan to the tapped location + if (this.props.staticPinPosition && this.doubleTapFirstTap) { + const tapX = this.props.staticPinPosition.x - this.doubleTapFirstTap.x; + const tapY = this.props.staticPinPosition.y - this.doubleTapFirstTap.y; + _reactNative.Animated.timing(this.panAnim, { + toValue: { + x: this.offsetX + tapX / this.zoomLevel, + y: this.offsetY + tapY / this.zoomLevel + }, + useNativeDriver: true, + duration: 200 + }).start(() => { + this._updateStaticPin(); + }); + } + this.props.onSingleTap?.(e, this._getZoomableViewEventObject()); + }, this.props.doubleTapDelay); + } + }; + moveStaticPinTo = (position, duration) => { + const { + originalWidth, + originalHeight + } = this.state; + const { + staticPinPosition, + contentWidth, + contentHeight + } = this.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; + this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; + this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; + if (duration) { + _reactNative.Animated.timing(this.panAnim, { + toValue: { + x: this.offsetX, + y: this.offsetY + }, + useNativeDriver: true, + duration + }).start(); + } else { + this.panAnim.setValue({ + x: this.offsetX, + y: this.offsetY + }); + } + }; + _staticPinPosition = () => { + if (!this.props.staticPinPosition) return; + if (!this.props.contentWidth || !this.props.contentHeight) return; + return (0, _coordinateConversion.viewportPositionToImagePosition)({ + viewportPosition: { + x: this.props.staticPinPosition.x, + y: this.props.staticPinPosition.y + }, + imageSize: { + height: this.props.contentHeight, + width: this.props.contentWidth + }, + zoomableEvent: { + ...this._getZoomableViewEventObject(), + offsetX: this.offsetX, + offsetY: this.offsetY, + zoomLevel: this.zoomLevel + } + }); + }; + _updateStaticPin = () => { + const position = this._staticPinPosition(); + if (!position) return; + this.props.onStaticPinPositionChange?.(position); + }; _addTouch(touch) { this.touches.push(touch); this.setState({ touches: [...this.touches] }); } - _removeTouch(touch) { this.touches.splice(this.touches.indexOf(touch), 1); this.setState({ touches: [...this.touches] }); } + /** * Handles the double tap event * @@ -920,47 +817,43 @@ class ReactNativeZoomableView extends _react.Component { * * @private */ - - _handleDoubleTap(e) { const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } = this.props; - onDoubleTapBefore === null || onDoubleTapBefore === void 0 ? void 0 : onDoubleTapBefore(e, this._getZoomableViewEventObject()); - + onDoubleTapBefore?.(e, this._getZoomableViewEventObject()); const nextZoomStep = this._getNextZoomStep(); - if (nextZoomStep == null) return; const { originalPageX, originalPageY - } = this.state; // define new zoom position coordinates + } = this.state; + // 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 enabled -> always zoom to center instead if (doubleTapZoomToCenter) { zoomPositionCoordinates.x = 0; zoomPositionCoordinates.y = 0; } - this.zoomTo(nextZoomStep, zoomPositionCoordinates); - onDoubleTapAfter === null || onDoubleTapAfter === void 0 ? void 0 : onDoubleTapAfter(e, this._getZoomableViewEventObject({ + onDoubleTapAfter?.(e, this._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 {*} */ - - _getNextZoomStep() { const { zoomStep, @@ -971,20 +864,17 @@ class ReactNativeZoomableView extends _react.Component { zoomLevel } = this; 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; } + /** * 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. @@ -994,25 +884,21 @@ class ReactNativeZoomableView extends _react.Component { * @param newZoomLevel * @param zoomCenter - If not supplied, the container's center is the zoom center */ - - zoomTo(newZoomLevel, zoomCenter) { - var _this$props$onZoomBef, _this$props18, _this$props$onZoomAft2, _this$props19; - if (!this.props.zoomEnabled) return false; if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false; if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false; - (_this$props$onZoomBef = (_this$props18 = this.props).onZoomBefore) === null || _this$props$onZoomBef === void 0 ? void 0 : _this$props$onZoomBef.call(_this$props18, null, null, this._getZoomableViewEventObject()); // == Perform Pan Animation to preserve the zoom center while zooming == + this.props.onZoomBefore?.(null, null, this._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 = this.zoomLevel; // Since zoomAnim is calculated in native driver, + let prevScale = this.zoomLevel; + // 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 = this.zoomAnim.addListener(({ value: newScale }) => { @@ -1022,16 +908,18 @@ class ReactNativeZoomableView extends _react.Component { }); prevScale = newScale; }); - } // == Perform Zoom Animation == - + } + // == Perform Zoom Animation == (0, _animations.getZoomToAnimation)(this.zoomAnim, newZoomLevel).start(() => { this.zoomAnim.removeListener(listenerId); - }); // == Zoom Animation Ends == + }); + // == Zoom Animation Ends == - (_this$props$onZoomAft2 = (_this$props19 = this.props).onZoomAfter) === null || _this$props$onZoomAft2 === void 0 ? void 0 : _this$props$onZoomAft2.call(_this$props19, null, null, this._getZoomableViewEventObject()); + this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject()); return true; } + /** * Zooms in or out by a specified change level * Use a positive number for `zoomLevelChange` to zoom in @@ -1043,13 +931,12 @@ class ReactNativeZoomableView extends _react.Component { * * @return {bool} */ - - zoomBy(zoomLevelChange) { // if no zoom level Change given -> just use zoom step - zoomLevelChange || (zoomLevelChange = this.props.zoomStep || 0); + zoomLevelChange ||= this.props.zoomStep || 0; return this.zoomTo(this.zoomLevel + zoomLevelChange); } + /** * Moves the zoomed view to a specified position * Returns a promise when finished @@ -1059,8 +946,6 @@ class ReactNativeZoomableView extends _react.Component { * * @return {bool} */ - - moveTo(newOffsetX, newOffsetY) { const { originalWidth, @@ -1069,9 +954,9 @@ class ReactNativeZoomableView extends _react.Component { if (!originalWidth || !originalHeight) return; const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel; const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel; - this._setNewOffsetPosition(-offsetX, -offsetY); } + /** * Moves the zoomed view by a certain amount. * @@ -1082,15 +967,11 @@ class ReactNativeZoomableView extends _react.Component { * * @return {bool} */ - - moveBy(offsetChangeX, offsetChangeY) { const offsetX = (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel; const offsetY = (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel; - this._setNewOffsetPosition(offsetX, offsetY); } - render() { const { staticPinIcon, @@ -1107,87 +988,57 @@ class ReactNativeZoomableView extends _react.Component { touches, debugPoints = [] } = this.state; - return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({ - style: styles.container - }, this.gestureHandlers.panHandlers, { + return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, { + style: styles.container, + ...this.gestureHandlers.panHandlers, ref: this.zoomSubjectWrapperRef, - onLayout: this.measureZoomSubject - }), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, { - style: [styles.zoomSubject, this.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: this.zoomAnim - }, { - scaleY: this.zoomAnim - }, ...this.panAnim.getTranslateTransform()] - }] - }, children), visualTouchFeedbackEnabled && (touches === null || touches === void 0 ? void 0 : touches.map(touch => doubleTapDelay && /*#__PURE__*/_react.default.createElement(_components.AnimatedTouchFeedback, { - x: touch.x, - y: touch.y, - key: touch.id, - animationDuration: doubleTapDelay, - onAnimationDone: () => { - this._removeTouch(touch); - } - }))), debugPoints.map(({ - x, - y - }, index) => { - return /*#__PURE__*/_react.default.createElement(_debugHelper.DebugTouchPoint, { - key: index, - x: x, - y: y - }); - }), staticPinPosition && /*#__PURE__*/_react.default.createElement(_StaticPin.StaticPin, { - staticPinIcon: staticPinIcon, - staticPinPosition: staticPinPosition, - pinSize: pinSize, - onPress: onStaticPinPress, - onLongPress: onStaticPinLongPress, - onParentMove: this._handlePanResponderMove, - pinAnim: this.pinAnim, - setPinSize: size => { - this.setState({ - pinSize: size - }); - }, - pinProps: pinProps - })); + onLayout: this.measureZoomSubject, + children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { + style: [styles.zoomSubject, this.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: this.zoomAnim + }, { + scaleY: this.zoomAnim + }, ...this.panAnim.getTranslateTransform()] + }], + children: children + }), visualTouchFeedbackEnabled && touches?.map(touch => doubleTapDelay && /*#__PURE__*/(0, _jsxRuntime.jsx)(_components.AnimatedTouchFeedback, { + x: touch.x, + y: touch.y, + animationDuration: doubleTapDelay, + onAnimationDone: () => { + this._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: this._handlePanResponderMove, + pinAnim: this.pinAnim, + setPinSize: size => { + this.setState({ + pinSize: size + }); + }, + pinProps: pinProps + })] + }); } - } - exports.ReactNativeZoomableView = ReactNativeZoomableView; - -_defineProperty(ReactNativeZoomableView, "defaultProps", { - zoomEnabled: true, - panEnabled: true, - initialZoom: 1, - initialOffsetX: 0, - initialOffsetY: 0, - maxZoom: 1.5, - minZoom: 0.5, - pinchToZoomInSensitivity: 1, - pinchToZoomOutSensitivity: 1, - movementSensibility: 1, - doubleTapDelay: 300, - bindToBorders: true, - zoomStep: 0.5, - onLongPress: null, - longPressDuration: 700, - contentWidth: undefined, - contentHeight: undefined, - panBoundaryPadding: 0, - visualTouchFeedbackEnabled: true, - staticPinPosition: undefined, - staticPinIcon: undefined, - onStaticPinPositionChange: undefined, - onStaticPinPositionMove: undefined, - animatePin: true, - disablePanOnInitialZoom: false -}); - const styles = _reactNative.StyleSheet.create({ container: { alignItems: 'center', @@ -1203,7 +1054,5 @@ const styles = _reactNative.StyleSheet.create({ width: '100%' } }); - -var _default = ReactNativeZoomableView; -exports.default = _default; +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 index bd17215..54e8037 100644 --- a/lib/commonjs/ReactNativeZoomableView.js.map +++ b/lib/commonjs/ReactNativeZoomableView.js.map @@ -1 +1 @@ -{"version":3,"sources":["ReactNativeZoomableView.tsx"],"names":["initialState","originalWidth","originalHeight","originalPageX","originalPageY","originalX","originalY","pinSize","width","height","ReactNativeZoomableView","Component","gestureStarted","v","_gestureStarted","constructor","props","Animated","ValueXY","x","y","Value","value","boundaryCrossedAnimInEffect","position","onStaticPinPositionChange","requestAnimationFrame","setTimeout","zoomSubjectWrapperRef","current","measure","pageX","pageY","state","setState","e","gestureState","onStartShouldSetPanResponder","_getZoomableViewEventObject","onLongPress","persist","longPressTimeout","longPressDuration","onPanResponderGrant","panAnim","stopAnimation","zoomAnim","raisePin","gestureType","_resolveAndHandleTap","debugPoints","lastGestureCenterPosition","disableMomentum","panEnabled","disablePanOnInitialZoom","zoomLevel","initialZoom","vx","vy","start","clearTimeout","onPanResponderEnd","onZoomEnd","onShiftingEnd","staticPinPosition","_updateStaticPin","dropPin","onPanResponderMove","numberActiveTouches","_handlePanResponderGrant","_handlePanResponderEnd","lastGestureTouchDistance","_handlePinching","Math","abs","dx","dy","isShiftGesture","_handleShifting","now","Date","doubleTapFirstTapReleaseTimestamp","doubleTapDelay","doubleTapFirstTap","_addTouch","id","toString","isSecondTap","singleTapTimeoutId","_handleDoubleTap","nativeEvent","tapX","tapY","timing","toValue","offsetX","offsetY","useNativeDriver","duration","onSingleTap","contentWidth","contentHeight","pinX","pinY","setValue","viewportPosition","imageSize","zoomableEvent","_staticPinPosition","gestureHandlers","PanResponder","create","_handleStartShouldSetPanResponder","_handlePanResponderMove","onPanResponderRelease","onPanResponderTerminate","evt","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomAnimatedValue","panAnimatedValueXY","initialOffsetX","initialOffsetY","addListener","animatePin","pinAnim","easing","Easing","out","ease","__setOffset","__getOffset","axis","offset","offsetState","__offsets","bindToBorders","containerSize","contentSize","boundOffset","panBoundaryPadding","boundariesApplied","toFixed","componentDidUpdate","prevProps","prevState","zoomEnabled","onTransformInvocationInitialized","_invokeOnTransform","successful","currState","originalMeasurementsChanged","staticPinPositionChanged","layout","onLayout","componentDidMount","measureZoomSubject","measureZoomSubjectInterval","setInterval","componentWillUnmount","clearInterval","zoomableViewEvent","onTransform","onStaticPinPositionMove","debouncedOnStaticPinPositionChange","overwriteObj","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","distance","onZoomBefore","zoomGrowthFromLastGestureState","pinchToZoomSensitivity","deltaGrowth","deltaGrowthAdjustedBySensitivity","newZoomLevel","gestureCenterPoint","zoomCenter","debug","_setPinchDebugPoints","oldOffsetX","oldOffsetY","oldScale","newScale","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","touches","movementSensibility","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","newOffsetX","newOffsetY","onShiftingBefore","onShiftingAfter","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","zoomTo","zoomStep","listenerId","prevScale","removeListener","zoomBy","zoomLevelChange","moveTo","moveBy","offsetChangeX","offsetChangeY","render","staticPinIcon","children","visualTouchFeedbackEnabled","onStaticPinLongPress","onStaticPinPress","pinProps","styles","container","panHandlers","zoomSubject","style","transform","scaleX","scaleY","getTranslateTransform","map","index","size","undefined","StyleSheet","alignItems","flex","justifyContent","overflow"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAYA;;AAKA;;AACA;;AACA;;AACA;;AAKA;;AACA;;;;;;;;;;AAUA,MAAMA,YAA0C,GAAG;AACjDC,EAAAA,aAAa,EAAE,CADkC;AAEjDC,EAAAA,cAAc,EAAE,CAFiC;AAGjDC,EAAAA,aAAa,EAAE,CAHkC;AAIjDC,EAAAA,aAAa,EAAE,CAJkC;AAKjDC,EAAAA,SAAS,EAAE,CALsC;AAMjDC,EAAAA,SAAS,EAAE,CANsC;AAOjDC,EAAAA,OAAO,EAAE;AAAEC,IAAAA,KAAK,EAAE,CAAT;AAAYC,IAAAA,MAAM,EAAE;AAApB;AAPwC,CAAnD;;AAUA,MAAMC,uBAAN,SAAsCC,gBAAtC,CAGE;AAsD0B,MAAdC,cAAc,CAACC,CAAD,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,SAtBP;AAuBpBhF,EAAAA,uBAAuB,EAAEgF,SAvBL;AAwBpBvH,EAAAA,UAAU,EAAE,IAxBQ;AAyBpBxE,EAAAA,uBAAuB,EAAE;AAzBL,C;;AAutCxB,MAAMmL,MAAM,GAAGa,wBAAWvI,MAAX,CAAkB;AAC/B2H,EAAAA,SAAS,EAAE;AACTa,IAAAA,UAAU,EAAE,QADH;AAETC,IAAAA,IAAI,EAAE,CAFG;AAGTC,IAAAA,cAAc,EAAE,QAHP;AAITC,IAAAA,QAAQ,EAAE,QAJD;AAKTlO,IAAAA,QAAQ,EAAE;AALD,GADoB;AAQ/BoN,EAAAA,WAAW,EAAE;AACXW,IAAAA,UAAU,EAAE,QADD;AAEXC,IAAAA,IAAI,EAAE,CAFK;AAGXC,IAAAA,cAAc,EAAE,QAHL;AAIXjP,IAAAA,KAAK,EAAE;AAJI;AARkB,CAAlB,CAAf;;eAgBeE,uB","sourcesContent":["import { debounce } from 'lodash';\nimport React, { Component, createRef, RefObject } from 'react';\nimport {\n Animated,\n Easing,\n GestureResponderEvent,\n PanResponder,\n PanResponderCallbacks,\n PanResponderGestureState,\n PanResponderInstance,\n StyleSheet,\n View,\n} from 'react-native';\n\nimport {\n getBoundaryCrossedAnim,\n getPanMomentumDecayAnim,\n getZoomToAnimation,\n} from './animations';\nimport { AnimatedTouchFeedback } from './components';\nimport { StaticPin } from './components/StaticPin';\nimport { DebugTouchPoint } from './debugHelper';\nimport {\n calcGestureCenterPoint,\n calcGestureTouchDistance,\n calcNewScaledOffsetForZoomCentering,\n} from './helper';\nimport { applyPanBoundariesToOffset } from './helper/applyPanBoundariesToOffset';\nimport { viewportPositionToImagePosition } from './helper/coordinateConversion';\nimport {\n ReactNativeZoomableViewProps,\n ReactNativeZoomableViewState,\n Size2D,\n TouchPoint,\n Vec2D,\n ZoomableViewEvent,\n} from './typings';\n\nconst initialState: ReactNativeZoomableViewState = {\n originalWidth: 0,\n originalHeight: 0,\n originalPageX: 0,\n originalPageY: 0,\n originalX: 0,\n originalY: 0,\n pinSize: { width: 0, height: 0 },\n};\n\nclass ReactNativeZoomableView extends Component<\n ReactNativeZoomableViewProps,\n ReactNativeZoomableViewState\n> {\n zoomSubjectWrapperRef: RefObject;\n gestureHandlers: PanResponderInstance;\n doubleTapFirstTapReleaseTimestamp: number | undefined;\n\n static defaultProps = {\n zoomEnabled: true,\n panEnabled: true,\n initialZoom: 1,\n initialOffsetX: 0,\n initialOffsetY: 0,\n maxZoom: 1.5,\n minZoom: 0.5,\n pinchToZoomInSensitivity: 1,\n pinchToZoomOutSensitivity: 1,\n movementSensibility: 1,\n doubleTapDelay: 300,\n bindToBorders: true,\n zoomStep: 0.5,\n onLongPress: null,\n longPressDuration: 700,\n contentWidth: undefined,\n contentHeight: undefined,\n panBoundaryPadding: 0,\n visualTouchFeedbackEnabled: true,\n staticPinPosition: undefined,\n staticPinIcon: undefined,\n onStaticPinPositionChange: undefined,\n onStaticPinPositionMove: undefined,\n animatePin: true,\n disablePanOnInitialZoom: false,\n };\n\n private panAnim = new Animated.ValueXY({ x: 0, y: 0 });\n private zoomAnim = new Animated.Value(1);\n private pinAnim = new Animated.ValueXY({ x: 0, y: 0 });\n\n private __offsets = {\n x: {\n value: 0,\n boundaryCrossedAnimInEffect: false,\n },\n y: {\n value: 0,\n boundaryCrossedAnimInEffect: false,\n },\n };\n\n private zoomLevel = 1;\n private lastGestureCenterPosition: { x: number; y: number } | null = null;\n private lastGestureTouchDistance: number | null = null;\n private gestureType: 'pinch' | 'shift' | null;\n\n private _gestureStarted = false;\n private set gestureStarted(v: boolean) {\n this._gestureStarted = v;\n }\n\n public get gestureStarted() {\n return this._gestureStarted;\n }\n\n /**\n * Last press time (used to evaluate whether user double tapped)\n * @type {number}\n */\n private longPressTimeout: NodeJS.Timeout | null = null;\n private onTransformInvocationInitialized: boolean | undefined;\n private singleTapTimeoutId: NodeJS.Timeout | undefined;\n private touches: TouchPoint[] = [];\n private doubleTapFirstTap: TouchPoint | undefined;\n private measureZoomSubjectInterval: NodeJS.Timer | undefined;\n\n constructor(props: ReactNativeZoomableViewProps) {\n super(props);\n // This needs to be done before anything else to initialize the state.\n // Otherwise, the logic below may reference the state when it's undefined,\n // causing runtime errors.\n this.state = { ...initialState };\n\n this.gestureHandlers = PanResponder.create({\n onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder,\n onPanResponderGrant: this._handlePanResponderGrant,\n onPanResponderMove: this._handlePanResponderMove,\n onPanResponderRelease: this._handlePanResponderEnd,\n onPanResponderTerminate: (evt, gestureState) => {\n // We should also call _handlePanResponderEnd\n // to properly perform cleanups when the gesture is terminated\n // (aka gesture handling responsibility is taken over by another component).\n // This also fixes a weird issue where\n // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up,\n // but onPanResponderTerminate is called instead for no apparent reason.\n this._handlePanResponderEnd(evt, gestureState);\n this.props.onPanResponderTerminate?.(\n evt,\n gestureState,\n this._getZoomableViewEventObject()\n );\n },\n onPanResponderTerminationRequest: (evt, gestureState) =>\n !!this.props.onPanResponderTerminationRequest?.(\n evt,\n gestureState,\n this._getZoomableViewEventObject()\n ),\n // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder.\n onShouldBlockNativeResponder: (evt, gestureState) =>\n this.props.onShouldBlockNativeResponder?.(\n evt,\n gestureState,\n this._getZoomableViewEventObject()\n ) ?? true,\n onStartShouldSetPanResponderCapture: (evt, gestureState) =>\n !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState),\n onMoveShouldSetPanResponderCapture: (evt, gestureState) =>\n !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState),\n });\n\n this.zoomSubjectWrapperRef = createRef();\n\n if (this.props.zoomAnimatedValue)\n this.zoomAnim = this.props.zoomAnimatedValue;\n if (this.props.panAnimatedValueXY)\n this.panAnim = this.props.panAnimatedValueXY;\n\n if (this.props.initialZoom) this.zoomLevel = this.props.initialZoom;\n if (this.props.initialOffsetX != null)\n this.offsetX = this.props.initialOffsetX;\n if (this.props.initialOffsetY != null)\n this.offsetY = this.props.initialOffsetY;\n\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n this.zoomAnim.setValue(this.zoomLevel);\n this.panAnim.addListener(({ x, y }) => {\n this.offsetX = x;\n this.offsetY = y;\n });\n this.zoomAnim.addListener(({ value }) => {\n this.zoomLevel = value;\n });\n\n this.lastGestureTouchDistance = 150;\n\n this.gestureType = null;\n }\n\n private raisePin() {\n if (!this.props.animatePin) return;\n Animated.timing(this.pinAnim, {\n toValue: { x: 0, y: -10 },\n useNativeDriver: true,\n easing: Easing.out(Easing.ease),\n duration: 100,\n }).start();\n }\n\n private dropPin() {\n if (!this.props.animatePin) return;\n Animated.timing(this.pinAnim, {\n toValue: { x: 0, y: 0 },\n useNativeDriver: true,\n easing: Easing.out(Easing.ease),\n duration: 100,\n }).start();\n }\n\n private set offsetX(x: number) {\n this.__setOffset('x', x);\n }\n\n private set offsetY(y: number) {\n this.__setOffset('y', y);\n }\n\n private get offsetX() {\n return this.__getOffset('x');\n }\n\n private get offsetY() {\n return this.__getOffset('y');\n }\n\n private __setOffset(axis: 'x' | 'y', offset: number) {\n const offsetState = this.__offsets[axis];\n\n if (this.props.bindToBorders) {\n const containerSize =\n axis === 'x' ? this.state.originalWidth : this.state.originalHeight;\n const contentSize =\n axis === 'x'\n ? this.props.contentWidth || this.state.originalWidth\n : this.props.contentHeight || this.state.originalHeight;\n\n const boundOffset =\n contentSize && containerSize && this.props.panBoundaryPadding != null\n ? applyPanBoundariesToOffset(\n offset,\n containerSize,\n contentSize,\n this.zoomLevel,\n this.props.panBoundaryPadding\n )\n : offset;\n\n if (!this.gestureType && !offsetState.boundaryCrossedAnimInEffect) {\n const boundariesApplied =\n boundOffset !== offset &&\n boundOffset.toFixed(3) !== offset.toFixed(3);\n if (boundariesApplied) {\n offsetState.boundaryCrossedAnimInEffect = true;\n getBoundaryCrossedAnim(this.panAnim[axis], boundOffset).start(() => {\n offsetState.boundaryCrossedAnimInEffect = false;\n });\n return;\n }\n }\n }\n\n offsetState.value = offset;\n }\n\n private __getOffset(axis: 'x' | 'y') {\n return this.__offsets[axis].value;\n }\n\n componentDidUpdate(\n prevProps: ReactNativeZoomableViewProps,\n prevState: ReactNativeZoomableViewState\n ) {\n const { zoomEnabled, initialZoom } = this.props;\n if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) {\n this.zoomLevel = initialZoom;\n this.zoomAnim.setValue(this.zoomLevel);\n }\n if (\n !this.onTransformInvocationInitialized &&\n this._invokeOnTransform().successful\n ) {\n this.panAnim.addListener(() => this._invokeOnTransform());\n this.zoomAnim.addListener(() => this._invokeOnTransform());\n this.onTransformInvocationInitialized = true;\n }\n\n const currState = this.state;\n const originalMeasurementsChanged =\n currState.originalHeight !== prevState.originalHeight ||\n currState.originalWidth !== prevState.originalWidth ||\n currState.originalPageX !== prevState.originalPageX ||\n currState.originalPageY !== prevState.originalPageY ||\n currState.originalX !== prevState.originalX ||\n currState.originalY !== prevState.originalY;\n\n const staticPinPositionChanged =\n prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x ||\n prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y;\n\n // We use a custom `onLayout` event, so the clients can stay in-sync\n // with when the internal measurements are actually saved to the state,\n // thus helping them apply transformations at more accurate timings\n if (originalMeasurementsChanged) {\n const layout = {\n width: currState.originalWidth,\n height: currState.originalHeight,\n x: currState.originalX,\n y: currState.originalY,\n };\n this.props.onLayout?.({ nativeEvent: { layout } });\n }\n\n if (\n this.onTransformInvocationInitialized &&\n (originalMeasurementsChanged || staticPinPositionChanged)\n ) {\n this._invokeOnTransform();\n }\n }\n\n componentDidMount() {\n this.measureZoomSubject();\n // We've already run `grabZoomSubjectOriginalMeasurements` at various events\n // to make sure the measurements are promptly updated.\n // However, there might be cases we haven't accounted for, especially when\n // native processes are involved. To account for those cases,\n // we'll use an interval here to ensure we're always up-to-date.\n // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender\n // if the values given haven't changed, so we're not running performance risk here.\n this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3);\n }\n\n componentWillUnmount() {\n this.measureZoomSubjectInterval &&\n clearInterval(this.measureZoomSubjectInterval);\n }\n\n debouncedOnStaticPinPositionChange = debounce(\n (position: Vec2D) => this.props.onStaticPinPositionChange?.(position),\n 100\n );\n\n /**\n * try to invoke onTransform\n * @private\n */\n _invokeOnTransform() {\n const zoomableViewEvent = this._getZoomableViewEventObject();\n const position = this._staticPinPosition();\n\n if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight)\n return { successful: false };\n\n this.props.onTransform?.(zoomableViewEvent);\n\n if (position) {\n this.props.onStaticPinPositionMove?.(position);\n this.debouncedOnStaticPinPositionChange(position);\n }\n\n return { successful: true };\n }\n\n /**\n * Returns additional information about components current state for external event hooks\n *\n * @returns {{}}\n * @private\n */\n _getZoomableViewEventObject(overwriteObj = {}): ZoomableViewEvent {\n return {\n zoomLevel: this.zoomLevel,\n offsetX: this.offsetX,\n offsetY: this.offsetY,\n originalHeight: this.state.originalHeight,\n originalWidth: this.state.originalWidth,\n originalPageX: this.state.originalPageX,\n originalPageY: this.state.originalPageY,\n ...overwriteObj,\n } as ZoomableViewEvent;\n }\n\n /**\n * Get the original box dimensions and save them for later use.\n * (They will be used to calculate boxBorders)\n *\n * @private\n */\n private measureZoomSubject = () => {\n // make sure we measure after animations are complete\n requestAnimationFrame(() => {\n // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0`\n // when navigating back (react-navigation stack) from another view\n // while closing the keyboard at the same time\n setTimeout(() => {\n // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper.\n // However, our zoomSubject may have been transformed by an initial zoomLevel or offset,\n // in which case these measurements will not represent the true \"original\" measurements.\n // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject\n // (no border, space, or anything between them)\n this.zoomSubjectWrapperRef.current?.measure(\n (x, y, width, height, pageX, pageY) => {\n // When the component is off-screen, these become all 0s, so we don't set them\n // to avoid messing up calculations, especially ones that are done right after\n // the component transitions from hidden to visible.\n if (!pageX && !pageY && !width && !height) return;\n\n // If these values are all the same, don't re-set them in state\n // this way we don't re-render\n if (\n this.state.originalX === x &&\n this.state.originalY === y &&\n this.state.originalWidth === width &&\n this.state.originalHeight === height &&\n this.state.originalPageX === pageX &&\n this.state.originalPageY === pageY\n ) {\n return;\n }\n\n this.setState({\n originalX: x,\n originalY: y,\n originalWidth: width,\n originalHeight: height,\n originalPageX: pageX,\n originalPageY: pageY,\n });\n }\n );\n });\n });\n };\n\n /**\n * Handles the start of touch events and checks for taps\n *\n * @param e\n * @param gestureState\n * @returns {boolean}\n *\n * @private\n */\n _handleStartShouldSetPanResponder = (\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n if (this.props.onStartShouldSetPanResponder) {\n this.props.onStartShouldSetPanResponder(\n e,\n gestureState,\n this._getZoomableViewEventObject(),\n false\n );\n }\n\n // Always set pan responder on start\n // of gesture so we can handle tap.\n // \"Pan threshold validation\" will be handled\n // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder`\n return true;\n };\n\n /**\n * Calculates pinch distance\n *\n * @param e\n * @param gestureState\n * @private\n */\n _handlePanResponderGrant: NonNullable<\n PanResponderCallbacks['onPanResponderGrant']\n > = (e, gestureState) => {\n if (this.props.onLongPress) {\n e.persist();\n this.longPressTimeout = setTimeout(() => {\n this.props.onLongPress?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n this.longPressTimeout = null;\n }, this.props.longPressDuration);\n }\n\n this.props.onPanResponderGrant?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n\n this.panAnim.stopAnimation();\n this.zoomAnim.stopAnimation();\n this.gestureStarted = true;\n\n this.raisePin();\n };\n\n /**\n * Handles the end of touch events\n *\n * @param e\n * @param gestureState\n *\n * @private\n */\n _handlePanResponderEnd: NonNullable<\n PanResponderCallbacks['onPanResponderEnd']\n > = (e, gestureState) => {\n if (!this.gestureType) {\n this._resolveAndHandleTap(e);\n }\n\n this.setState({ debugPoints: [] });\n\n this.lastGestureCenterPosition = null;\n\n const disableMomentum =\n this.props.disableMomentum ||\n (this.props.panEnabled &&\n this.gestureType === 'shift' &&\n this.props.disablePanOnInitialZoom &&\n this.zoomLevel === this.props.initialZoom);\n\n // Trigger final shift animation unless disablePanOnInitialZoom is set and we're on the initial zoom level\n // or disableMomentum\n if (!disableMomentum) {\n getPanMomentumDecayAnim(this.panAnim, {\n x: gestureState.vx / this.zoomLevel,\n y: gestureState.vy / this.zoomLevel,\n }).start();\n }\n\n if (this.longPressTimeout) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = null;\n }\n\n this.props.onPanResponderEnd?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n\n if (this.gestureType === 'pinch') {\n this.props.onZoomEnd?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n } else if (this.gestureType === 'shift') {\n this.props.onShiftingEnd?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n }\n\n if (this.props.staticPinPosition) {\n this._updateStaticPin();\n }\n\n this.dropPin();\n\n this.gestureType = null;\n this.gestureStarted = false;\n };\n\n /**\n * Handles the actual movement of our pan responder\n *\n * @param e\n * @param gestureState\n *\n * @private\n */\n _handlePanResponderMove = (\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n if (this.props.onPanResponderMove) {\n if (\n this.props.onPanResponderMove(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n )\n ) {\n return false;\n }\n }\n\n // Only supports 2 touches and below,\n // any invalid number will cause the gesture to end.\n if (gestureState.numberActiveTouches <= 2) {\n if (!this.gestureStarted) {\n this._handlePanResponderGrant(e, gestureState);\n }\n } else {\n if (this.gestureStarted) {\n this._handlePanResponderEnd(e, gestureState);\n }\n return true;\n }\n\n if (gestureState.numberActiveTouches === 2) {\n if (this.longPressTimeout) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = null;\n }\n\n // change some measurement states when switching gesture to ensure a smooth transition\n if (this.gestureType !== 'pinch') {\n this.lastGestureCenterPosition = calcGestureCenterPoint(\n e,\n gestureState\n );\n this.lastGestureTouchDistance = calcGestureTouchDistance(\n e,\n gestureState\n );\n }\n this.gestureType = 'pinch';\n this._handlePinching(e, gestureState);\n } else if (gestureState.numberActiveTouches === 1) {\n if (\n this.longPressTimeout &&\n (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)\n ) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = null;\n }\n // change some measurement states when switching gesture to ensure a smooth transition\n if (this.gestureType !== 'shift') {\n this.lastGestureCenterPosition = calcGestureCenterPoint(\n e,\n gestureState\n );\n }\n\n const { dx, dy } = gestureState;\n const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2;\n if (isShiftGesture) {\n this.gestureType = 'shift';\n this._handleShifting(gestureState);\n }\n }\n };\n\n /**\n * Handles the pinch movement and zooming\n *\n * @param e\n * @param gestureState\n *\n * @private\n */\n _handlePinching(\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) {\n if (!this.props.zoomEnabled) return;\n\n const {\n maxZoom,\n minZoom,\n pinchToZoomInSensitivity,\n pinchToZoomOutSensitivity,\n } = this.props;\n\n const distance = calcGestureTouchDistance(e, gestureState);\n\n if (\n this.props.onZoomBefore &&\n this.props.onZoomBefore(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n )\n ) {\n return;\n }\n\n if (!distance) return;\n if (!this.lastGestureTouchDistance) return;\n\n // define the new zoom level and take zoom level sensitivity into consideration\n const zoomGrowthFromLastGestureState =\n distance / this.lastGestureTouchDistance;\n this.lastGestureTouchDistance = distance;\n\n const pinchToZoomSensitivity =\n zoomGrowthFromLastGestureState < 1\n ? pinchToZoomOutSensitivity\n : pinchToZoomInSensitivity;\n\n if (pinchToZoomSensitivity == null) return;\n const deltaGrowth = zoomGrowthFromLastGestureState - 1;\n // 0 - no resistance\n // 10 - 90% resistance\n const deltaGrowthAdjustedBySensitivity =\n deltaGrowth * (1 - (pinchToZoomSensitivity * 9) / 100);\n\n let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity);\n\n // make sure max and min zoom levels are respected\n if (maxZoom != null && newZoomLevel > maxZoom) {\n newZoomLevel = maxZoom;\n }\n\n if (minZoom != null && newZoomLevel < minZoom) {\n newZoomLevel = minZoom;\n }\n\n const gestureCenterPoint = calcGestureCenterPoint(e, gestureState);\n\n if (!gestureCenterPoint) return;\n\n let zoomCenter = {\n x: gestureCenterPoint.x - this.state.originalPageX,\n y: gestureCenterPoint.y - this.state.originalPageY,\n };\n\n if (this.props.staticPinPosition) {\n // When we use a static pin position, the zoom centre is the same as that position,\n // otherwise the pin moves around way too much while zooming.\n zoomCenter = {\n x: this.props.staticPinPosition.x,\n y: this.props.staticPinPosition.y,\n };\n }\n\n // Uncomment to debug\n this.props.debug && this._setPinchDebugPoints(e, zoomCenter);\n\n const { originalHeight, originalWidth } = this.state;\n\n const oldOffsetX = this.offsetX;\n const oldOffsetY = this.offsetY;\n const oldScale = this.zoomLevel;\n const newScale = newZoomLevel;\n\n if (!originalHeight || !originalWidth) return;\n\n let offsetY = calcNewScaledOffsetForZoomCentering(\n oldOffsetY,\n originalHeight,\n oldScale,\n newScale,\n zoomCenter.y\n );\n let offsetX = calcNewScaledOffsetForZoomCentering(\n oldOffsetX,\n originalWidth,\n oldScale,\n newScale,\n zoomCenter.x\n );\n\n const offsetShift =\n this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint);\n if (offsetShift) {\n offsetX += offsetShift.x;\n offsetY += offsetShift.y;\n }\n\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n this.zoomLevel = newScale;\n\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n this.zoomAnim.setValue(this.zoomLevel);\n\n this.props.onZoomAfter?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n }\n\n /**\n * Used to debug pinch events\n * @param gestureResponderEvent\n * @param zoomCenter\n * @param points\n */\n _setPinchDebugPoints(\n gestureResponderEvent: GestureResponderEvent,\n zoomCenter: Vec2D,\n ...points: Vec2D[]\n ) {\n const { touches } = gestureResponderEvent.nativeEvent;\n const { originalPageY, originalPageX } = this.state;\n\n this.setState({\n debugPoints: [\n {\n x: touches[0].pageX - originalPageX,\n y: touches[0].pageY - originalPageY,\n },\n {\n x: touches[1].pageX - originalPageX,\n y: touches[1].pageY - originalPageY,\n },\n zoomCenter,\n ...points,\n ],\n });\n }\n\n /**\n * Calculates the amount the offset should shift since the last position during panning\n *\n * @param {Vec2D} gestureCenterPoint\n *\n * @private\n */\n _calcOffsetShiftSinceLastGestureState(gestureCenterPoint: Vec2D) {\n const { movementSensibility } = this.props;\n\n let shift = null;\n\n if (this.lastGestureCenterPosition && movementSensibility) {\n const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x;\n const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y;\n\n const shiftX = dx / this.zoomLevel / movementSensibility;\n const shiftY = dy / this.zoomLevel / movementSensibility;\n\n shift = {\n x: shiftX,\n y: shiftY,\n };\n }\n\n this.lastGestureCenterPosition = gestureCenterPoint;\n\n return shift;\n }\n\n /**\n * Handles movement by tap and move\n *\n * @param gestureState\n *\n * @private\n */\n _handleShifting(gestureState: PanResponderGestureState) {\n // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level\n if (\n !this.props.panEnabled ||\n (this.props.disablePanOnInitialZoom &&\n this.zoomLevel === this.props.initialZoom)\n ) {\n return;\n }\n const shift = this._calcOffsetShiftSinceLastGestureState({\n x: gestureState.moveX,\n y: gestureState.moveY,\n });\n if (!shift) return;\n\n const offsetX = this.offsetX + shift.x;\n const offsetY = this.offsetY + shift.y;\n\n if (\n this.props.debug &&\n this.state.originalPageX &&\n this.state.originalPageY\n ) {\n const x = gestureState.moveX - this.state.originalPageX;\n const y = gestureState.moveY - this.state.originalPageY;\n this.setState({ debugPoints: [{ x, y }] });\n }\n\n this._setNewOffsetPosition(offsetX, offsetY);\n\n this.raisePin();\n }\n\n /**\n * Set the state to offset moved\n *\n * @param {number} newOffsetX\n * @param {number} newOffsetY\n * @returns\n */\n _setNewOffsetPosition(newOffsetX: number, newOffsetY: number) {\n const { onShiftingBefore, onShiftingAfter } = this.props;\n\n if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) {\n return;\n }\n\n this.offsetX = newOffsetX;\n this.offsetY = newOffsetY;\n\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n this.zoomAnim.setValue(this.zoomLevel);\n\n onShiftingAfter?.(null, null, this._getZoomableViewEventObject());\n }\n\n /**\n * Check whether the press event is double tap\n * or single tap and handle the event accordingly\n *\n * @param e\n *\n * @private\n */\n private _resolveAndHandleTap = (e: GestureResponderEvent) => {\n const now = Date.now();\n if (\n this.doubleTapFirstTapReleaseTimestamp &&\n this.props.doubleTapDelay &&\n now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay\n ) {\n this.doubleTapFirstTap &&\n this._addTouch({\n ...this.doubleTapFirstTap,\n id: now.toString(),\n isSecondTap: true,\n });\n this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId);\n delete this.doubleTapFirstTapReleaseTimestamp;\n delete this.singleTapTimeoutId;\n delete this.doubleTapFirstTap;\n this._handleDoubleTap(e);\n } else {\n this.doubleTapFirstTapReleaseTimestamp = now;\n this.doubleTapFirstTap = {\n id: now.toString(),\n x: e.nativeEvent.pageX - this.state.originalPageX,\n y: e.nativeEvent.pageY - this.state.originalPageY,\n };\n this._addTouch(this.doubleTapFirstTap);\n\n // persist event so e.nativeEvent is preserved after a timeout delay\n e.persist();\n this.singleTapTimeoutId = setTimeout(() => {\n delete this.doubleTapFirstTapReleaseTimestamp;\n delete this.singleTapTimeoutId;\n\n // Pan to the tapped location\n if (this.props.staticPinPosition && this.doubleTapFirstTap) {\n const tapX =\n this.props.staticPinPosition.x - this.doubleTapFirstTap.x;\n const tapY =\n this.props.staticPinPosition.y - this.doubleTapFirstTap.y;\n\n Animated.timing(this.panAnim, {\n toValue: {\n x: this.offsetX + tapX / this.zoomLevel,\n y: this.offsetY + tapY / this.zoomLevel,\n },\n useNativeDriver: true,\n duration: 200,\n }).start(() => {\n this._updateStaticPin();\n });\n }\n\n this.props.onSingleTap?.(e, this._getZoomableViewEventObject());\n }, this.props.doubleTapDelay);\n }\n };\n\n moveStaticPinTo = (position: Vec2D, duration?: number) => {\n const { originalWidth, originalHeight } = this.state;\n const { staticPinPosition, contentWidth, contentHeight } = this.props;\n\n if (!staticPinPosition) return;\n if (!originalWidth || !originalHeight) return;\n if (!contentWidth || !contentHeight) return;\n\n // Offset for the static pin\n const pinX = staticPinPosition.x - originalWidth / 2;\n const pinY = staticPinPosition.y - originalHeight / 2;\n\n this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel;\n this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel;\n\n if (duration) {\n Animated.timing(this.panAnim, {\n toValue: { x: this.offsetX, y: this.offsetY },\n useNativeDriver: true,\n duration,\n }).start();\n } else {\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n }\n };\n\n private _staticPinPosition = () => {\n if (!this.props.staticPinPosition) return;\n if (!this.props.contentWidth || !this.props.contentHeight) return;\n\n return viewportPositionToImagePosition({\n viewportPosition: {\n x: this.props.staticPinPosition.x,\n y: this.props.staticPinPosition.y,\n },\n imageSize: {\n height: this.props.contentHeight,\n width: this.props.contentWidth,\n },\n zoomableEvent: {\n ...this._getZoomableViewEventObject(),\n offsetX: this.offsetX,\n offsetY: this.offsetY,\n zoomLevel: this.zoomLevel,\n },\n });\n };\n\n private _updateStaticPin = () => {\n const position = this._staticPinPosition();\n if (!position) return;\n this.props.onStaticPinPositionChange?.(position);\n };\n\n private _addTouch(touch: TouchPoint) {\n this.touches.push(touch);\n this.setState({ touches: [...this.touches] });\n }\n\n private _removeTouch(touch: TouchPoint) {\n this.touches.splice(this.touches.indexOf(touch), 1);\n this.setState({ touches: [...this.touches] });\n }\n\n /**\n * Handles the double tap event\n *\n * @param e\n *\n * @private\n */\n _handleDoubleTap(e: GestureResponderEvent) {\n const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } =\n this.props;\n\n onDoubleTapBefore?.(e, this._getZoomableViewEventObject());\n\n const nextZoomStep = this._getNextZoomStep();\n if (nextZoomStep == null) return;\n\n const { originalPageX, originalPageY } = this.state;\n\n // define new zoom position coordinates\n const zoomPositionCoordinates = {\n x: e.nativeEvent.pageX - originalPageX,\n y: e.nativeEvent.pageY - originalPageY,\n };\n\n // if doubleTapZoomToCenter enabled -> always zoom to center instead\n if (doubleTapZoomToCenter) {\n zoomPositionCoordinates.x = 0;\n zoomPositionCoordinates.y = 0;\n }\n\n this.zoomTo(nextZoomStep, zoomPositionCoordinates);\n\n onDoubleTapAfter?.(\n e,\n this._getZoomableViewEventObject({ zoomLevel: nextZoomStep })\n );\n }\n\n /**\n * Returns the next zoom step based on current step and zoomStep property.\n * If we are zoomed all the way in -> return to initialzoom\n *\n * @returns {*}\n */\n _getNextZoomStep() {\n const { zoomStep, maxZoom, initialZoom } = this.props;\n const { zoomLevel } = this;\n\n if (maxZoom == null) return;\n\n if (zoomLevel.toFixed(2) === maxZoom.toFixed(2)) {\n return initialZoom;\n }\n\n if (zoomStep == null) return;\n\n const nextZoomStep = zoomLevel * (1 + zoomStep);\n if (nextZoomStep > maxZoom) {\n return maxZoom;\n }\n\n return nextZoomStep;\n }\n\n /**\n * Zooms to a specific level. A \"zoom center\" can be provided, which specifies\n * the point that will remain in the same position on the screen after the zoom.\n * The coordinates of the zoom center is relative to the zoom subject.\n * { x: 0, y: 0 } is the very center of the zoom subject.\n *\n * @param newZoomLevel\n * @param zoomCenter - If not supplied, the container's center is the zoom center\n */\n zoomTo(newZoomLevel: number, zoomCenter?: Vec2D) {\n if (!this.props.zoomEnabled) return false;\n if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false;\n if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false;\n\n this.props.onZoomBefore?.(null, null, this._getZoomableViewEventObject());\n\n // == Perform Pan Animation to preserve the zoom center while zooming ==\n let listenerId = '';\n if (zoomCenter) {\n // Calculates panAnim values based on changes in zoomAnim.\n let prevScale = this.zoomLevel;\n // Since zoomAnim is calculated in native driver,\n // it will jitter panAnim once in a while,\n // because here panAnim is being calculated in js.\n // However the jittering should mostly occur in simulator.\n listenerId = this.zoomAnim.addListener(({ value: newScale }) => {\n this.panAnim.setValue({\n x: calcNewScaledOffsetForZoomCentering(\n this.offsetX,\n this.state.originalWidth,\n prevScale,\n newScale,\n zoomCenter.x\n ),\n y: calcNewScaledOffsetForZoomCentering(\n this.offsetY,\n this.state.originalHeight,\n prevScale,\n newScale,\n zoomCenter.y\n ),\n });\n prevScale = newScale;\n });\n }\n\n // == Perform Zoom Animation ==\n getZoomToAnimation(this.zoomAnim, newZoomLevel).start(() => {\n this.zoomAnim.removeListener(listenerId);\n });\n // == Zoom Animation Ends ==\n\n this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject());\n return true;\n }\n\n /**\n * Zooms in or out by a specified change level\n * Use a positive number for `zoomLevelChange` to zoom in\n * Use a negative number for `zoomLevelChange` to zoom out\n *\n * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits.\n *\n * @param {number | null} zoomLevelChange\n *\n * @return {bool}\n */\n zoomBy(zoomLevelChange: number) {\n // if no zoom level Change given -> just use zoom step\n zoomLevelChange ||= this.props.zoomStep || 0;\n return this.zoomTo(this.zoomLevel + zoomLevelChange);\n }\n\n /**\n * Moves the zoomed view to a specified position\n * Returns a promise when finished\n *\n * @param {number} newOffsetX the new position we want to move it to (x-axis)\n * @param {number} newOffsetY the new position we want to move it to (y-axis)\n *\n * @return {bool}\n */\n moveTo(newOffsetX: number, newOffsetY: number) {\n const { originalWidth, originalHeight } = this.state;\n if (!originalWidth || !originalHeight) return;\n\n const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel;\n const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel;\n\n this._setNewOffsetPosition(-offsetX, -offsetY);\n }\n\n /**\n * Moves the zoomed view by a certain amount.\n *\n * Returns a promise when finished\n *\n * @param {number} offsetChangeX the amount we want to move the offset by (x-axis)\n * @param {number} offsetChangeY the amount we want to move the offset by (y-axis)\n *\n * @return {bool}\n */\n moveBy(offsetChangeX: number, offsetChangeY: number) {\n const offsetX =\n (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel;\n const offsetY =\n (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel;\n\n this._setNewOffsetPosition(offsetX, offsetY);\n }\n\n render() {\n const {\n staticPinIcon,\n children,\n visualTouchFeedbackEnabled,\n doubleTapDelay,\n staticPinPosition,\n onStaticPinLongPress,\n onStaticPinPress,\n pinProps,\n } = this.props;\n\n const { pinSize, touches, debugPoints = [] } = this.state;\n\n return (\n \n \n {children}\n \n\n {visualTouchFeedbackEnabled &&\n touches?.map(\n (touch) =>\n doubleTapDelay && (\n {\n this._removeTouch(touch);\n }}\n />\n )\n )}\n\n {/* For Debugging Only */}\n {debugPoints.map(({ x, y }, index) => {\n return ;\n })}\n\n {staticPinPosition && (\n {\n this.setState({ pinSize: size });\n }}\n pinProps={pinProps}\n />\n )}\n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'center',\n flex: 1,\n justifyContent: 'center',\n overflow: 'hidden',\n position: 'relative',\n },\n zoomSubject: {\n alignItems: 'center',\n flex: 1,\n justifyContent: 'center',\n width: '100%',\n },\n});\n\nexport default ReactNativeZoomableView;\n\nexport { ReactNativeZoomableView };\n"]} \ No newline at end of file +{"version":3,"names":["_lodash","require","_react","_interopRequireWildcard","_reactNative","_animations","_components","_StaticPin","_debugHelper","_helper","_applyPanBoundariesToOffset","_coordinateConversion","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","initialState","originalWidth","originalHeight","originalPageX","originalPageY","originalX","originalY","pinSize","width","height","ReactNativeZoomableView","Component","defaultProps","zoomEnabled","panEnabled","initialZoom","initialOffsetX","initialOffsetY","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","movementSensibility","doubleTapDelay","bindToBorders","zoomStep","onLongPress","longPressDuration","contentWidth","undefined","contentHeight","panBoundaryPadding","visualTouchFeedbackEnabled","staticPinPosition","staticPinIcon","onStaticPinPositionChange","onStaticPinPositionMove","animatePin","disablePanOnInitialZoom","panAnim","Animated","ValueXY","x","y","zoomAnim","Value","pinAnim","__offsets","value","boundaryCrossedAnimInEffect","zoomLevel","lastGestureCenterPosition","lastGestureTouchDistance","_gestureStarted","gestureStarted","v","longPressTimeout","touches","constructor","props","state","gestureHandlers","PanResponder","create","onStartShouldSetPanResponder","_handleStartShouldSetPanResponder","onPanResponderGrant","_handlePanResponderGrant","onPanResponderMove","_handlePanResponderMove","onPanResponderRelease","_handlePanResponderEnd","onPanResponderTerminate","evt","gestureState","_getZoomableViewEventObject","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomSubjectWrapperRef","createRef","zoomAnimatedValue","panAnimatedValueXY","offsetX","offsetY","setValue","addListener","gestureType","raisePin","timing","toValue","useNativeDriver","easing","Easing","out","ease","duration","start","dropPin","__setOffset","__getOffset","axis","offset","offsetState","containerSize","contentSize","boundOffset","applyPanBoundariesToOffset","boundariesApplied","toFixed","getBoundaryCrossedAnim","componentDidUpdate","prevProps","prevState","onTransformInvocationInitialized","_invokeOnTransform","successful","currState","originalMeasurementsChanged","staticPinPositionChanged","layout","onLayout","nativeEvent","componentDidMount","measureZoomSubject","measureZoomSubjectInterval","setInterval","componentWillUnmount","clearInterval","debouncedOnStaticPinPositionChange","debounce","position","zoomableViewEvent","_staticPinPosition","onTransform","overwriteObj","requestAnimationFrame","setTimeout","current","measure","pageX","pageY","setState","persist","stopAnimation","_resolveAndHandleTap","debugPoints","disableMomentum","getPanMomentumDecayAnim","vx","vy","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","calcNewScaledOffsetForZoomCentering","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","newOffsetX","newOffsetY","onShiftingBefore","onShiftingAfter","now","Date","doubleTapFirstTapReleaseTimestamp","doubleTapFirstTap","_addTouch","id","toString","isSecondTap","singleTapTimeoutId","_handleDoubleTap","tapX","tapY","onSingleTap","moveStaticPinTo","pinX","pinY","viewportPositionToImagePosition","viewportPosition","imageSize","zoomableEvent","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","zoomTo","listenerId","prevScale","getZoomToAnimation","removeListener","zoomBy","zoomLevelChange","moveTo","moveBy","offsetChangeX","offsetChangeY","render","children","onStaticPinLongPress","onStaticPinPress","pinProps","jsxs","View","style","styles","container","panHandlers","ref","jsx","zoomSubject","transform","scaleX","scaleY","getTranslateTransform","map","AnimatedTouchFeedback","animationDuration","onAnimationDone","index","DebugTouchPoint","StaticPin","onPress","onParentMove","setPinSize","size","exports","StyleSheet","alignItems","flex","justifyContent","overflow","_default"],"sourceRoot":"../../src","sources":["ReactNativeZoomableView.tsx"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,uBAAA,CAAAF,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AE;IACXkB,UAAU,EAAE,QAAQ;IACpBC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBzQ,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAAC,IAAA2Q,QAAA,GAAAN,OAAA,CAAAtR,OAAA,GAEYmB,uBAAuB","ignoreList":[]} diff --git a/lib/commonjs/animations/index.js b/lib/commonjs/animations/index.js index 50cd3e9..83bff6a 100644 --- a/lib/commonjs/animations/index.js +++ b/lib/commonjs/animations/index.js @@ -6,9 +6,7 @@ Object.defineProperty(exports, "__esModule", { exports.getBoundaryCrossedAnim = getBoundaryCrossedAnim; exports.getPanMomentumDecayAnim = getPanMomentumDecayAnim; exports.getZoomToAnimation = getZoomToAnimation; - var _reactNative = require("react-native"); - function getBoundaryCrossedAnim(animValue, toValue) { return _reactNative.Animated.spring(animValue, { overshootClamping: true, @@ -16,7 +14,6 @@ function getBoundaryCrossedAnim(animValue, toValue) { useNativeDriver: true }); } - function getPanMomentumDecayAnim(animValue, velocity) { return _reactNative.Animated.decay(animValue, { velocity, @@ -24,7 +21,6 @@ function getPanMomentumDecayAnim(animValue, velocity) { useNativeDriver: true }); } - function getZoomToAnimation(animValue, toValue) { return _reactNative.Animated.timing(animValue, { easing: _reactNative.Easing.out(_reactNative.Easing.ease), diff --git a/lib/commonjs/animations/index.js.map b/lib/commonjs/animations/index.js.map index ab66f9b..fd01704 100644 --- a/lib/commonjs/animations/index.js.map +++ b/lib/commonjs/animations/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":["getBoundaryCrossedAnim","animValue","toValue","Animated","spring","overshootClamping","useNativeDriver","getPanMomentumDecayAnim","velocity","decay","deceleration","getZoomToAnimation","timing","easing","Easing","out","ease"],"mappings":";;;;;;;;;AAAA;;AAIO,SAASA,sBAAT,CACLC,SADK,EAELC,OAFK,EAGL;AACA,SAAOC,sBAASC,MAAT,CAAgBH,SAAhB,EAA2B;AAChCI,IAAAA,iBAAiB,EAAE,IADa;AAEhCH,IAAAA,OAFgC;AAGhCI,IAAAA,eAAe,EAAE;AAHe,GAA3B,CAAP;AAKD;;AAEM,SAASC,uBAAT,CACLN,SADK,EAELO,QAFK,EAGL;AACA,SAAOL,sBAASM,KAAT,CAAeR,SAAf,EAA0B;AAC/BO,IAAAA,QAD+B;AAE/BE,IAAAA,YAAY,EAAE,KAFiB;AAG/BJ,IAAAA,eAAe,EAAE;AAHc,GAA1B,CAAP;AAKD;;AAEM,SAASK,kBAAT,CAA4BV,SAA5B,EAAuDC,OAAvD,EAAwE;AAC7E,SAAOC,sBAASS,MAAT,CAAgBX,SAAhB,EAA2B;AAChCY,IAAAA,MAAM,EAAEC,oBAAOC,GAAP,CAAWD,oBAAOE,IAAlB,CADwB;AAEhCd,IAAAA,OAFgC;AAGhCI,IAAAA,eAAe,EAAE;AAHe,GAA3B,CAAP;AAKD","sourcesContent":["import { Animated, Easing } from 'react-native';\n\nimport { Vec2D } from '../typings';\n\nexport function getBoundaryCrossedAnim(\n animValue: Animated.Value,\n toValue: number\n) {\n return Animated.spring(animValue, {\n overshootClamping: true,\n toValue,\n useNativeDriver: true,\n });\n}\n\nexport function getPanMomentumDecayAnim(\n animValue: Animated.Value | Animated.ValueXY,\n velocity: number | Vec2D\n) {\n return Animated.decay(animValue, {\n velocity,\n deceleration: 0.994,\n useNativeDriver: true,\n });\n}\n\nexport function getZoomToAnimation(animValue: Animated.Value, toValue: number) {\n return Animated.timing(animValue, {\n easing: Easing.out(Easing.ease),\n toValue,\n useNativeDriver: true,\n });\n}\n"]} \ No newline at end of file +{"version":3,"names":["_reactNative","require","getBoundaryCrossedAnim","animValue","toValue","Animated","spring","overshootClamping","useNativeDriver","getPanMomentumDecayAnim","velocity","decay","deceleration","getZoomToAnimation","timing","easing","Easing","out","ease"],"sourceRoot":"../../../src","sources":["animations/index.ts"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAIO,SAASC,sBAAsBA,CACpCC,SAAyB,EACzBC,OAAe,EACf;EACA,OAAOC,qBAAQ,CAACC,MAAM,CAACH,SAAS,EAAE;IAChCI,iBAAiB,EAAE,IAAI;IACvBH,OAAO;IACPI,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ;AAEO,SAASC,uBAAuBA,CACrCN,SAA4C,EAC5CO,QAAwB,EACxB;EACA,OAAOL,qBAAQ,CAACM,KAAK,CAACR,SAAS,EAAE;IAC/BO,QAAQ;IACRE,YAAY,EAAE,KAAK;IACnBJ,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ;AAEO,SAASK,kBAAkBA,CAACV,SAAyB,EAAEC,OAAe,EAAE;EAC7E,OAAOC,qBAAQ,CAACS,MAAM,CAACX,SAAS,EAAE;IAChCY,MAAM,EAAEC,mBAAM,CAACC,GAAG,CAACD,mBAAM,CAACE,IAAI,CAAC;IAC/Bd,OAAO;IACPI,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ","ignoreList":[]} diff --git a/lib/commonjs/components/AnimatedTouchFeedback.js b/lib/commonjs/components/AnimatedTouchFeedback.js index eab34df..02a15b8 100644 --- a/lib/commonjs/components/AnimatedTouchFeedback.js +++ b/lib/commonjs/components/AnimatedTouchFeedback.js @@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.AnimatedTouchFeedback = void 0; - var _react = _interopRequireWildcard(require("react")); - var _reactNative = require("react-native"); - -function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } - -function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } - +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, @@ -27,7 +22,6 @@ const AnimatedTouchFeedback = ({ 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, @@ -39,13 +33,9 @@ const AnimatedTouchFeedback = ({ duration: outDuration, easing: _reactNative.Easing.out(_reactNative.Easing.ease), useNativeDriver: true - })]).start(() => { - var _onAnimationDoneRef$c; - - return (_onAnimationDoneRef$c = onAnimationDoneRef.current) === null || _onAnimationDoneRef$c === void 0 ? void 0 : _onAnimationDoneRef$c.call(onAnimationDoneRef); - }); + })]).start(() => onAnimationDoneRef.current?.()); }, [animationDelay, animationDuration]); - return /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, { + return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { pointerEvents: "none", style: [styles.animatedTouchFeedback, { opacity: appearDisappearAnimRef.current.interpolate({ @@ -63,9 +53,7 @@ const AnimatedTouchFeedback = ({ }] }); }; - exports.AnimatedTouchFeedback = AnimatedTouchFeedback; - const styles = _reactNative.StyleSheet.create({ animatedTouchFeedback: { backgroundColor: 'lightgray', diff --git a/lib/commonjs/components/AnimatedTouchFeedback.js.map b/lib/commonjs/components/AnimatedTouchFeedback.js.map index 7c31ae2..b33e7fb 100644 --- a/lib/commonjs/components/AnimatedTouchFeedback.js.map +++ b/lib/commonjs/components/AnimatedTouchFeedback.js.map @@ -1 +1 @@ -{"version":3,"sources":["AnimatedTouchFeedback.tsx"],"names":["AnimatedTouchFeedback","x","y","animationDelay","animationDuration","onAnimationDone","appearDisappearAnimRef","Animated","Value","onAnimationDoneRef","current","setValue","inDuration","outDuration","sequence","timing","delay","toValue","duration","easing","Easing","linear","useNativeDriver","out","ease","start","styles","animatedTouchFeedback","opacity","interpolate","inputRange","outputRange","left","top","transform","scale","StyleSheet","create","backgroundColor","borderRadius","height","position","width"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAEO,MAAMA,qBAAqB,GAAG,CAAC;AACpCC,EAAAA,CADoC;AAEpCC,EAAAA,CAFoC;AAGpCC,EAAAA,cAHoC;AAIpCC,EAAAA,iBAJoC;AAKpCC,EAAAA;AALoC,CAAD,KAY/B;AACJ,QAAMC,sBAAsB,GAAG,mBAAuB,IAAIC,sBAASC,KAAb,CAAmB,CAAnB,CAAvB,CAA/B;AACA,QAAMC,kBAAkB,GAAG,mBAAOJ,eAAP,CAA3B;AACAI,EAAAA,kBAAkB,CAACC,OAAnB,GAA6BL,eAA7B;AAEA,wBAAU,MAAM;AACdC,IAAAA,sBAAsB,CAACI,OAAvB,CAA+BC,QAA/B,CAAwC,CAAxC;AACA,UAAMC,UAAU,GAAGR,iBAAiB,GAAG,GAAvC;AACA,UAAMS,WAAW,GAAGT,iBAAiB,GAAGQ,UAAxC;;AACAL,0BAASO,QAAT,CAAkB,CAChBP,sBAASQ,MAAT,CAAgBT,sBAAsB,CAACI,O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oC;AAEhDC,UAAAA,WAAW,EAAE,CAAC,GAAD,EAAM,CAAN;AAFmC,SAA3C;AADT,OADS;AAPb,KAFK;AAFT,IADF;AAwBD,CA9DM;;;;AAgEP,MAAML,MAAM,GAAGU,wBAAWC,MAAX,CAAkB;AAC/BV,EAAAA,qBAAqB,EAAE;AACrBW,IAAAA,eAAe,EAAE,WADI;AAErBC,IAAAA,YAAY,EAAE,EAFO;AAGrBC,IAAAA,MAAM,EAAE,EAHa;AAIrBC,IAAAA,QAAQ,EAAE,UAJW;AAKrBC,IAAAA,KAAK,EAAE;AALc;AADQ,CAAlB,CAAf","sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Animated, Easing, StyleSheet } from 'react-native';\n\nexport const AnimatedTouchFeedback = ({\n x,\n y,\n animationDelay,\n animationDuration,\n onAnimationDone,\n}: {\n x: number;\n y: number;\n animationDuration: number;\n animationDelay?: number;\n onAnimationDone?: () => void;\n}) => {\n const appearDisappearAnimRef = useRef(new Animated.Value(0));\n const onAnimationDoneRef = useRef(onAnimationDone);\n onAnimationDoneRef.current = onAnimationDone;\n\n useEffect(() => {\n appearDisappearAnimRef.current.setValue(0);\n const inDuration = animationDuration * 0.8;\n const outDuration = animationDuration - inDuration;\n Animated.sequence([\n Animated.timing(appearDisappearAnimRef.current, {\n delay: animationDelay || 0,\n toValue: 1,\n duration: inDuration,\n easing: Easing.linear,\n useNativeDriver: true,\n }),\n Animated.timing(appearDisappearAnimRef.current, {\n toValue: 0,\n duration: outDuration,\n easing: Easing.out(Easing.ease),\n useNativeDriver: true,\n }),\n ]).start(() => onAnimationDoneRef.current?.());\n }, [animationDelay, animationDuration]);\n\n return (\n \n );\n};\n\nconst styles = StyleSheet.create({\n animatedTouchFeedback: {\n backgroundColor: 'lightgray',\n borderRadius: 40,\n height: 40,\n position: 'absolute',\n width: 40,\n },\n});\n"]} \ No newline at end of file +{"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","height","position","width"],"sourceRoot":"../../../src","sources":["components/AnimatedTouchFeedback.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAA4D,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,wBAAAI,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAN,uBAAA,YAAAA,CAAAI,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,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AACG,KAAK,CAAC,MAAMjB,kBAAkB,CAACC,OAAO,GAAG,CAAC,CAAC;EAChD,CAAC,EAAE,CAACR,cAAc,EAAEC,iBAAiB,CAAC,CAAC;EAEvC,oBACE,IAAAxB,WAAA,CAAAgD,GAAA,EAACjD,YAAA,CAAA6B,QAAQ,CAACqB,IAAI;IACZC,aAAa,EAAC,MAAM;IACpBC,KAAK,EAAE,CACLC,MAAM,CAACC,qBAAqB,EAC5B;MACEC,OAAO,EAAE5B,sBAAsB,CAACK,OAAO,CAACwB,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 index 61e18bd..0edb95b 100644 --- a/lib/commonjs/components/StaticPin.js +++ b/lib/commonjs/components/StaticPin.js @@ -4,15 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.StaticPin = void 0; - var _react = _interopRequireDefault(require("react")); - var _reactNative = require("react-native"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - +var _jsxRuntime = require("react/jsx-runtime"); +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const StaticPin = ({ staticPinPosition, pinAnim, @@ -25,18 +20,17 @@ const StaticPin = ({ pinProps = {} }) => { const tapTime = _react.default.useRef(0); - const transform = [{ translateY: -pinSize.height }, { translateX: -pinSize.width / 2 }, ...pinAnim.getTranslateTransform()]; 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 + tapTime.current = Date.now(); + // We want to handle tap on this so set true return true; }, onPanResponderMove: (evt, gestureState) => { @@ -47,45 +41,44 @@ const StaticPin = ({ 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__*/_react.default.createElement(_reactNative.Animated.View, _extends({ + return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Animated.View, { style: [{ left: staticPinPosition.x, top: staticPinPosition.y }, styles.pinWrapper, { opacity, transform - }] - }, pinProps), /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({ - onLayout: ({ - nativeEvent: { - layout - } - }) => { - setPinSize(layout); - } - }, panResponder.panHandlers), staticPinIcon || - /*#__PURE__*/ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - _react.default.createElement(_reactNative.Image, { - source: require('../assets/pin.png'), - style: styles.pin - }))); + }], + ...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, diff --git a/lib/commonjs/components/StaticPin.js.map b/lib/commonjs/components/StaticPin.js.map index 9b74671..8e3d3ad 100644 --- a/lib/commonjs/components/StaticPin.js.map +++ b/lib/commonjs/components/StaticPin.js.map @@ -1 +1 @@ -{"version":3,"sources":["StaticPin.tsx"],"names":["StaticPin","staticPinPosition","pinAnim","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","React","useRef","transform","translateY","height","translateX","width","getTranslateTransform","opacity","panResponder","PanResponder","create","onStartShouldSetPanResponder","current","Date","now","onPanResponderMove","evt","gestureState","Math","abs","dx","dy","onPanResponderRelease","dt","left","x","top","y","styles","pinWrapper","nativeEvent","layout","panHandlers","require","pin","StyleSheet","position"],"mappings":";;;;;;;AAAA;;AACA;;;;;;AAYO,MAAMA,SAAS,GAAG,CAAC;AACxBC,EAAAA,iBADwB;AAExBC,EAAAA,OAFwB;AAGxBC,EAAAA,aAHwB;AAIxBC,EAAAA,OAJwB;AAKxBC,EAAAA,YALwB;AAMxBC,EAAAA,OANwB;AAOxBC,EAAAA,WAPwB;AAQxBC,EAAAA,UARwB;AASxBC,EAAAA,QAAQ,GAAG;AATa,CAAD,KAwBnB;AACJ,QAAMC,OAAO,GAAGC,eAAMC,MAAN,CAAa,CAAb,CAAhB;;AACA,QAAMC,SAAS,GAAG,CAChB;AAAEC,IAAAA,UAAU,EAAE,CAACV,OAAO,CAACW;AAAvB,GADgB,EAEhB;AAAEC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ACE,6BAAC,qBAAD,CAAU,IAAV;AACE,IAAA,KAAK,EAAE,CACL;AACEY,MAAAA,IAAI,EAAEnC,iBAAiB,CAACoC,CAD1B;AAEEC,MAAAA,GAAG,EAAErC,iBAAiB,CAACsC;AAFzB,KADK,EAKLC,MAAM,CAACC,UALF,EAML;AAAEtB,MAAAA,OAAF;AAAWN,MAAAA;AAAX,KANK;AADT,KASMJ,QATN,gBAWE,6BAAC,iBAAD;AACE,IAAA,QAAQ,EAAE,CAAC;AAAEiC,MAAAA,WAAW,EAAE;AAAEC,QAAAA;AAAF;AAAf,KAAD,KAAiC;AACzCnC,MAAAA,UAAU,CAACmC,MAAD,CAAV;AACD;AAHH,KAIMvB,YAAY,CAACwB,WAJnB,GAMGzC,aAAa;AAAA;AACZ;AACA,+BAAC,kBAAD;AAAO,IAAA,MAAM,EAAE0C,OAAO,CAAC,mBAAD,CAAtB;AAA6C,IAAA,KAAK,EAAEL,MAAM,CAACM;AAA3D,IARJ,CAXF,CADF;AAyBD,CAxFM;;;;AA0FP,MAAMN,MAAM,GAAGO,wBAAWzB,MAAX,CAAkB;AAC/BwB,EAAAA,GAAG,EAAE;AACH/B,IAAAA,MAAM,EAAE,EADL;AAEHE,IAAAA,KAAK,EAAE;AAFJ,GAD0B;AAK/BwB,EAAAA,UAAU,EAAE;AACVO,IAAAA,QAAQ,EAAE;AADA;AALmB,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport {\n Animated,\n GestureResponderEvent,\n Image,\n PanResponder,\n PanResponderGestureState,\n StyleSheet,\n View,\n ViewProps,\n} from 'react-native';\nimport { Size2D } from 'src/typings';\n\nexport const StaticPin = ({\n staticPinPosition,\n pinAnim,\n staticPinIcon,\n pinSize,\n onParentMove,\n onPress,\n onLongPress,\n setPinSize,\n pinProps = {},\n}: {\n staticPinPosition: { x: number; y: number };\n pinAnim: Animated.ValueXY;\n staticPinIcon: React.ReactNode;\n pinSize: Size2D;\n /** Internal handler for passing move event to parent */\n onParentMove: (\n evt: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => boolean | undefined;\n onPress?: (evt: GestureResponderEvent) => void;\n onLongPress?: (evt: GestureResponderEvent) => void;\n setPinSize: (size: Size2D) => void;\n pinProps?: ViewProps;\n}) => {\n const tapTime = React.useRef(0);\n const transform = [\n { translateY: -pinSize.height },\n { translateX: -pinSize.width / 2 },\n ...pinAnim.getTranslateTransform(),\n ];\n\n const opacity = pinSize.width && pinSize.height ? 1 : 0;\n\n const panResponder = React.useRef(\n PanResponder.create({\n onStartShouldSetPanResponder: () => {\n tapTime.current = Date.now();\n\n // We want to handle tap on this so set true\n return true;\n },\n onPanResponderMove: (evt, gestureState) => {\n // However if the user moves finger we want to pass this evt to parent\n // to handle panning (tap not recognized)\n if (Math.abs(gestureState.dx) > 5 && Math.abs(gestureState.dy) > 5)\n onParentMove(evt, gestureState);\n },\n onPanResponderRelease: (evt, gestureState) => {\n if (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)\n return;\n const dt = Date.now() - tapTime.current;\n if (onPress && dt < 500) {\n onPress(evt);\n }\n if (onLongPress && dt > 500) {\n // RN long press is 500ms\n onLongPress(evt);\n }\n },\n })\n ).current;\n\n return (\n \n {\n setPinSize(layout);\n }}\n {...panResponder.panHandlers}\n >\n {staticPinIcon || (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n \n )}\n \n \n );\n};\n\nconst styles = StyleSheet.create({\n pin: {\n height: 64,\n width: 48,\n },\n pinWrapper: {\n position: 'absolute',\n },\n});\n"]} \ No newline at end of file +{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","StaticPin","staticPinPosition","pinAnim","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","React","useRef","transform","translateY","height","translateX","width","getTranslateTransform","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,OAAO;EACPC,aAAa;EACbC,OAAO;EACPC,YAAY;EACZC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,QAAQ,GAAG,CAAC;AAed,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,EAClC,GAAGf,OAAO,CAACgB,qBAAqB,CAAC,CAAC,CACnC;EAED,MAAMC,OAAO,GAAGf,OAAO,CAACa,KAAK,IAAIb,OAAO,CAACW,MAAM,GAAG,CAAC,GAAG,CAAC;EAEvD,MAAMK,YAAY,GAAGT,cAAK,CAACC,MAAM,CAC/BS,yBAAY,CAACC,MAAM,CAAC;IAClBC,4BAA4B,EAAEA,CAAA,KAAM;MAClCb,OAAO,CAACc,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,GA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wC,GAAA,EAACzC,YAAA,CAAAwD,KAAK;QAACC,MAAM,EAAE1D,OAAO,CAAC,mBAAmB,CAAE;QAAC6C,KAAK,EAAEK,MAAM,CAACS;MAAI,CAAE;IAClE,CACG;EAAC,CACM,CAAC;AAEpB,CAAC;AAACC,OAAA,CAAAtD,SAAA,GAAAA,SAAA;AAEF,MAAM4C,MAAM,GAAGW,uBAAU,CAACjC,MAAM,CAAC;EAC/B+B,GAAG,EAAE;IACHtC,MAAM,EAAE,EAAE;IACVE,KAAK,EAAE;EACT,CAAC;EACD4B,UAAU,EAAE;IACVW,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/commonjs/components/index.js b/lib/commonjs/components/index.js index ac2c097..00f88b3 100644 --- a/lib/commonjs/components/index.js +++ b/lib/commonjs/components/index.js @@ -9,6 +9,5 @@ Object.defineProperty(exports, "AnimatedTouchFeedback", { 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 index 363d858..2f76807 100644 --- a/lib/commonjs/components/index.js.map +++ b/lib/commonjs/components/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA","sourcesContent":["export { AnimatedTouchFeedback } from './AnimatedTouchFeedback';\n"]} \ No newline at end of file +{"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 index 0ac1e56..75beac3 100644 --- a/lib/commonjs/debugHelper/index.js +++ b/lib/commonjs/debugHelper/index.js @@ -4,13 +4,10 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.DebugTouchPoint = exports.DebugRect = void 0; - var _react = _interopRequireDefault(require("react")); - var _reactNative = require("react-native"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - +var _jsxRuntime = require("react/jsx-runtime"); +function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const DebugTouchPoint = ({ diameter = 20, x = 0, @@ -18,7 +15,7 @@ const DebugTouchPoint = ({ color = 'yellow' }) => { const radius = diameter / 2; - return /*#__PURE__*/_react.default.createElement(_reactNative.View, { + return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { style: [styles.debugPoint, { width: diameter, height: diameter, @@ -30,9 +27,7 @@ const DebugTouchPoint = ({ pointerEvents: "none" }); }; - exports.DebugTouchPoint = DebugTouchPoint; - const DebugRect = ({ height, x = 0, @@ -40,7 +35,7 @@ const DebugRect = ({ color = 'yellow' }) => { const width = 5; - return /*#__PURE__*/_react.default.createElement(_reactNative.View, { + return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, { style: [styles.debugRect, { width, height, @@ -51,9 +46,7 @@ const DebugRect = ({ pointerEvents: "none" }); }; - exports.DebugRect = DebugRect; - const styles = _reactNative.StyleSheet.create({ debugPoint: { opacity: 0.7, diff --git a/lib/commonjs/debugHelper/index.js.map b/lib/commonjs/debugHelper/index.js.map index d73e3c8..8e47667 100644 --- a/lib/commonjs/debugHelper/index.js.map +++ b/lib/commonjs/debugHelper/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.tsx"],"names":["DebugTouchPoint","diameter","x","y","color","radius","styles","debugPoint","width","height","borderRadius","backgroundColor","left","top","DebugRect","debugRect","StyleSheet","create","opacity","position"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEO,MAAMA,eAAe,GAAG,CAAC;AAC9BC,EAAAA,QAAQ,GAAG,EADmB;AAE9BC,EAAAA,CAAC,GAAG,CAF0B;AAG9BC,EAAAA,CAAC,GAAG,CAH0B;AAI9BC,EAAAA,KAAK,GAAG;AAJsB,CAAD,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native';\n\nexport const DebugTouchPoint = ({\n diameter = 20,\n x = 0,\n y = 0,\n color = 'yellow',\n}) => {\n const radius = diameter / 2;\n return (\n \n );\n};\nexport const DebugRect = ({\n height,\n x = 0,\n y = 0,\n color = 'yellow',\n}: {\n height: number;\n x: number;\n y: number;\n color: string;\n}) => {\n const width = 5;\n return (\n \n );\n};\n\nconst styles = StyleSheet.create({\n debugPoint: {\n opacity: 0.7,\n position: 'absolute',\n },\n debugRect: {\n opacity: 0.5,\n position: 'absolute',\n },\n});\n"]} \ No newline at end of file +{"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,CAAA;AAEzC,MAAMG,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,oBACE,IAAAL,WAAA,CAAAU,GAAA,EAACX,YAAA,CAAAY,IAAI;IACHC,KAAK,EAAE,CACLC,MAAM,CAACC,UAAU,EACjB;MACEC,KAAK,EAAEV,QAAQ;MACfW,MAAM,EAAEX,QAAQ;MAChBY,YAAY,EAAEZ,QAAQ;MACtBa,eAAe,EAAEV,KAAK;MACtBW,IAAI,EAAEb,CAAC,GAAGG,MAAM;MAChBW,GAAG,EAAEb,CAAC,GAAGE;IACX,CAAC,CACD;IACFY,aAAa,EAAC;EAAM,CACrB,CAAC;AAEN,CAAC;AAACC,OAAA,CAAAlB,eAAA,GAAAA,eAAA;AACK,MAAMmB,SAAS,GAAGA,CAAC;EACxBP,MAAM;EACNV,CAAC,GAAG,CAAC;EACLC,CAAC,GAAG,CAAC;EACLC,KAAK,GAAG;AAMV,CAAC,KAAK;EACJ,MAAMO,KAAK,GAAG,CAAC;EACf,oBACE,IAAAf,WAAA,CAAAU,GAAA,EAACX,YAAA,CAAAY,IAAI;IACHC,KAAK,EAAE,CACLC,MAAM,CAACW,SAAS,EAChB;MACET,KAAK;MACLC,MAAM;MACNE,eAAe,EAAEV,KAAK;MACtBW,IAAI,EAAEb,CAAC,GAAGS,KAAK,GAAG,CAAC;MACnBK,GAAG,EAAEb;IACP,CAAC,CACD;IACFc,aAAa,EAAC;EAAM,CACrB,CAAC;AAEN,CAAC;AAACC,OAAA,CAAAC,SAAA,GAAAA,SAAA;AAEF,MAAMV,MAAM,GAAGY,uBAAU,CAACC,MAAM,CAAC;EAC/BZ,UAAU,EAAE;IACVa,OAAO,EAAE,GAAG;IACZC,QAAQ,EAAE;EACZ,CAAC;EACDJ,SAAS,EAAE;IACTG,OAAO,EAAE,GAAG;IACZC,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/commonjs/helper/applyPanBoundariesToOffset.js b/lib/commonjs/helper/applyPanBoundariesToOffset.js index 2cea298..1b474da 100644 --- a/lib/commonjs/helper/applyPanBoundariesToOffset.js +++ b/lib/commonjs/helper/applyPanBoundariesToOffset.js @@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.applyPanBoundariesToOffset = applyPanBoundariesToOffset; - /** * Takes a single offset value and calculates the correct offset value * to make sure it's within the pan boundaries @@ -24,38 +23,41 @@ function applyPanBoundariesToOffset(offsetScaled, containerSize, contentSize, sc const contentStartBorderUnscaled = containerSize / 2 + offsetUnscaled - contentSizeUnscaled / 2; const contentEndBorderUnscaled = contentStartBorderUnscaled + contentSizeUnscaled; const containerStartBorder = 0; - const containerEndBorder = containerStartBorder + containerSize; // do not let boundary padding be greater than the container size or less than 0 + const containerEndBorder = containerStartBorder + containerSize; + // do not let boundary padding be greater than the container size or less than 0 if (!boundaryPadding || boundaryPadding < 0) boundaryPadding = 0; - if (boundaryPadding > containerSize) boundaryPadding = containerSize; // Calculate container's measurements with boundary padding applied. + if (boundaryPadding > containerSize) boundaryPadding = containerSize; + + // Calculate container's measurements with boundary padding applied. // this should shrink the container's size by the amount of the boundary padding, // so that the content inside can be panned a bit further away from the original container's boundaries. - const paddedContainerSize = containerSize - boundaryPadding * 2; const paddedContainerStartBorder = containerStartBorder + boundaryPadding; - const paddedContainerEndBorder = containerEndBorder - boundaryPadding; // if content is smaller than the padded container, - // don't let the content move + const paddedContainerEndBorder = containerEndBorder - boundaryPadding; + // if content is smaller than the padded container, + // don't let the content move if (contentSizeUnscaled < paddedContainerSize) { return 0; - } // if content is larger than the padded container, + } + + // if content is larger than the padded container, // don't let the padded container go outside of content + // maximum distance the content's center can move from its original position. // assuming the content original center is the container's center. - - const contentMaxOffsetScaled = (paddedContainerSize / 2 - contentSizeUnscaled / 2) / scale; - - if ( // content reaching the end boundary + if ( + // content reaching the end boundary contentEndBorderUnscaled < paddedContainerEndBorder) { return contentMaxOffsetScaled; } - - if ( // content reaching the start boundary + if ( + // content reaching the start boundary contentStartBorderUnscaled > paddedContainerStartBorder) { return -contentMaxOffsetScaled; } - return offsetScaled; } //# sourceMappingURL=applyPanBoundariesToOffset.js.map \ No newline at end of file diff --git a/lib/commonjs/helper/applyPanBoundariesToOffset.js.map b/lib/commonjs/helper/applyPanBoundariesToOffset.js.map index 92ab44e..e8b9162 100644 --- a/lib/commonjs/helper/applyPanBoundariesToOffset.js.map +++ b/lib/commonjs/helper/applyPanBoundariesToOffset.js.map @@ -1 +1 @@ -{"version":3,"sources":["applyPanBoundariesToOffset.ts"],"names":["applyPanBoundariesToOffset","offsetScaled","containerSize","contentSize","scale","boundaryPadding","contentSizeUnscaled","offsetUnscaled","contentStartBorderUnscaled","contentEndBorderUnscaled","containerStartBorder","containerEndBorder","paddedContainerSize","paddedContainerStartBorder","paddedContainerEndBorder","contentMaxOffsetScaled"],"mappings":";;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,0BAAT,CACLC,YADK,EAELC,aAFK,EAGLC,WAHK,EAILC,KAJK,EAKLC,eALK,EAML;AACA,QAAMC,mBAAmB,GAAGH,WAAW,GAAGC,KAA1C;AACA,QAAMG,cAAc,GAAGN,YAAY,GAAGG,KAAtC;AAEA,QAAMI,0BAA0B,GAC9BN,aAAa,GAAG,CAAhB,GAAoBK,cAApB,GAAqCD,mBAAmB,GAAG,CAD7D;AAEA,QAAMG,wBAAwB,GAC5BD,0BAA0B,GAAGF,mBAD/B;AAGA,QAAMI,oBAAoB,GAAG,CAA7B;AACA,QAAMC,kBAAkB,GAAGD,oBAAoB,GAAGR,aAAlD,CAVA,CAYA;;AACA,MAAI,CAACG,eAAD,IAAoBA,eAAe,GAAG,CAA1C,EAA6CA,eAAe,GAAG,CAAlB;AAC7C,MAAIA,eAAe,GAAGH,aAAtB,EAAqCG,eAAe,GAAGH,aAAlB,CAdrC,CAgBA;AACA;AACA;;AACA,QAAMU,mBAAmB,GAAGV,aAAa,GAAGG,eAAe,GAAG,CAA9D;AACA,QAAMQ,0BAA0B,GAAGH,oBAAoB,GAAGL,eAA1D;AACA,QAAMS,wBAAwB,GAAGH,kBAAkB,GAAGN,eAAtD,CArBA,CAuBA;AACA;;AACA,MAAIC,mBAAmB,GAAGM,mBAA1B,EAA+C;AAC7C,WAAO,CAAP;AACD,GA3BD,CA6BA;AACA;AAEA;AACA;;;AACA,QAAMG,sBAAsB,GAC1B,CAACH,mBAAmB,GAAG,CAAtB,GAA0BN,mBAAmB,GAAG,CAAjD,IAAsDF,KADxD;;AAGA,OACE;AACAK,EAAAA,wBAAwB,GAAGK,wBAF7B,EAGE;AACA,WAAOC,sBAAP;AACD;;AACD,OACE;AACAP,EAAAA,0BAA0B,GAAGK,0BAF/B,EAGE;AACA,WAAO,CAACE,sBAAR;AACD;;AAED,SAAOd,YAAP;AACD","sourcesContent":["/**\n * Takes a single offset value and calculates the correct offset value\n * to make sure it's within the pan boundaries\n *\n *\n * @param offsetScaled\n * @param containerSize\n * @param contentSize\n * @param scale\n * @param boundaryPadding - see README\n *\n * @returns {number}\n */\nexport function applyPanBoundariesToOffset(\n offsetScaled: number,\n containerSize: number,\n contentSize: number,\n scale: number,\n boundaryPadding: number\n) {\n const contentSizeUnscaled = contentSize * scale;\n const offsetUnscaled = offsetScaled * scale;\n\n const contentStartBorderUnscaled =\n containerSize / 2 + offsetUnscaled - contentSizeUnscaled / 2;\n const contentEndBorderUnscaled =\n contentStartBorderUnscaled + contentSizeUnscaled;\n\n const containerStartBorder = 0;\n const containerEndBorder = containerStartBorder + containerSize;\n\n // do not let boundary padding be greater than the container size or less than 0\n if (!boundaryPadding || boundaryPadding < 0) boundaryPadding = 0;\n if (boundaryPadding > containerSize) boundaryPadding = containerSize;\n\n // Calculate container's measurements with boundary padding applied.\n // this should shrink the container's size by the amount of the boundary padding,\n // so that the content inside can be panned a bit further away from the original container's boundaries.\n const paddedContainerSize = containerSize - boundaryPadding * 2;\n const paddedContainerStartBorder = containerStartBorder + boundaryPadding;\n const paddedContainerEndBorder = containerEndBorder - boundaryPadding;\n\n // if content is smaller than the padded container,\n // don't let the content move\n if (contentSizeUnscaled < paddedContainerSize) {\n return 0;\n }\n\n // if content is larger than the padded container,\n // don't let the padded container go outside of content\n\n // maximum distance the content's center can move from its original position.\n // assuming the content original center is the container's center.\n const contentMaxOffsetScaled =\n (paddedContainerSize / 2 - contentSizeUnscaled / 2) / scale;\n\n if (\n // content reaching the end boundary\n contentEndBorderUnscaled < paddedContainerEndBorder\n ) {\n return contentMaxOffsetScaled;\n }\n if (\n // content reaching the start boundary\n contentStartBorderUnscaled > paddedContainerStartBorder\n ) {\n return -contentMaxOffsetScaled;\n }\n\n return offsetScaled;\n}\n"]} \ No newline at end of file +{"version":3,"names":["applyPanBoundariesToOffset","offsetScaled","containerSize","contentSize","scale","boundaryPadding","contentSizeUnscaled","offsetUnscaled","contentStartBorderUnscaled","contentEndBorderUnscaled","containerStartBorder","containerEndBorder","paddedContainerSize","paddedContainerStartBorder","paddedContainerEndBorder","contentMaxOffsetScaled"],"sourceRoot":"../../../src","sources":["helper/applyPanBoundariesToOffset.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,0BAA0BA,CACxCC,YAAoB,EACpBC,aAAqB,EACrBC,WAAmB,EACnBC,KAAa,EACbC,eAAuB,EACvB;EACA,MAAMC,mBAAmB,GAAGH,WAAW,GAAGC,KAAK;EAC/C,MAAMG,cAAc,GAAGN,YAAY,GAAGG,KAAK;EAE3C,MAAMI,0BAA0B,GAC9BN,aAAa,GAAG,CAAC,GAAGK,cAAc,GAAGD,mBAAmB,GAAG,CAAC;EAC9D,MAAMG,wBAAwB,GAC5BD,0BAA0B,GAAGF,mBAAmB;EAElD,MAAMI,oBAAoB,GAAG,CAAC;EAC9B,MAAMC,kBAAkB,GAAGD,oBAAoB,GAAGR,aAAa;;EAE/D;EACA,IAAI,CAACG,eAAe,IAAIA,eAAe,GAAG,CAAC,EAAEA,eAAe,GAAG,CAAC;EAChE,IAAIA,eAAe,GAAGH,aAAa,EAAEG,eAAe,GAAGH,aAAa;;EAEpE;EACA;EACA;EACA,MAAMU,mBAAmB,GAAGV,aAAa,GAAGG,eAAe,GAAG,CAAC;EAC/D,MAAMQ,0BAA0B,GAAGH,oBAAoB,GAAGL,eAAe;EACzE,MAAMS,wBAAwB,GAAGH,kBAAkB,GAAGN,eAAe;;EAErE;EACA;EACA,IAAIC,mBAAmB,GAAGM,mBAAmB,EAAE;IAC7C,OAAO,CAAC;EACV;;EAEA;EACA;;EAEA;EACA;EACA,MAAMG,sBAAsB,GAC1B,CAACH,mBAAmB,GAAG,CAAC,GAAGN,mBAAmB,GAAG,CAAC,IAAIF,KAAK;EAE7D;EACE;EACAK,wBAAwB,GAAGK,wBAAwB,EACnD;IACA,OAAOC,sBAAsB;EAC/B;EACA;EACE;EACAP,0BAA0B,GAAGK,0BAA0B,EACvD;IACA,OAAO,CAACE,sBAAsB;EAChC;EAEA,OAAOd,YAAY;AACrB","ignoreList":[]} diff --git a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js index 1147132..cdf9a30 100644 --- a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js +++ b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js @@ -4,7 +4,6 @@ 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 @@ -57,8 +56,9 @@ exports.calcNewScaledOffsetForZoomCentering = calcNewScaledOffsetForZoomCenterin */ 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 growthRate = newScale / oldScale; + // these act like namespaces just for the sake of readability const zoomSubjectOriginalCenter = {}; const zoomSubjectCurrentCenter = {}; const zoomSubjectNewCenter = {}; diff --git a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map index d2beba7..0b6bb9c 100644 --- a/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map +++ b/lib/commonjs/helper/calcNewScaledOffsetForZoomCentering.js.map @@ -1 +1 @@ -{"version":3,"sources":["calcNewScaledOffsetForZoomCentering.ts"],"names":["calcNewScaledOffsetForZoomCentering","oldOffsetXOrYScaled","zoomSubjectOriginalWidthOrHeight","oldScale","newScale","zoomCenterXOrY","oldOffSetUnscaled","growthRate","zoomSubjectOriginalCenter","zoomSubjectCurrentCenter","zoomSubjectNewCenter","xOrY","distanceToZoomCenter","newOffsetUnscaled"],"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,mCAAT,CACLC,mBADK,EAELC,gCAFK,EAGLC,QAHK,EAILC,QAJK,EAKLC,cALK,EAML;AACA,QAAMC,iBAAiB,GAAGL,mBAAmB,GAAGE,QAAhD;AACA,QAAMI,UAAU,GAAGH,QAAQ,GAAGD,QAA9B,CAFA,CAIA;;AACA,QAAMK,yBAAyB,GAAG,EAAlC;AACA,QAAMC,wBAAwB,GAAG,EAAjC;AACA,QAAMC,oBAAoB,GAAG,EAA7B;AAEAF,EAAAA,yBAAyB,CAACG,IAA1B,GAAiCT,gCAAgC,GAAG,CAApE;AACAO,EAAAA,wBAAwB,CAACE,IAAzB,GACEH,yBAAyB,CAACG,IAA1B,GAAiCL,iBADnC;AAEAG,EAAAA,wBAAwB,CAACG,oBAAzB,GACEH,wBAAwB,CAACE,IAAzB,GAAgCN,cADlC;AAGAK,EAAAA,oBAAoB,CAACE,oBAArB,GACEH,wBAAwB,CAACG,oBAAzB,GAAgDL,UADlD;AAEAG,EAAAA,oBAAoB,CAACC,IAArB,GACED,oBAAoB,CAACE,oBAArB,GAA4CP,cAD9C;AAGA,QAAMQ,iBAAiB,GACrBH,oBAAoB,CAACC,IAArB,GAA4BH,yBAAyB,CAACG,IADxD;AAGA,SAAOE,iBAAiB,GAAGT,QAA3B;AACD","sourcesContent":["/**\n * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming.\n * Parameters should correspond to whether we need the offset for the X or Y axis\n *\n * ## Terms Used:\n *\n * - Zoom Subject: the view that's being zoomed and panned\n * - Zoom Center: the point whose relative position to the window is retained\n * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes\n * - Scaled: a measurement in pixels scaled to the \"scale transformation\" of the zoom subject to match with its true size.\n * *For example:*\n * If the scale on the zoom subject is 0.5,\n * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px\n * 8px is the scaled measurement\n *\n * ## Overall idea of this algorithm:\n *\n * When users perform zooming by pinching the screen,\n * we need to shift the zoom subject so that the position of the zoom center is always the same.\n * The offset amount to shift the layer is the returned value.\n *\n *\n * ## How we achieve our goal:\n *\n * To retain, the zoom center position, whenever a zoom action is performed,\n * we just need to make sure the distances from all the points in the zoom subject\n * to the zoom center increases or decreases by the growth rate of the scale.\n *\n * ```\n * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale)\n * ```\n *\n * We can't calculate that for all the points because there are unlimited points on a plain.\n * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center.\n * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center.\n *\n * ```\n * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale)\n * ```\n *\n * Once we have `newDistanceZoomSubjectCenterToZoomCenter`,\n * we can easily calculate the position of the new center, which leads us to the offset amount.\n * Refer to the code for more details\n *\n * @param oldOffsetXOrYScaled\n * @param zoomSubjectOriginalWidthOrHeight\n * @param oldScale\n * @param newScale\n * @param zoomCenterXOrY\n */\nexport function calcNewScaledOffsetForZoomCentering(\n oldOffsetXOrYScaled: number,\n zoomSubjectOriginalWidthOrHeight: number,\n oldScale: number,\n newScale: number,\n zoomCenterXOrY: number\n) {\n const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale;\n const growthRate = newScale / oldScale;\n\n // these act like namespaces just for the sake of readability\n const zoomSubjectOriginalCenter = {} as Center;\n const zoomSubjectCurrentCenter = {} as Center;\n const zoomSubjectNewCenter = {} as Center;\n\n zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2;\n zoomSubjectCurrentCenter.xOrY =\n zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled;\n zoomSubjectCurrentCenter.distanceToZoomCenter =\n zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY;\n\n zoomSubjectNewCenter.distanceToZoomCenter =\n zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate;\n zoomSubjectNewCenter.xOrY =\n zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY;\n\n const newOffsetUnscaled =\n zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY;\n\n return newOffsetUnscaled / newScale;\n}\n\ninterface Center {\n xOrY: number;\n distanceToZoomCenter: number;\n}\n"]} \ No newline at end of file +{"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 index ed72a05..c49c209 100644 --- a/lib/commonjs/helper/coordinateConversion.js +++ b/lib/commonjs/helper/coordinateConversion.js @@ -7,7 +7,7 @@ exports.applyContainResizeMode = applyContainResizeMode; exports.defaultTransformSubjectData = void 0; exports.getImageOriginOnTransformSubject = getImageOriginOnTransformSubject; exports.viewportPositionToImagePosition = viewportPositionToImagePosition; -const defaultTransformSubjectData = { +const defaultTransformSubjectData = exports.defaultTransformSubjectData = { offsetX: 0, offsetY: 0, zoomLevel: 0, @@ -16,6 +16,7 @@ const defaultTransformSubjectData = { 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 @@ -27,9 +28,6 @@ const defaultTransformSubjectData = { * @param imgSize * @param containerSize */ - -exports.defaultTransformSubjectData = defaultTransformSubjectData; - function applyContainResizeMode(imgSize, containerSize) { const { width: imageWidth, @@ -42,7 +40,6 @@ function applyContainResizeMode(imgSize, containerSize) { const imageAspect = imageWidth / imageHeight; const areaAspect = areaWidth / areaHeight; let newSize; - if (imageAspect >= areaAspect) { // longest edge is horizontal newSize = { @@ -56,7 +53,6 @@ function applyContainResizeMode(imgSize, containerSize) { 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; @@ -69,13 +65,12 @@ function applyContainResizeMode(imgSize, containerSize) { scale }; } + /** * get the coord of image's origin relative to the transformSubject * @param resizedImageSize * @param transformSubject */ - - function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { const { offsetX, @@ -89,6 +84,7 @@ function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { 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 * @@ -98,8 +94,6 @@ function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { * * @return {Vec2D} returns null if point is out of the sheet's bound */ - - function viewportPositionToImagePosition({ viewportPosition, imageSize, diff --git a/lib/commonjs/helper/coordinateConversion.js.map b/lib/commonjs/helper/coordinateConversion.js.map index d15f032..88b61d9 100644 --- a/lib/commonjs/helper/coordinateConversion.js.map +++ b/lib/commonjs/helper/coordinateConversion.js.map @@ -1 +1 @@ -{"version":3,"sources":["coordinateConversion.ts"],"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"],"mappings":";;;;;;;;;AAEO,MAAMA,2BAA8C,GAAG;AAC5DC,EAAAA,OAAO,EAAE,CADmD;AAE5DC,EAAAA,OAAO,EAAE,CAFmD;AAG5DC,EAAAA,SAAS,EAAE,CAHiD;AAI5DC,EAAAA,aAAa,EAAE,CAJ6C;AAK5DC,EAAAA,cAAc,EAAE,CAL4C;AAM5DC,EAAAA,aAAa,EAAE,CAN6C;AAO5DC,EAAAA,aAAa,EAAE;AAP6C,CAAvD;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AACO,SAASC,sBAAT,CACLC,OADK,EAELC,aAFK,EAG0D;AAC/D,QAAM;AAAEC,IAAAA,KAAK,EAAEC,UAAT;AAAqBC,IAAAA,MAAM,EAAEC;AAA7B,MAA6CL,OAAnD;AACA,QAAM;AAAEE,IAAAA,KAAK,EAAEI,SAAT;AAAoBF,IAAAA,MAAM,EAAEG;AAA5B,MAA2CN,aAAjD;AACA,QAAMO,WAAW,GAAGL,UAAU,GAAGE,WAAjC;AACA,QAAMI,UAAU,GAAGH,SAAS,GAAGC,UAA/B;AAEA,MAAIG,OAAJ;;AACA,MAAIF,WAAW,IAAIC,UAAnB,EAA+B;AAC7B;AACAC,IAAAA,OAAO,GAAG;AAAER,MAAAA,KAAK,EAAEI,SAAT;AAAoBF,MAAAA,MAAM,EAAEE,SAAS,GAAGE;AAAxC,KAAV;AACD,GAHD,MAGO;AACL;AACAE,IAAAA,OAAO,GAAG;AAAER,MAAAA,KAAK,EAAEK,UAAU,GAAGC,WAAtB;AAAmCJ,MAAAA,MAAM,EAAEG;AAA3C,KAAV;AACD;;AAED,MAAII,KAAK,CAACD,OAAO,CAACN,MAAT,CAAT,EAA2BM,OAAO,C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EqB,aAAa,CAAC5B,aADW;AAEhCS,IAAAA,MAAM,EAAEmB,aAAa,CAAC3B;AAFU,GAAZ,CADxB;AAMA,MAAI6B,eAAe,IAAI,IAAvB,EAA6B,OAAO,IAAP;AAE7B,QAAMC,sBAAsB,GAAGX,gCAAgC,CAC7DS,cAD6D,EAE7DD,aAF6D,CAA/D;AAKA,QAAMI,YAAY,GAAG;AACnBT,IAAAA,CAAC,EACC,CAACG,gBAAgB,CAACH,CAAjB,GAAqBQ,sBAAsB,CAACR,CAA7C,IACAK,aAAa,CAAC7B,SADd,GAEA+B,eAJiB;AAKnBN,IAAAA,CAAC,EACC,CAACE,gBAAgB,CAACF,CAAjB,GAAqBO,sBAAsB,CAACP,CAA7C,IACAI,aAAa,CAAC7B,SADd,GAEA+B;AARiB,GAArB;AAWA,SAAOE,YAAP;AACD","sourcesContent":["import { Size2D, Vec2D, ZoomableViewEvent } from 'src/typings';\n\nexport const defaultTransformSubjectData: ZoomableViewEvent = {\n offsetX: 0,\n offsetY: 0,\n zoomLevel: 0,\n originalWidth: 0,\n originalHeight: 0,\n originalPageX: 0,\n originalPageY: 0,\n};\n\n/**\n * Assuming you have an image that's being resized to fit into a container\n * using the \"contain\" resize mode. You can use this function to calculate the\n * size of the image after fitting.\n *\n * Since our sheet is resized in this manner, we need this function\n * for things like pan boundaries and marker placement\n *\n * @param imgSize\n * @param containerSize\n */\nexport function applyContainResizeMode(\n imgSize: Size2D,\n containerSize: Size2D\n): { size: Size2D; scale: number } | { size: null; scale: null } {\n const { width: imageWidth, height: imageHeight } = imgSize;\n const { width: areaWidth, height: areaHeight } = containerSize;\n const imageAspect = imageWidth / imageHeight;\n const areaAspect = areaWidth / areaHeight;\n\n let newSize;\n if (imageAspect >= areaAspect) {\n // longest edge is horizontal\n newSize = { width: areaWidth, height: areaWidth / imageAspect };\n } else {\n // longest edge is vertical\n newSize = { width: areaHeight * imageAspect, height: areaHeight };\n }\n\n if (isNaN(newSize.height)) newSize.height = areaHeight;\n if (isNaN(newSize.width)) newSize.width = areaWidth;\n\n const scale = imageWidth\n ? newSize.width / imageWidth\n : newSize.height / imageHeight;\n\n if (!isFinite(scale)) return { size: null, scale: null };\n\n return {\n size: newSize,\n scale,\n };\n}\n\n/**\n * get the coord of image's origin relative to the transformSubject\n * @param resizedImageSize\n * @param transformSubject\n */\nexport function getImageOriginOnTransformSubject(\n resizedImageSize: Size2D,\n transformSubject: ZoomableViewEvent\n) {\n const { offsetX, offsetY, zoomLevel, originalWidth, originalHeight } =\n transformSubject;\n return {\n x:\n offsetX * zoomLevel +\n originalWidth / 2 -\n (resizedImageSize.width / 2) * zoomLevel,\n y:\n offsetY * zoomLevel +\n originalHeight / 2 -\n (resizedImageSize.height / 2) * zoomLevel,\n };\n}\n\n/**\n * Translates the coord system of a point from the viewport's space to the image's space\n *\n * @param pointOnContainer\n * @param sheetImageSize\n * @param transformSubject\n *\n * @return {Vec2D} returns null if point is out of the sheet's bound\n */\nexport function viewportPositionToImagePosition({\n viewportPosition,\n imageSize,\n zoomableEvent,\n}: {\n viewportPosition: Vec2D;\n imageSize: Size2D;\n zoomableEvent: ZoomableViewEvent;\n}): Vec2D | null {\n const { size: resizedImgSize, scale: resizedImgScale } =\n applyContainResizeMode(imageSize, {\n width: zoomableEvent.originalWidth,\n height: zoomableEvent.originalHeight,\n });\n\n if (resizedImgScale == null) return null;\n\n const sheetOriginOnContainer = getImageOriginOnTransformSubject(\n resizedImgSize,\n zoomableEvent\n );\n\n const pointOnSheet = {\n x:\n (viewportPosition.x - sheetOriginOnContainer.x) /\n zoomableEvent.zoomLevel /\n resizedImgScale,\n y:\n (viewportPosition.y - sheetOriginOnContainer.y) /\n zoomableEvent.zoomLevel /\n resizedImgScale,\n };\n\n return pointOnSheet;\n}\n"]} \ No newline at end of file +{"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;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CACpCC,OAAe,EACfC,aAAqB,EAC0C;EAC/D,MAAM;IAAEC,KAAK,EAAEC,UAAU;IAAEC,MAAM,EAAEC;EAAY,CAAC,GAAGL,OAAO;EAC1D,MAAM;IAAEE,KAAK,EAAEI,SAAS;IAAEF,MAAM,EAAEG;EAAW,CAAC,GAAGN,aAAa;EAC9D,MAAMO,WAAW,GAAGL,UAAU,GAAGE,WAAW;EAC5C,MAAMI,UAAU,GAAGH,SAAS,GAAGC,UAAU;EAEzC,IAAIG,OAAO;EACX,IAAIF,WAAW,IAAIC,UAAU,EAAE;IAC7B;IACAC,OAAO,GAAG;MAAER,KAAK,EAAEI,SAAS;MAAEF,MAAM,EAAEE,SAAS,GAAGE;IAAY,CAAC;EACjE,CAAC,MAAM;IACL;IACAE,OAAO,GAAG;MAAER,KAAK,EAAEK,UAAU,GAAGC,WAAW;MAAEJ,MAAM,EAAEG;IAAW,CAAC;EACnE;EAEA,IAAII,KAAK,CAACD,OAAO,CAACN,MAAM,CAAC,EAAEM,OAAO,CAACN,MAAM,GAAGG,UAAU;EACtD,IAAII,KAAK,CAACD,OAAO,CAACR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,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 index 9f2d746..970a978 100644 --- a/lib/commonjs/helper/index.js +++ b/lib/commonjs/helper/index.js @@ -11,8 +11,11 @@ Object.defineProperty(exports, "calcNewScaledOffsetForZoomCentering", { return _calcNewScaledOffsetForZoomCentering.calcNewScaledOffsetForZoomCentering; } }); - var _calcNewScaledOffsetForZoomCentering = require("./calcNewScaledOffsetForZoomCentering"); +// Minimum distance between two touch points to be considered a valid pinch gesture +// Uses Apple's Human Interface Guidelines recommended minimum touch target size +// https://developer.apple.com/design/human-interface-guidelines/accessibility#Mobility +const MIN_PINCH_DISTANCE = 44; /** * Calculates the gesture center point relative to the page coordinate system @@ -28,7 +31,6 @@ var _calcNewScaledOffsetForZoomCentering = require("./calcNewScaledOffsetForZoom function calcGestureCenterPoint(e, gestureState) { const touches = e.nativeEvent.touches; if (!touches[0]) return null; - if (gestureState.numberActiveTouches === 2) { if (!touches[1]) return null; return { @@ -36,22 +38,19 @@ function calcGestureCenterPoint(e, gestureState) { 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); + return Math.max(MIN_PINCH_DISTANCE, 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 index 1c735d6..fa2fac9 100644 --- a/lib/commonjs/helper/index.js.map +++ b/lib/commonjs/helper/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":["calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","sqrt"],"mappings":";;;;;;;;;;;;;;AAIA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,sBAAT,CACLC,CADK,EAELC,YAFK,EAGS;AACd,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAI,CAACA,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;;AAEjB,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,QAAI,CAACF,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;AACjB,WAAO;AACLG,MAAAA,CAAC,EAAE,CAACH,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,GAAmBJ,OAAO,CAAC,CAAD,CAAP,CAAWI,KAA/B,IAAwC,CADtC;AAELC,MAAAA,CAAC,EAAE,CAACL,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,GAAmBN,OAAO,CAAC,CAAD,CAAP,CAAWM,KAA/B,IAAwC;AAFtC,KAAP;AAID;;AACD,MAAIP,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,WAAO;AACLC,MAAAA,CAAC,EAAEH,OAAO,CAAC,CAAD,CAAP,CAAWI,KADT;AAELC,MAAAA,CAAC,EAAEL,OAAO,CAAC,CAAD,CAAP,CAAWM;AAFT,KAAP;AAID;;AAED,SAAO,IAAP;AACD;;AAEM,SAASC,wBAAT,CACLT,CADK,EAELC,YAFK,EAGU;AACf,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAArC,IAA0C,CAACF,OAAO,CAAC,CAAD,CAAlD,IAAyD,CAACA,OAAO,CAAC,CAAD,CAArE,EACE,OAAO,IAAP;AAEF,QAAMQ,EAAE,GAAGC,IAAI,CAACC,GAAL,CAASV,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,GAAmBJ,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAvC,CAAX;AACA,QAAMO,EAAE,GAAGF,IAAI,CAACC,GAAL,CAASV,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,GAAmBN,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAvC,CAAX;AACA,SAAOG,IAAI,CAACG,IAAL,CAAUJ,EAAE,GAAGA,EAAL,GAAUG,EAAE,GAAGA,EAAzB,CAAP;AACD","sourcesContent":["import { GestureResponderEvent, PanResponderGestureState } from 'react-native';\n\nimport { Vec2D } from '../typings';\n\nexport { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering';\n\n/**\n * Calculates the gesture center point relative to the page coordinate system\n *\n * We're unable to use touch.locationX/Y\n * because locationX uses the axis system of the leaf element that the touch occurs on,\n * which makes it even more complicated to translate into our container's axis system.\n *\n * We're also unable to use gestureState.moveX/Y\n * because gestureState.moveX/Y is messed up on real device\n * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches)\n */\nexport function calcGestureCenterPoint(\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n): Vec2D | null {\n const touches = e.nativeEvent.touches;\n if (!touches[0]) return null;\n\n if (gestureState.numberActiveTouches === 2) {\n if (!touches[1]) return null;\n return {\n x: (touches[0].pageX + touches[1].pageX) / 2,\n y: (touches[0].pageY + touches[1].pageY) / 2,\n };\n }\n if (gestureState.numberActiveTouches === 1) {\n return {\n x: touches[0].pageX,\n y: touches[0].pageY,\n };\n }\n\n return null;\n}\n\nexport function calcGestureTouchDistance(\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n): number | null {\n const touches = e.nativeEvent.touches;\n if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1])\n return null;\n\n const dx = Math.abs(touches[0].pageX - touches[1].pageX);\n const dy = Math.abs(touches[0].pageY - touches[1].pageY);\n return Math.sqrt(dx * dx + dy * dy);\n}\n"]} \ No newline at end of file +{"version":3,"names":["_calcNewScaledOffsetForZoomCentering","require","MIN_PINCH_DISTANCE","calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","max","sqrt"],"sourceRoot":"../../../src","sources":["helper/index.ts"],"mappings":";;;;;;;;;;;;;AAIA,IAAAA,oCAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,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;AAEO,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;EAExD,OAAOG,IAAI,CAACG,GAAG,CAAChB,kBAAkB,EAAEa,IAAI,CAACI,IAAI,CAACL,EAAE,GAAGA,EAAE,GAAGG,EAAE,GAAGA,EAAE,CAAC,CAAC;AACnE","ignoreList":[]} diff --git a/lib/commonjs/index.js b/lib/commonjs/index.js index 0cc39c6..39cbcac 100644 --- a/lib/commonjs/index.js +++ b/lib/commonjs/index.js @@ -27,10 +27,7 @@ Object.defineProperty(exports, "viewportPositionToImagePosition", { return _coordinateConversion.viewportPositionToImagePosition; } }); - var _coordinateConversion = require("./helper/coordinateConversion"); - var _ReactNativeZoomableView = _interopRequireDefault(require("./ReactNativeZoomableView")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +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 index 003621e..631e513 100644 --- a/lib/commonjs/index.js.map +++ b/lib/commonjs/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAKA","sourcesContent":["import {\n applyContainResizeMode,\n getImageOriginOnTransformSubject,\n viewportPositionToImagePosition,\n} from './helper/coordinateConversion';\nimport ReactNativeZoomableView from './ReactNativeZoomableView';\nimport type {\n ReactNativeZoomableViewProps,\n ZoomableViewEvent,\n} from './typings';\n\nexport {\n // Helper functions for coordinate conversion\n applyContainResizeMode,\n getImageOriginOnTransformSubject,\n ReactNativeZoomableView,\n ReactNativeZoomableViewProps,\n viewportPositionToImagePosition,\n ZoomableViewEvent,\n};\n"]} \ No newline at end of file +{"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 new file mode 100644 index 0000000..729ac4d --- /dev/null +++ b/lib/commonjs/package.json @@ -0,0 +1 @@ +{"type":"commonjs"} diff --git a/lib/commonjs/typings/index.js b/lib/commonjs/typings/index.js index 36ab705..4907bab 100644 --- a/lib/commonjs/typings/index.js +++ b/lib/commonjs/typings/index.js @@ -4,13 +4,11 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.SwipeDirection = void 0; -let SwipeDirection; -exports.SwipeDirection = SwipeDirection; - -(function (SwipeDirection) { +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"; -})(SwipeDirection || (exports.SwipeDirection = SwipeDirection = {})); + 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 index eec8e49..1b6eb0d 100644 --- a/lib/commonjs/typings/index.js.map +++ b/lib/commonjs/typings/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":["SwipeDirection"],"mappings":";;;;;;IASYA,c;;;WAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;GAAAA,c,8BAAAA,c","sourcesContent":["import { ReactNode } from 'react';\nimport {\n Animated,\n GestureResponderEvent,\n LayoutChangeEvent,\n PanResponderGestureState,\n ViewProps,\n} from 'react-native';\n\nexport enum SwipeDirection {\n SWIPE_UP = 'SWIPE_UP',\n SWIPE_DOWN = 'SWIPE_DOWN',\n SWIPE_LEFT = 'SWIPE_LEFT',\n SWIPE_RIGHT = 'SWIPE_RIGHT',\n}\n\nexport interface ZoomableViewEvent {\n zoomLevel: number;\n offsetX: number;\n offsetY: number;\n originalHeight: number;\n originalWidth: number;\n originalPageX: number;\n originalPageY: number;\n}\n\nexport interface ReactNativeZoomableViewProps {\n // options\n style?: ViewProps['style'];\n children?: ReactNode;\n zoomEnabled?: boolean;\n panEnabled?: boolean;\n initialZoom?: number;\n initialOffsetX?: number;\n initialOffsetY?: number;\n contentWidth?: number;\n contentHeight?: number;\n panBoundaryPadding?: number;\n maxZoom?: number;\n minZoom?: number;\n doubleTapDelay?: number;\n doubleTapZoomToCenter?: boolean;\n bindToBorders?: boolean;\n zoomStep?: number;\n pinchToZoomInSensitivity?: number;\n pinchToZoomOutSensitivity?: number;\n movementSensibility?: number;\n longPressDuration?: number;\n visualTouchFeedbackEnabled?: boolean;\n disablePanOnInitialZoom?: boolean;\n\n // Zoom animated value ref\n zoomAnimatedValue?: Animated.Value;\n panAnimatedValueXY?: Animated.ValueXY;\n\n // debug\n debug?: boolean;\n\n // callbacks\n onLayout?: (event: Pick) => void;\n onTransform?: (zoomableViewEventObject: ZoomableViewEvent) => void;\n onSingleTap?: (\n event: GestureResponderEvent,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onDoubleTapBefore?: (\n event: GestureResponderEvent,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onDoubleTapAfter?: (\n event: GestureResponderEvent,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onShiftingBefore?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onShiftingAfter?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onShiftingEnd?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onZoomBefore?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean | undefined;\n onZoomAfter?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onZoomEnd?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onLongPress?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onStartShouldSetPanResponder?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent,\n baseComponentResult: boolean\n ) => boolean;\n onPanResponderGrant?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onPanResponderEnd?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onPanResponderMove?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onPanResponderTerminate?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onPanResponderTerminationRequest?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onShouldBlockNativeResponder?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onStartShouldSetPanResponderCapture?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => boolean;\n onMoveShouldSetPanResponderCapture?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => boolean;\n onStaticPinPress?: (event: GestureResponderEvent) => void;\n onStaticPinLongPress?: (event: GestureResponderEvent) => void;\n staticPinPosition?: Vec2D;\n staticPinIcon?: React.ReactElement;\n onStaticPinPositionChange?: (position: Vec2D) => void;\n onStaticPinPositionMove?: (position: Vec2D) => void;\n animatePin: boolean;\n pinProps?: ViewProps;\n disableMomentum?: boolean;\n}\n\nexport interface Vec2D {\n x: number;\n y: number;\n}\n\nexport interface Size2D {\n width: number;\n height: number;\n}\n\nexport interface TouchPoint extends Vec2D {\n id: string;\n isSecondTap?: boolean;\n}\n\nexport interface ReactNativeZoomableViewState {\n touches?: TouchPoint[];\n originalWidth: number;\n originalHeight: number;\n originalPageX: number;\n originalPageY: number;\n originalX: number;\n originalY: number;\n debugPoints?: undefined | Vec2D[];\n pinSize: Size2D;\n}\n\nexport interface ReactNativeZoomableViewWithGesturesProps\n extends ReactNativeZoomableViewProps {\n swipeLengthThreshold?: number;\n swipeVelocityThreshold?: number;\n swipeDirectionalThreshold?: number;\n swipeMinZoom?: number;\n swipeMaxZoom?: number;\n swipeDisabled?: boolean;\n onSwipe?: (\n swipeDirection: SwipeDirection,\n gestureState: PanResponderGestureState\n ) => void;\n onSwipeUp?: (gestureState: PanResponderGestureState) => void;\n onSwipeDown?: (gestureState: PanResponderGestureState) => void;\n onSwipeLeft?: (gestureState: PanResponderGestureState) => void;\n onSwipeRight?: (gestureState: PanResponderGestureState) => void;\n}\n"]} \ No newline at end of file +{"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 index 35cb90f..8ac5108 100644 --- a/lib/module/ReactNativeZoomableView.js +++ b/lib/module/ReactNativeZoomableView.js @@ -1,6 +1,4 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } - -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +"use strict"; import { debounce } from 'lodash'; import React, { Component, createRef } from 'react'; @@ -12,6 +10,7 @@ import { DebugTouchPoint } from './debugHelper'; import { calcGestureCenterPoint, calcGestureTouchDistance, calcNewScaledOffsetForZoomCentering } from './helper'; import { applyPanBoundariesToOffset } from './helper/applyPanBoundariesToOffset'; import { viewportPositionToImagePosition } from './helper/coordinateConversion'; +import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; const initialState = { originalWidth: 0, originalHeight: 0, @@ -24,379 +23,77 @@ const initialState = { height: 0 } }; - class ReactNativeZoomableView extends Component { + static defaultProps = { + zoomEnabled: true, + panEnabled: true, + initialZoom: 1, + initialOffsetX: 0, + initialOffsetY: 0, + maxZoom: 1.5, + minZoom: 0.5, + pinchToZoomInSensitivity: 1, + pinchToZoomOutSensitivity: 1, + movementSensibility: 1, + doubleTapDelay: 300, + bindToBorders: true, + zoomStep: 0.5, + onLongPress: null, + longPressDuration: 700, + contentWidth: undefined, + contentHeight: undefined, + panBoundaryPadding: 0, + visualTouchFeedbackEnabled: true, + staticPinPosition: undefined, + staticPinIcon: undefined, + onStaticPinPositionChange: undefined, + onStaticPinPositionMove: undefined, + animatePin: true, + disablePanOnInitialZoom: false + }; + panAnim = new Animated.ValueXY({ + x: 0, + y: 0 + }); + zoomAnim = new Animated.Value(1); + pinAnim = new Animated.ValueXY({ + x: 0, + y: 0 + }); + __offsets = { + x: { + value: 0, + boundaryCrossedAnimInEffect: false + }, + y: { + value: 0, + boundaryCrossedAnimInEffect: false + } + }; + zoomLevel = 1; + lastGestureCenterPosition = null; + lastGestureTouchDistance = null; + _gestureStarted = false; set gestureStarted(v) { this._gestureStarted = v; } - get gestureStarted() { return this._gestureStarted; } + /** * Last press time (used to evaluate whether user double tapped) * @type {number} */ - - + longPressTimeout = null; + touches = []; constructor(props) { - super(props); // This needs to be done before anything else to initialize the state. + super(props); + // This needs to be done before anything else to initialize the state. // Otherwise, the logic below may reference the state when it's undefined, // causing runtime errors. - - _defineProperty(this, "zoomSubjectWrapperRef", void 0); - - _defineProperty(this, "gestureHandlers", void 0); - - _defineProperty(this, "doubleTapFirstTapReleaseTimestamp", void 0); - - _defineProperty(this, "panAnim", new Animated.ValueXY({ - x: 0, - y: 0 - })); - - _defineProperty(this, "zoomAnim", new Animated.Value(1)); - - _defineProperty(this, "pinAnim", new Animated.ValueXY({ - x: 0, - y: 0 - })); - - _defineProperty(this, "__offsets", { - x: { - value: 0, - boundaryCrossedAnimInEffect: false - }, - y: { - value: 0, - boundaryCrossedAnimInEffect: false - } - }); - - _defineProperty(this, "zoomLevel", 1); - - _defineProperty(this, "lastGestureCenterPosition", null); - - _defineProperty(this, "lastGestureTouchDistance", null); - - _defineProperty(this, "gestureType", void 0); - - _defineProperty(this, "_gestureStarted", false); - - _defineProperty(this, "longPressTimeout", null); - - _defineProperty(this, "onTransformInvocationInitialized", void 0); - - _defineProperty(this, "singleTapTimeoutId", void 0); - - _defineProperty(this, "touches", []); - - _defineProperty(this, "doubleTapFirstTap", void 0); - - _defineProperty(this, "measureZoomSubjectInterval", void 0); - - _defineProperty(this, "debouncedOnStaticPinPositionChange", debounce(position => { - var _this$props$onStaticP, _this$props; - - return (_this$props$onStaticP = (_this$props = this.props).onStaticPinPositionChange) === null || _this$props$onStaticP === void 0 ? void 0 : _this$props$onStaticP.call(_this$props, position); - }, 100)); - - _defineProperty(this, "measureZoomSubject", () => { - // 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(() => { - var _this$zoomSubjectWrap; - - // 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) - (_this$zoomSubjectWrap = this.zoomSubjectWrapperRef.current) === null || _this$zoomSubjectWrap === void 0 ? void 0 : _this$zoomSubjectWrap.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; // If these values are all the same, don't re-set them in state - // this way we don't re-render - - if (this.state.originalX === x && this.state.originalY === y && this.state.originalWidth === width && this.state.originalHeight === height && this.state.originalPageX === pageX && this.state.originalPageY === pageY) { - return; - } - - this.setState({ - originalX: x, - originalY: y, - originalWidth: width, - originalHeight: height, - originalPageX: pageX, - originalPageY: pageY - }); - }); - }); - }); - }); - - _defineProperty(this, "_handleStartShouldSetPanResponder", (e, gestureState) => { - if (this.props.onStartShouldSetPanResponder) { - this.props.onStartShouldSetPanResponder(e, gestureState, this._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; - }); - - _defineProperty(this, "_handlePanResponderGrant", (e, gestureState) => { - var _this$props$onPanResp, _this$props3; - - if (this.props.onLongPress) { - e.persist(); - this.longPressTimeout = setTimeout(() => { - var _this$props$onLongPre, _this$props2; - - (_this$props$onLongPre = (_this$props2 = this.props).onLongPress) === null || _this$props$onLongPre === void 0 ? void 0 : _this$props$onLongPre.call(_this$props2, e, gestureState, this._getZoomableViewEventObject()); - this.longPressTimeout = null; - }, this.props.longPressDuration); - } - - (_this$props$onPanResp = (_this$props3 = this.props).onPanResponderGrant) === null || _this$props$onPanResp === void 0 ? void 0 : _this$props$onPanResp.call(_this$props3, e, gestureState, this._getZoomableViewEventObject()); - this.panAnim.stopAnimation(); - this.zoomAnim.stopAnimation(); - this.gestureStarted = true; - this.raisePin(); - }); - - _defineProperty(this, "_handlePanResponderEnd", (e, gestureState) => { - var _this$props$onPanResp2, _this$props4; - - if (!this.gestureType) { - this._resolveAndHandleTap(e); - } - - this.setState({ - debugPoints: [] - }); - this.lastGestureCenterPosition = null; - const disableMomentum = this.props.disableMomentum || this.props.panEnabled && this.gestureType === 'shift' && this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom; // Trigger final shift animation unless disablePanOnInitialZoom is set and we're on the initial zoom level - // or disableMomentum - - if (!disableMomentum) { - getPanMomentumDecayAnim(this.panAnim, { - x: gestureState.vx / this.zoomLevel, - y: gestureState.vy / this.zoomLevel - }).start(); - } - - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } - - (_this$props$onPanResp2 = (_this$props4 = this.props).onPanResponderEnd) === null || _this$props$onPanResp2 === void 0 ? void 0 : _this$props$onPanResp2.call(_this$props4, e, gestureState, this._getZoomableViewEventObject()); - - if (this.gestureType === 'pinch') { - var _this$props$onZoomEnd, _this$props5; - - (_this$props$onZoomEnd = (_this$props5 = this.props).onZoomEnd) === null || _this$props$onZoomEnd === void 0 ? void 0 : _this$props$onZoomEnd.call(_this$props5, e, gestureState, this._getZoomableViewEventObject()); - } else if (this.gestureType === 'shift') { - var _this$props$onShiftin, _this$props6; - - (_this$props$onShiftin = (_this$props6 = this.props).onShiftingEnd) === null || _this$props$onShiftin === void 0 ? void 0 : _this$props$onShiftin.call(_this$props6, e, gestureState, this._getZoomableViewEventObject()); - } - - if (this.props.staticPinPosition) { - this._updateStaticPin(); - } - - this.dropPin(); - this.gestureType = null; - this.gestureStarted = false; - }); - - _defineProperty(this, "_handlePanResponderMove", (e, gestureState) => { - if (this.props.onPanResponderMove) { - if (this.props.onPanResponderMove(e, gestureState, this._getZoomableViewEventObject())) { - return false; - } - } // Only supports 2 touches and below, - // any invalid number will cause the gesture to end. - - - if (gestureState.numberActiveTouches <= 2) { - if (!this.gestureStarted) { - this._handlePanResponderGrant(e, gestureState); - } - } else { - if (this.gestureStarted) { - this._handlePanResponderEnd(e, gestureState); - } - - return true; - } - - if (gestureState.numberActiveTouches === 2) { - if (this.longPressTimeout) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'pinch') { - this.lastGestureCenterPosition = calcGestureCenterPoint(e, gestureState); - this.lastGestureTouchDistance = calcGestureTouchDistance(e, gestureState); - } - - this.gestureType = 'pinch'; - - this._handlePinching(e, gestureState); - } else if (gestureState.numberActiveTouches === 1) { - if (this.longPressTimeout && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { - clearTimeout(this.longPressTimeout); - this.longPressTimeout = null; - } // change some measurement states when switching gesture to ensure a smooth transition - - - if (this.gestureType !== 'shift') { - this.lastGestureCenterPosition = calcGestureCenterPoint(e, gestureState); - } - - const { - dx, - dy - } = gestureState; - const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; - - if (isShiftGesture) { - this.gestureType = 'shift'; - - this._handleShifting(gestureState); - } - } - }); - - _defineProperty(this, "_resolveAndHandleTap", e => { - const now = Date.now(); - - if (this.doubleTapFirstTapReleaseTimestamp && this.props.doubleTapDelay && now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay) { - this.doubleTapFirstTap && this._addTouch({ ...this.doubleTapFirstTap, - id: now.toString(), - isSecondTap: true - }); - this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; - delete this.doubleTapFirstTap; - - this._handleDoubleTap(e); - } else { - this.doubleTapFirstTapReleaseTimestamp = now; - this.doubleTapFirstTap = { - id: now.toString(), - x: e.nativeEvent.pageX - this.state.originalPageX, - y: e.nativeEvent.pageY - this.state.originalPageY - }; - - this._addTouch(this.doubleTapFirstTap); // persist event so e.nativeEvent is preserved after a timeout delay - - - e.persist(); - this.singleTapTimeoutId = setTimeout(() => { - var _this$props$onSingleT, _this$props7; - - delete this.doubleTapFirstTapReleaseTimestamp; - delete this.singleTapTimeoutId; // Pan to the tapped location - - if (this.props.staticPinPosition && this.doubleTapFirstTap) { - const tapX = this.props.staticPinPosition.x - this.doubleTapFirstTap.x; - const tapY = this.props.staticPinPosition.y - this.doubleTapFirstTap.y; - Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX + tapX / this.zoomLevel, - y: this.offsetY + tapY / this.zoomLevel - }, - useNativeDriver: true, - duration: 200 - }).start(() => { - this._updateStaticPin(); - }); - } - - (_this$props$onSingleT = (_this$props7 = this.props).onSingleTap) === null || _this$props$onSingleT === void 0 ? void 0 : _this$props$onSingleT.call(_this$props7, e, this._getZoomableViewEventObject()); - }, this.props.doubleTapDelay); - } - }); - - _defineProperty(this, "moveStaticPinTo", (position, duration) => { - const { - originalWidth, - originalHeight - } = this.state; - const { - staticPinPosition, - contentWidth, - contentHeight - } = this.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; - this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; - this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; - - if (duration) { - Animated.timing(this.panAnim, { - toValue: { - x: this.offsetX, - y: this.offsetY - }, - useNativeDriver: true, - duration - }).start(); - } else { - this.panAnim.setValue({ - x: this.offsetX, - y: this.offsetY - }); - } - }); - - _defineProperty(this, "_staticPinPosition", () => { - if (!this.props.staticPinPosition) return; - if (!this.props.contentWidth || !this.props.contentHeight) return; - return viewportPositionToImagePosition({ - viewportPosition: { - x: this.props.staticPinPosition.x, - y: this.props.staticPinPosition.y - }, - imageSize: { - height: this.props.contentHeight, - width: this.props.contentWidth - }, - zoomableEvent: { ...this._getZoomableViewEventObject(), - offsetX: this.offsetX, - offsetY: this.offsetY, - zoomLevel: this.zoomLevel - } - }); - }); - - _defineProperty(this, "_updateStaticPin", () => { - var _this$props$onStaticP2, _this$props8; - - const position = this._staticPinPosition(); - - if (!position) return; - (_this$props$onStaticP2 = (_this$props8 = this.props).onStaticPinPositionChange) === null || _this$props$onStaticP2 === void 0 ? void 0 : _this$props$onStaticP2.call(_this$props8, position); - }); - - this.state = { ...initialState + this.state = { + ...initialState }; this.gestureHandlers = PanResponder.create({ onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, @@ -404,8 +101,6 @@ class ReactNativeZoomableView extends Component { onPanResponderMove: this._handlePanResponderMove, onPanResponderRelease: this._handlePanResponderEnd, onPanResponderTerminate: (evt, gestureState) => { - var _this$props$onPanResp3, _this$props9; - // We should also call _handlePanResponderEnd // to properly perform cleanups when the gesture is terminated // (aka gesture handling responsibility is taken over by another component). @@ -413,30 +108,13 @@ class ReactNativeZoomableView extends Component { // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, // but onPanResponderTerminate is called instead for no apparent reason. this._handlePanResponderEnd(evt, gestureState); - - (_this$props$onPanResp3 = (_this$props9 = this.props).onPanResponderTerminate) === null || _this$props$onPanResp3 === void 0 ? void 0 : _this$props$onPanResp3.call(_this$props9, evt, gestureState, this._getZoomableViewEventObject()); - }, - onPanResponderTerminationRequest: (evt, gestureState) => { - var _this$props$onPanResp4, _this$props10; - - return !!((_this$props$onPanResp4 = (_this$props10 = this.props).onPanResponderTerminationRequest) !== null && _this$props$onPanResp4 !== void 0 && _this$props$onPanResp4.call(_this$props10, evt, gestureState, this._getZoomableViewEventObject())); + this.props.onPanResponderTerminate?.(evt, gestureState, this._getZoomableViewEventObject()); }, + onPanResponderTerminationRequest: (evt, gestureState) => !!this.props.onPanResponderTerminationRequest?.(evt, gestureState, this._getZoomableViewEventObject()), // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder. - onShouldBlockNativeResponder: (evt, gestureState) => { - var _this$props$onShouldB, _this$props$onShouldB2, _this$props11; - - return (_this$props$onShouldB = (_this$props$onShouldB2 = (_this$props11 = this.props).onShouldBlockNativeResponder) === null || _this$props$onShouldB2 === void 0 ? void 0 : _this$props$onShouldB2.call(_this$props11, evt, gestureState, this._getZoomableViewEventObject())) !== null && _this$props$onShouldB !== void 0 ? _this$props$onShouldB : true; - }, - onStartShouldSetPanResponderCapture: (evt, gestureState) => { - var _this$props$onStartSh, _this$props12; - - return !!((_this$props$onStartSh = (_this$props12 = this.props).onStartShouldSetPanResponderCapture) !== null && _this$props$onStartSh !== void 0 && _this$props$onStartSh.call(_this$props12, evt, gestureState)); - }, - onMoveShouldSetPanResponderCapture: (evt, gestureState) => { - var _this$props$onMoveSho, _this$props13; - - return !!((_this$props$onMoveSho = (_this$props13 = this.props).onMoveShouldSetPanResponderCapture) !== null && _this$props$onMoveSho !== void 0 && _this$props$onMoveSho.call(_this$props13, evt, gestureState)); - } + onShouldBlockNativeResponder: (evt, gestureState) => this.props.onShouldBlockNativeResponder?.(evt, gestureState, this._getZoomableViewEventObject()) ?? true, + onStartShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState), + onMoveShouldSetPanResponderCapture: (evt, gestureState) => !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState) }); this.zoomSubjectWrapperRef = /*#__PURE__*/createRef(); if (this.props.zoomAnimatedValue) this.zoomAnim = this.props.zoomAnimatedValue; @@ -464,7 +142,6 @@ class ReactNativeZoomableView extends Component { this.lastGestureTouchDistance = 150; this.gestureType = null; } - raisePin() { if (!this.props.animatePin) return; Animated.timing(this.pinAnim, { @@ -477,7 +154,6 @@ class ReactNativeZoomableView extends Component { duration: 100 }).start(); } - dropPin() { if (!this.props.animatePin) return; Animated.timing(this.pinAnim, { @@ -490,34 +166,26 @@ class ReactNativeZoomableView extends Component { duration: 100 }).start(); } - set offsetX(x) { this.__setOffset('x', x); } - set offsetY(y) { this.__setOffset('y', y); } - get offsetX() { return this.__getOffset('x'); } - get offsetY() { return this.__getOffset('y'); } - __setOffset(axis, offset) { const offsetState = this.__offsets[axis]; - if (this.props.bindToBorders) { const containerSize = axis === 'x' ? this.state.originalWidth : this.state.originalHeight; const contentSize = axis === 'x' ? this.props.contentWidth || this.state.originalWidth : this.props.contentHeight || this.state.originalHeight; const boundOffset = contentSize && containerSize && this.props.panBoundaryPadding != null ? applyPanBoundariesToOffset(offset, containerSize, contentSize, this.zoomLevel, this.props.panBoundaryPadding) : offset; - if (!this.gestureType && !offsetState.boundaryCrossedAnimInEffect) { const boundariesApplied = boundOffset !== offset && boundOffset.toFixed(3) !== offset.toFixed(3); - if (boundariesApplied) { offsetState.boundaryCrossedAnimInEffect = true; getBoundaryCrossedAnim(this.panAnim[axis], boundOffset).start(() => { @@ -527,111 +195,91 @@ class ReactNativeZoomableView extends Component { } } } - offsetState.value = offset; } - __getOffset(axis) { return this.__offsets[axis].value; } - componentDidUpdate(prevProps, prevState) { - var _prevProps$staticPinP, _this$props$staticPin, _prevProps$staticPinP2, _this$props$staticPin2; - const { zoomEnabled, initialZoom } = this.props; - if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) { this.zoomLevel = initialZoom; this.zoomAnim.setValue(this.zoomLevel); } - if (!this.onTransformInvocationInitialized && this._invokeOnTransform().successful) { this.panAnim.addListener(() => this._invokeOnTransform()); this.zoomAnim.addListener(() => this._invokeOnTransform()); this.onTransformInvocationInitialized = true; } - const currState = this.state; const originalMeasurementsChanged = currState.originalHeight !== prevState.originalHeight || currState.originalWidth !== prevState.originalWidth || currState.originalPageX !== prevState.originalPageX || currState.originalPageY !== prevState.originalPageY || currState.originalX !== prevState.originalX || currState.originalY !== prevState.originalY; - const staticPinPositionChanged = ((_prevProps$staticPinP = prevProps.staticPinPosition) === null || _prevProps$staticPinP === void 0 ? void 0 : _prevProps$staticPinP.x) !== ((_this$props$staticPin = this.props.staticPinPosition) === null || _this$props$staticPin === void 0 ? void 0 : _this$props$staticPin.x) || ((_prevProps$staticPinP2 = prevProps.staticPinPosition) === null || _prevProps$staticPinP2 === void 0 ? void 0 : _prevProps$staticPinP2.y) !== ((_this$props$staticPin2 = this.props.staticPinPosition) === null || _this$props$staticPin2 === void 0 ? void 0 : _this$props$staticPin2.y); // We use a custom `onLayout` event, so the clients can stay in-sync + const staticPinPositionChanged = prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x || prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y; + + // 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 - if (originalMeasurementsChanged) { - var _this$props$onLayout, _this$props14; - const layout = { width: currState.originalWidth, height: currState.originalHeight, x: currState.originalX, y: currState.originalY }; - (_this$props$onLayout = (_this$props14 = this.props).onLayout) === null || _this$props$onLayout === void 0 ? void 0 : _this$props$onLayout.call(_this$props14, { + this.props.onLayout?.({ nativeEvent: { layout } }); } - if (this.onTransformInvocationInitialized && (originalMeasurementsChanged || staticPinPositionChanged)) { this._invokeOnTransform(); } } - componentDidMount() { - this.measureZoomSubject(); // We've already run `grabZoomSubjectOriginalMeasurements` at various events + this.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. - this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3); } - componentWillUnmount() { this.measureZoomSubjectInterval && clearInterval(this.measureZoomSubjectInterval); } + debouncedOnStaticPinPositionChange = debounce(position => this.props.onStaticPinPositionChange?.(position), 100); /** * try to invoke onTransform * @private */ _invokeOnTransform() { - var _this$props$onTransfo, _this$props15; - const zoomableViewEvent = this._getZoomableViewEventObject(); - const position = this._staticPinPosition(); - if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight) return { successful: false }; - (_this$props$onTransfo = (_this$props15 = this.props).onTransform) === null || _this$props$onTransfo === void 0 ? void 0 : _this$props$onTransfo.call(_this$props15, zoomableViewEvent); - + this.props.onTransform?.(zoomableViewEvent); if (position) { - var _this$props$onStaticP3, _this$props16; - - (_this$props$onStaticP3 = (_this$props16 = this.props).onStaticPinPositionMove) === null || _this$props$onStaticP3 === void 0 ? void 0 : _this$props$onStaticP3.call(_this$props16, position); + this.props.onStaticPinPositionMove?.(position); this.debouncedOnStaticPinPositionChange(position); } - return { successful: true }; } + /** * Returns additional information about components current state for external event hooks * * @returns {{}} * @private */ - - _getZoomableViewEventObject(overwriteObj = {}) { return { zoomLevel: this.zoomLevel, @@ -644,13 +292,196 @@ class ReactNativeZoomableView extends Component { ...overwriteObj }; } + /** * Get the original box dimensions and save them for later use. * (They will be used to calculate boxBorders) * * @private */ + measureZoomSubject = () => { + // 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) + this.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; + + // If these values are all the same, don't re-set them in state + // this way we don't re-render + if (this.state.originalX === x && this.state.originalY === y && this.state.originalWidth === width && this.state.originalHeight === height && this.state.originalPageX === pageX && this.state.originalPageY === pageY) { + return; + } + this.setState({ + originalX: x, + originalY: y, + originalWidth: width, + originalHeight: height, + originalPageX: pageX, + originalPageY: pageY + }); + }); + }); + }); + }; + + /** + * Handles the start of touch events and checks for taps + * + * @param e + * @param gestureState + * @returns {boolean} + * + * @private + */ + _handleStartShouldSetPanResponder = (e, gestureState) => { + if (this.props.onStartShouldSetPanResponder) { + this.props.onStartShouldSetPanResponder(e, gestureState, this._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 + */ + _handlePanResponderGrant = (e, gestureState) => { + if (this.props.onLongPress) { + e.persist(); + this.longPressTimeout = setTimeout(() => { + this.props.onLongPress?.(e, gestureState, this._getZoomableViewEventObject()); + this.longPressTimeout = null; + }, this.props.longPressDuration); + } + this.props.onPanResponderGrant?.(e, gestureState, this._getZoomableViewEventObject()); + this.panAnim.stopAnimation(); + this.zoomAnim.stopAnimation(); + this.gestureStarted = true; + this.raisePin(); + }; + + /** + * Handles the end of touch events + * + * @param e + * @param gestureState + * + * @private + */ + _handlePanResponderEnd = (e, gestureState) => { + if (!this.gestureType) { + this._resolveAndHandleTap(e); + } + this.setState({ + debugPoints: [] + }); + this.lastGestureCenterPosition = null; + const disableMomentum = this.props.disableMomentum || this.props.panEnabled && this.gestureType === 'shift' && this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom; + + // Trigger final shift animation unless disablePanOnInitialZoom is set and we're on the initial zoom level + // or disableMomentum + if (!disableMomentum) { + getPanMomentumDecayAnim(this.panAnim, { + x: gestureState.vx / this.zoomLevel, + y: gestureState.vy / this.zoomLevel + }).start(); + } + if (this.longPressTimeout) { + clearTimeout(this.longPressTimeout); + this.longPressTimeout = null; + } + this.props.onPanResponderEnd?.(e, gestureState, this._getZoomableViewEventObject()); + if (this.gestureType === 'pinch') { + this.props.onZoomEnd?.(e, gestureState, this._getZoomableViewEventObject()); + } else if (this.gestureType === 'shift') { + this.props.onShiftingEnd?.(e, gestureState, this._getZoomableViewEventObject()); + } + if (this.props.staticPinPosition) { + this._updateStaticPin(); + } + this.dropPin(); + this.gestureType = null; + this.gestureStarted = false; + }; + + /** + * Handles the actual movement of our pan responder + * + * @param e + * @param gestureState + * + * @private + */ + _handlePanResponderMove = (e, gestureState) => { + if (this.props.onPanResponderMove) { + if (this.props.onPanResponderMove(e, gestureState, this._getZoomableViewEventObject())) { + return false; + } + } + // Only supports 2 touches and below, + // any invalid number will cause the gesture to end. + if (gestureState.numberActiveTouches <= 2) { + if (!this.gestureStarted) { + this._handlePanResponderGrant(e, gestureState); + } + } else { + if (this.gestureStarted) { + this._handlePanResponderEnd(e, gestureState); + } + return true; + } + if (gestureState.numberActiveTouches === 2) { + if (this.longPressTimeout) { + clearTimeout(this.longPressTimeout); + this.longPressTimeout = null; + } + + // change some measurement states when switching gesture to ensure a smooth transition + if (this.gestureType !== 'pinch') { + this.lastGestureCenterPosition = calcGestureCenterPoint(e, gestureState); + this.lastGestureTouchDistance = calcGestureTouchDistance(e, gestureState); + } + this.gestureType = 'pinch'; + this._handlePinching(e, gestureState); + } else if (gestureState.numberActiveTouches === 1) { + if (this.longPressTimeout && (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)) { + clearTimeout(this.longPressTimeout); + this.longPressTimeout = null; + } + // change some measurement states when switching gesture to ensure a smooth transition + if (this.gestureType !== 'shift') { + this.lastGestureCenterPosition = calcGestureCenterPoint(e, gestureState); + } + const { + dx, + dy + } = gestureState; + const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2; + if (isShiftGesture) { + this.gestureType = 'shift'; + this._handleShifting(gestureState); + } + } + }; /** * Handles the pinch movement and zooming @@ -661,8 +492,6 @@ class ReactNativeZoomableView extends Component { * @private */ _handlePinching(e, gestureState) { - var _this$props$onZoomAft, _this$props17; - if (!this.props.zoomEnabled) return; const { maxZoom, @@ -671,39 +500,36 @@ class ReactNativeZoomableView extends Component { pinchToZoomOutSensitivity } = this.props; const distance = calcGestureTouchDistance(e, gestureState); - if (this.props.onZoomBefore && this.props.onZoomBefore(e, gestureState, this._getZoomableViewEventObject())) { return; } - if (!distance) return; - if (!this.lastGestureTouchDistance) return; // define the new zoom level and take zoom level sensitivity into consideration + if (!this.lastGestureTouchDistance) return; + // define the new zoom level and take zoom level sensitivity into consideration const zoomGrowthFromLastGestureState = distance / this.lastGestureTouchDistance; this.lastGestureTouchDistance = distance; const pinchToZoomSensitivity = zoomGrowthFromLastGestureState < 1 ? pinchToZoomOutSensitivity : pinchToZoomInSensitivity; if (pinchToZoomSensitivity == null) return; - const deltaGrowth = zoomGrowthFromLastGestureState - 1; // 0 - no resistance + const deltaGrowth = zoomGrowthFromLastGestureState - 1; + // 0 - no resistance // 10 - 90% resistance - const deltaGrowthAdjustedBySensitivity = deltaGrowth * (1 - pinchToZoomSensitivity * 9 / 100); - let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity); // make sure max and min zoom levels are respected + let newZoomLevel = this.zoomLevel * (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 - this.state.originalPageX, y: gestureCenterPoint.y - this.state.originalPageY }; - if (this.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. @@ -711,9 +537,9 @@ class ReactNativeZoomableView extends Component { x: this.props.staticPinPosition.x, y: this.props.staticPinPosition.y }; - } // Uncomment to debug - + } + // Uncomment to debug this.props.debug && this._setPinchDebugPoints(e, zoomCenter); const { originalHeight, @@ -726,14 +552,11 @@ class ReactNativeZoomableView extends Component { if (!originalHeight || !originalWidth) return; let offsetY = calcNewScaledOffsetForZoomCentering(oldOffsetY, originalHeight, oldScale, newScale, zoomCenter.y); let offsetX = calcNewScaledOffsetForZoomCentering(oldOffsetX, originalWidth, oldScale, newScale, zoomCenter.x); - const offsetShift = this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint); - if (offsetShift) { offsetX += offsetShift.x; offsetY += offsetShift.y; } - this.offsetX = offsetX; this.offsetY = offsetY; this.zoomLevel = newScale; @@ -742,16 +565,15 @@ class ReactNativeZoomableView extends Component { y: this.offsetY }); this.zoomAnim.setValue(this.zoomLevel); - (_this$props$onZoomAft = (_this$props17 = this.props).onZoomAfter) === null || _this$props$onZoomAft === void 0 ? void 0 : _this$props$onZoomAft.call(_this$props17, e, gestureState, this._getZoomableViewEventObject()); + this.props.onZoomAfter?.(e, gestureState, this._getZoomableViewEventObject()); } + /** * Used to debug pinch events * @param gestureResponderEvent * @param zoomCenter * @param points */ - - _setPinchDebugPoints(gestureResponderEvent, zoomCenter, ...points) { const { touches @@ -770,6 +592,7 @@ class ReactNativeZoomableView extends Component { }, zoomCenter, ...points] }); } + /** * Calculates the amount the offset should shift since the last position during panning * @@ -777,14 +600,11 @@ class ReactNativeZoomableView extends Component { * * @private */ - - _calcOffsetShiftSinceLastGestureState(gestureCenterPoint) { const { movementSensibility } = this.props; let shift = null; - if (this.lastGestureCenterPosition && movementSensibility) { const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x; const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y; @@ -795,10 +615,10 @@ class ReactNativeZoomableView extends Component { y: shiftY }; } - this.lastGestureCenterPosition = gestureCenterPoint; return shift; } + /** * Handles movement by tap and move * @@ -806,23 +626,18 @@ class ReactNativeZoomableView extends Component { * * @private */ - - _handleShifting(gestureState) { // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level if (!this.props.panEnabled || this.props.disablePanOnInitialZoom && this.zoomLevel === this.props.initialZoom) { return; } - const shift = this._calcOffsetShiftSinceLastGestureState({ x: gestureState.moveX, y: gestureState.moveY }); - if (!shift) return; const offsetX = this.offsetX + shift.x; const offsetY = this.offsetY + shift.y; - if (this.props.debug && this.state.originalPageX && this.state.originalPageY) { const x = gestureState.moveX - this.state.originalPageX; const y = gestureState.moveY - this.state.originalPageY; @@ -833,11 +648,10 @@ class ReactNativeZoomableView extends Component { }] }); } - this._setNewOffsetPosition(offsetX, offsetY); - this.raisePin(); } + /** * Set the state to offset moved * @@ -845,18 +659,14 @@ class ReactNativeZoomableView extends Component { * @param {number} newOffsetY * @returns */ - - _setNewOffsetPosition(newOffsetX, newOffsetY) { const { onShiftingBefore, onShiftingAfter } = this.props; - - if (onShiftingBefore !== null && onShiftingBefore !== void 0 && onShiftingBefore(null, null, this._getZoomableViewEventObject())) { + if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) { return; } - this.offsetX = newOffsetX; this.offsetY = newOffsetY; this.panAnim.setValue({ @@ -864,8 +674,9 @@ class ReactNativeZoomableView extends Component { y: this.offsetY }); this.zoomAnim.setValue(this.zoomLevel); - onShiftingAfter === null || onShiftingAfter === void 0 ? void 0 : onShiftingAfter(null, null, this._getZoomableViewEventObject()); + onShiftingAfter?.(null, null, this._getZoomableViewEventObject()); } + /** * Check whether the press event is double tap * or single tap and handle the event accordingly @@ -874,21 +685,126 @@ class ReactNativeZoomableView extends Component { * * @private */ + _resolveAndHandleTap = e => { + const now = Date.now(); + if (this.doubleTapFirstTapReleaseTimestamp && this.props.doubleTapDelay && now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay) { + this.doubleTapFirstTap && this._addTouch({ + ...this.doubleTapFirstTap, + id: now.toString(), + isSecondTap: true + }); + this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId); + delete this.doubleTapFirstTapReleaseTimestamp; + delete this.singleTapTimeoutId; + delete this.doubleTapFirstTap; + this._handleDoubleTap(e); + } else { + this.doubleTapFirstTapReleaseTimestamp = now; + this.doubleTapFirstTap = { + id: now.toString(), + x: e.nativeEvent.pageX - this.state.originalPageX, + y: e.nativeEvent.pageY - this.state.originalPageY + }; + this._addTouch(this.doubleTapFirstTap); + // persist event so e.nativeEvent is preserved after a timeout delay + e.persist(); + this.singleTapTimeoutId = setTimeout(() => { + delete this.doubleTapFirstTapReleaseTimestamp; + delete this.singleTapTimeoutId; + // Pan to the tapped location + if (this.props.staticPinPosition && this.doubleTapFirstTap) { + const tapX = this.props.staticPinPosition.x - this.doubleTapFirstTap.x; + const tapY = this.props.staticPinPosition.y - this.doubleTapFirstTap.y; + Animated.timing(this.panAnim, { + toValue: { + x: this.offsetX + tapX / this.zoomLevel, + y: this.offsetY + tapY / this.zoomLevel + }, + useNativeDriver: true, + duration: 200 + }).start(() => { + this._updateStaticPin(); + }); + } + this.props.onSingleTap?.(e, this._getZoomableViewEventObject()); + }, this.props.doubleTapDelay); + } + }; + moveStaticPinTo = (position, duration) => { + const { + originalWidth, + originalHeight + } = this.state; + const { + staticPinPosition, + contentWidth, + contentHeight + } = this.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; + this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel; + this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel; + if (duration) { + Animated.timing(this.panAnim, { + toValue: { + x: this.offsetX, + y: this.offsetY + }, + useNativeDriver: true, + duration + }).start(); + } else { + this.panAnim.setValue({ + x: this.offsetX, + y: this.offsetY + }); + } + }; + _staticPinPosition = () => { + if (!this.props.staticPinPosition) return; + if (!this.props.contentWidth || !this.props.contentHeight) return; + return viewportPositionToImagePosition({ + viewportPosition: { + x: this.props.staticPinPosition.x, + y: this.props.staticPinPosition.y + }, + imageSize: { + height: this.props.contentHeight, + width: this.props.contentWidth + }, + zoomableEvent: { + ...this._getZoomableViewEventObject(), + offsetX: this.offsetX, + offsetY: this.offsetY, + zoomLevel: this.zoomLevel + } + }); + }; + _updateStaticPin = () => { + const position = this._staticPinPosition(); + if (!position) return; + this.props.onStaticPinPositionChange?.(position); + }; _addTouch(touch) { this.touches.push(touch); this.setState({ touches: [...this.touches] }); } - _removeTouch(touch) { this.touches.splice(this.touches.indexOf(touch), 1); this.setState({ touches: [...this.touches] }); } + /** * Handles the double tap event * @@ -896,47 +812,43 @@ class ReactNativeZoomableView extends Component { * * @private */ - - _handleDoubleTap(e) { const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } = this.props; - onDoubleTapBefore === null || onDoubleTapBefore === void 0 ? void 0 : onDoubleTapBefore(e, this._getZoomableViewEventObject()); - + onDoubleTapBefore?.(e, this._getZoomableViewEventObject()); const nextZoomStep = this._getNextZoomStep(); - if (nextZoomStep == null) return; const { originalPageX, originalPageY - } = this.state; // define new zoom position coordinates + } = this.state; + // 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 enabled -> always zoom to center instead if (doubleTapZoomToCenter) { zoomPositionCoordinates.x = 0; zoomPositionCoordinates.y = 0; } - this.zoomTo(nextZoomStep, zoomPositionCoordinates); - onDoubleTapAfter === null || onDoubleTapAfter === void 0 ? void 0 : onDoubleTapAfter(e, this._getZoomableViewEventObject({ + onDoubleTapAfter?.(e, this._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 {*} */ - - _getNextZoomStep() { const { zoomStep, @@ -947,20 +859,17 @@ class ReactNativeZoomableView extends Component { zoomLevel } = this; 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; } + /** * 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. @@ -970,25 +879,21 @@ class ReactNativeZoomableView extends Component { * @param newZoomLevel * @param zoomCenter - If not supplied, the container's center is the zoom center */ - - zoomTo(newZoomLevel, zoomCenter) { - var _this$props$onZoomBef, _this$props18, _this$props$onZoomAft2, _this$props19; - if (!this.props.zoomEnabled) return false; if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false; if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false; - (_this$props$onZoomBef = (_this$props18 = this.props).onZoomBefore) === null || _this$props$onZoomBef === void 0 ? void 0 : _this$props$onZoomBef.call(_this$props18, null, null, this._getZoomableViewEventObject()); // == Perform Pan Animation to preserve the zoom center while zooming == + this.props.onZoomBefore?.(null, null, this._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 = this.zoomLevel; // Since zoomAnim is calculated in native driver, + let prevScale = this.zoomLevel; + // 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 = this.zoomAnim.addListener(({ value: newScale }) => { @@ -998,16 +903,18 @@ class ReactNativeZoomableView extends Component { }); prevScale = newScale; }); - } // == Perform Zoom Animation == - + } + // == Perform Zoom Animation == getZoomToAnimation(this.zoomAnim, newZoomLevel).start(() => { this.zoomAnim.removeListener(listenerId); - }); // == Zoom Animation Ends == + }); + // == Zoom Animation Ends == - (_this$props$onZoomAft2 = (_this$props19 = this.props).onZoomAfter) === null || _this$props$onZoomAft2 === void 0 ? void 0 : _this$props$onZoomAft2.call(_this$props19, null, null, this._getZoomableViewEventObject()); + this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject()); return true; } + /** * Zooms in or out by a specified change level * Use a positive number for `zoomLevelChange` to zoom in @@ -1019,13 +926,12 @@ class ReactNativeZoomableView extends Component { * * @return {bool} */ - - zoomBy(zoomLevelChange) { // if no zoom level Change given -> just use zoom step - zoomLevelChange || (zoomLevelChange = this.props.zoomStep || 0); + zoomLevelChange ||= this.props.zoomStep || 0; return this.zoomTo(this.zoomLevel + zoomLevelChange); } + /** * Moves the zoomed view to a specified position * Returns a promise when finished @@ -1035,8 +941,6 @@ class ReactNativeZoomableView extends Component { * * @return {bool} */ - - moveTo(newOffsetX, newOffsetY) { const { originalWidth, @@ -1045,9 +949,9 @@ class ReactNativeZoomableView extends Component { if (!originalWidth || !originalHeight) return; const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel; const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel; - this._setNewOffsetPosition(-offsetX, -offsetY); } + /** * Moves the zoomed view by a certain amount. * @@ -1058,15 +962,11 @@ class ReactNativeZoomableView extends Component { * * @return {bool} */ - - moveBy(offsetChangeX, offsetChangeY) { const offsetX = (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel; const offsetY = (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel; - this._setNewOffsetPosition(offsetX, offsetY); } - render() { const { staticPinIcon, @@ -1083,85 +983,56 @@ class ReactNativeZoomableView extends Component { touches, debugPoints = [] } = this.state; - return /*#__PURE__*/React.createElement(View, _extends({ - style: styles.container - }, this.gestureHandlers.panHandlers, { + return /*#__PURE__*/_jsxs(View, { + style: styles.container, + ...this.gestureHandlers.panHandlers, ref: this.zoomSubjectWrapperRef, - onLayout: this.measureZoomSubject - }), /*#__PURE__*/React.createElement(Animated.View, { - style: [styles.zoomSubject, this.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: this.zoomAnim - }, { - scaleY: this.zoomAnim - }, ...this.panAnim.getTranslateTransform()] - }] - }, children), visualTouchFeedbackEnabled && (touches === null || touches === void 0 ? void 0 : touches.map(touch => doubleTapDelay && /*#__PURE__*/React.createElement(AnimatedTouchFeedback, { - x: touch.x, - y: touch.y, - key: touch.id, - animationDuration: doubleTapDelay, - onAnimationDone: () => { - this._removeTouch(touch); - } - }))), debugPoints.map(({ - x, - y - }, index) => { - return /*#__PURE__*/React.createElement(DebugTouchPoint, { - key: index, - x: x, - y: y - }); - }), staticPinPosition && /*#__PURE__*/React.createElement(StaticPin, { - staticPinIcon: staticPinIcon, - staticPinPosition: staticPinPosition, - pinSize: pinSize, - onPress: onStaticPinPress, - onLongPress: onStaticPinLongPress, - onParentMove: this._handlePanResponderMove, - pinAnim: this.pinAnim, - setPinSize: size => { - this.setState({ - pinSize: size - }); - }, - pinProps: pinProps - })); + onLayout: this.measureZoomSubject, + children: [/*#__PURE__*/_jsx(Animated.View, { + style: [styles.zoomSubject, this.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: this.zoomAnim + }, { + scaleY: this.zoomAnim + }, ...this.panAnim.getTranslateTransform()] + }], + children: children + }), visualTouchFeedbackEnabled && touches?.map(touch => doubleTapDelay && /*#__PURE__*/_jsx(AnimatedTouchFeedback, { + x: touch.x, + y: touch.y, + animationDuration: doubleTapDelay, + onAnimationDone: () => { + this._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: this._handlePanResponderMove, + pinAnim: this.pinAnim, + setPinSize: size => { + this.setState({ + pinSize: size + }); + }, + pinProps: pinProps + })] + }); } - } - -_defineProperty(ReactNativeZoomableView, "defaultProps", { - zoomEnabled: true, - panEnabled: true, - initialZoom: 1, - initialOffsetX: 0, - initialOffsetY: 0, - maxZoom: 1.5, - minZoom: 0.5, - pinchToZoomInSensitivity: 1, - pinchToZoomOutSensitivity: 1, - movementSensibility: 1, - doubleTapDelay: 300, - bindToBorders: true, - zoomStep: 0.5, - onLongPress: null, - longPressDuration: 700, - contentWidth: undefined, - contentHeight: undefined, - panBoundaryPadding: 0, - visualTouchFeedbackEnabled: true, - staticPinPosition: undefined, - staticPinIcon: undefined, - onStaticPinPositionChange: undefined, - onStaticPinPositionMove: undefined, - animatePin: true, - disablePanOnInitialZoom: false -}); - const styles = StyleSheet.create({ container: { alignItems: 'center', diff --git a/lib/module/ReactNativeZoomableView.js.map b/lib/module/ReactNativeZoomableView.js.map index 6728b50..f0dfbe7 100644 --- a/lib/module/ReactNativeZoomableView.js.map +++ b/lib/module/ReactNativeZoomableView.js.map @@ -1 +1 @@ -{"version":3,"sources":["ReactNativeZoomableView.tsx"],"names":["debounce","React","Component","createRef","Animated","Easing","PanResponder","StyleSheet","View","getBoundaryCrossedAnim","getPanMomentumDecayAnim","getZoomToAnimation","AnimatedTouchFeedback","StaticPin","DebugTouchPoint","calcGestureCenterPoint","calcGestureTouchDistance","calcNewScaledOffsetForZoomCentering","applyPanBoundariesToOffset","viewportPositionToImagePosition","initialState","originalWidth","originalHeight","originalPageX","originalPageY","originalX","originalY","pinSize","width","height","ReactNativeZoomableView","gestureStarted","v","_gestureStarted","constructor","props","ValueXY","x","y","Value","value","boundaryCrossedAnimInEffect","position","onStaticPinPositionChange","requestAnimationFrame","setTimeout","zoomSubjectWrapperRef","current","measure","pageX","pageY","state","setState","e","gestureState","onStartShouldSetPanResponder","_getZoomableViewEventObject","onLongPress","persist","longPressTimeout","longPressDuration","onPanResponderGrant","panAnim","stopAnimation","zoomAnim","raisePin","gestureType","_resolveAndHandleTap","debugPoints","lastGestureCenterPosition","disableMomentum","panEnabled","disablePanOnInitialZoom","zoomLevel","initialZoom","vx","vy","start","clearTimeout","onPanResponderEnd","onZoomEnd","onShiftingEnd","staticPinPosition","_updateStaticPin","dropPin","onPanResponderMove","numberActiveTouches","_handlePanResponderGrant","_handlePanResponderEnd","lastGestureTouchDistance","_handlePinching","Math","abs","dx","dy","isShiftGesture","_handleShifting","now","Date","doubleTapFirstTapReleaseTimestamp","doubleTapDelay","doubleTapFirstTap","_addTouch","id","toString","isSecondTap","singleTapTimeoutId","_handleDoubleTap","nativeEvent","tapX","tapY","timing","toValue","offsetX","offsetY","useNativeDriver","duration","onSingleTap","contentWidth","contentHeight","pinX","pinY","setValue","viewportPosition","imageSize","zoomableEvent","_staticPinPosition","gestureHandlers","create","_handleStartShouldSetPanResponder","_handlePanResponderMove","onPanResponderRelease","onPanResponderTerminate","evt","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomAnimatedValue","panAnimatedValueXY","initialOffsetX","initialOffsetY","addListener","animatePin","pinAnim","easing","out","ease","__setOffset","__getOffset","axis","offset","offsetState","__offsets","bindToBorders","containerSize","contentSize","boundOffset","panBoundaryPadding","boundariesApplied","toFixed","componentDidUpdate","prevProps","prevState","zoomEnabled","onTransformInvocationInitialized","_invokeOnTransform","successful","currState","originalMeasurementsChanged","staticPinPositionChanged","layout","onLayout","componentDidMount","measureZoomSubject","measureZoomSubjectInterval","setInterval","componentWillUnmount","clearInterval","zoomableViewEvent","onTransform","onStaticPinPositionMove","debouncedOnStaticPinPositionChange","overwriteObj","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","distance","onZoomBefore","zoomGrowthFromLastGestureState","pinchToZoomSensitivity","deltaGrowth","deltaGrowthAdjustedBySensitivity","newZoomLevel","gestureCenterPoint","zoomCenter","debug","_setPinchDebugPoints","oldOffsetX","oldOffsetY","oldScale","newScale","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","touches","movementSensibility","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","newOffsetX","newOffsetY","onShiftingBefore","onShiftingAfter","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","zoomTo","zoomStep","listenerId","prevScale","removeListener","zoomBy","zoomLevelChange","moveTo","moveBy","offsetChangeX","offsetChangeY","render","staticPinIcon","children","visualTouchFeedbackEnabled","onStaticPinLongPress","onStaticPinPress","pinProps","styles","container","panHandlers","zoomSubject","style","transform","scaleX","scaleY","getTranslateTransform","map","index","size","undefined","alignItems","flex","justifyContent","overflow"],"mappings":";;;;AAAA,SAASA,QAAT,QAAyB,QAAzB;AACA,OAAOC,KAAP,IAAgBC,SAAhB,EAA2BC,SAA3B,QAAuD,OAAvD;AACA,SACEC,QADF,EAEEC,MAFF,EAIEC,YAJF,EAQEC,UARF,EASEC,IATF,QAUO,cAVP;AAYA,SACEC,sBADF,EAEEC,uBAFF,EAGEC,kBAHF,QAIO,cAJP;AAKA,SAASC,qBAAT,QAAsC,cAAtC;AACA,SAASC,SAAT,QAA0B,wBAA1B;AACA,SAASC,eAAT,QAAgC,eAAhC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AQ,EAAE;AALD,GADoB;AAQ/BkN,EAAAA,WAAW,EAAE;AACXU,IAAAA,UAAU,EAAE,QADD;AAEXC,IAAAA,IAAI,EAAE,CAFK;AAGXC,IAAAA,cAAc,EAAE,QAHL;AAIX5O,IAAAA,KAAK,EAAE;AAJI;AARkB,CAAlB,CAAf;AAgBA,eAAeE,uBAAf;AAEA,SAASA,uBAAT","sourcesContent":["import { debounce } from 'lodash';\nimport React, { Component, createRef, RefObject } from 'react';\nimport {\n Animated,\n Easing,\n GestureResponderEvent,\n PanResponder,\n PanResponderCallbacks,\n PanResponderGestureState,\n PanResponderInstance,\n StyleSheet,\n View,\n} from 'react-native';\n\nimport {\n getBoundaryCrossedAnim,\n getPanMomentumDecayAnim,\n getZoomToAnimation,\n} from './animations';\nimport { AnimatedTouchFeedback } from './components';\nimport { StaticPin } from './components/StaticPin';\nimport { DebugTouchPoint } from './debugHelper';\nimport {\n calcGestureCenterPoint,\n calcGestureTouchDistance,\n calcNewScaledOffsetForZoomCentering,\n} from './helper';\nimport { applyPanBoundariesToOffset } from './helper/applyPanBoundariesToOffset';\nimport { viewportPositionToImagePosition } from './helper/coordinateConversion';\nimport {\n ReactNativeZoomableViewProps,\n ReactNativeZoomableViewState,\n Size2D,\n TouchPoint,\n Vec2D,\n ZoomableViewEvent,\n} from './typings';\n\nconst initialState: ReactNativeZoomableViewState = {\n originalWidth: 0,\n originalHeight: 0,\n originalPageX: 0,\n originalPageY: 0,\n originalX: 0,\n originalY: 0,\n pinSize: { width: 0, height: 0 },\n};\n\nclass ReactNativeZoomableView extends Component<\n ReactNativeZoomableViewProps,\n ReactNativeZoomableViewState\n> {\n zoomSubjectWrapperRef: RefObject;\n gestureHandlers: PanResponderInstance;\n doubleTapFirstTapReleaseTimestamp: number | undefined;\n\n static defaultProps = {\n zoomEnabled: true,\n panEnabled: true,\n initialZoom: 1,\n initialOffsetX: 0,\n initialOffsetY: 0,\n maxZoom: 1.5,\n minZoom: 0.5,\n pinchToZoomInSensitivity: 1,\n pinchToZoomOutSensitivity: 1,\n movementSensibility: 1,\n doubleTapDelay: 300,\n bindToBorders: true,\n zoomStep: 0.5,\n onLongPress: null,\n longPressDuration: 700,\n contentWidth: undefined,\n contentHeight: undefined,\n panBoundaryPadding: 0,\n visualTouchFeedbackEnabled: true,\n staticPinPosition: undefined,\n staticPinIcon: undefined,\n onStaticPinPositionChange: undefined,\n onStaticPinPositionMove: undefined,\n animatePin: true,\n disablePanOnInitialZoom: false,\n };\n\n private panAnim = new Animated.ValueXY({ x: 0, y: 0 });\n private zoomAnim = new Animated.Value(1);\n private pinAnim = new Animated.ValueXY({ x: 0, y: 0 });\n\n private __offsets = {\n x: {\n value: 0,\n boundaryCrossedAnimInEffect: false,\n },\n y: {\n value: 0,\n boundaryCrossedAnimInEffect: false,\n },\n };\n\n private zoomLevel = 1;\n private lastGestureCenterPosition: { x: number; y: number } | null = null;\n private lastGestureTouchDistance: number | null = null;\n private gestureType: 'pinch' | 'shift' | null;\n\n private _gestureStarted = false;\n private set gestureStarted(v: boolean) {\n this._gestureStarted = v;\n }\n\n public get gestureStarted() {\n return this._gestureStarted;\n }\n\n /**\n * Last press time (used to evaluate whether user double tapped)\n * @type {number}\n */\n private longPressTimeout: NodeJS.Timeout | null = null;\n private onTransformInvocationInitialized: boolean | undefined;\n private singleTapTimeoutId: NodeJS.Timeout | undefined;\n private touches: TouchPoint[] = [];\n private doubleTapFirstTap: TouchPoint | undefined;\n private measureZoomSubjectInterval: NodeJS.Timer | undefined;\n\n constructor(props: ReactNativeZoomableViewProps) {\n super(props);\n // This needs to be done before anything else to initialize the state.\n // Otherwise, the logic below may reference the state when it's undefined,\n // causing runtime errors.\n this.state = { ...initialState };\n\n this.gestureHandlers = PanResponder.create({\n onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder,\n onPanResponderGrant: this._handlePanResponderGrant,\n onPanResponderMove: this._handlePanResponderMove,\n onPanResponderRelease: this._handlePanResponderEnd,\n onPanResponderTerminate: (evt, gestureState) => {\n // We should also call _handlePanResponderEnd\n // to properly perform cleanups when the gesture is terminated\n // (aka gesture handling responsibility is taken over by another component).\n // This also fixes a weird issue where\n // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up,\n // but onPanResponderTerminate is called instead for no apparent reason.\n this._handlePanResponderEnd(evt, gestureState);\n this.props.onPanResponderTerminate?.(\n evt,\n gestureState,\n this._getZoomableViewEventObject()\n );\n },\n onPanResponderTerminationRequest: (evt, gestureState) =>\n !!this.props.onPanResponderTerminationRequest?.(\n evt,\n gestureState,\n this._getZoomableViewEventObject()\n ),\n // Defaults to true to prevent parent components, such as React Navigation's tab view, from taking over as responder.\n onShouldBlockNativeResponder: (evt, gestureState) =>\n this.props.onShouldBlockNativeResponder?.(\n evt,\n gestureState,\n this._getZoomableViewEventObject()\n ) ?? true,\n onStartShouldSetPanResponderCapture: (evt, gestureState) =>\n !!this.props.onStartShouldSetPanResponderCapture?.(evt, gestureState),\n onMoveShouldSetPanResponderCapture: (evt, gestureState) =>\n !!this.props.onMoveShouldSetPanResponderCapture?.(evt, gestureState),\n });\n\n this.zoomSubjectWrapperRef = createRef();\n\n if (this.props.zoomAnimatedValue)\n this.zoomAnim = this.props.zoomAnimatedValue;\n if (this.props.panAnimatedValueXY)\n this.panAnim = this.props.panAnimatedValueXY;\n\n if (this.props.initialZoom) this.zoomLevel = this.props.initialZoom;\n if (this.props.initialOffsetX != null)\n this.offsetX = this.props.initialOffsetX;\n if (this.props.initialOffsetY != null)\n this.offsetY = this.props.initialOffsetY;\n\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n this.zoomAnim.setValue(this.zoomLevel);\n this.panAnim.addListener(({ x, y }) => {\n this.offsetX = x;\n this.offsetY = y;\n });\n this.zoomAnim.addListener(({ value }) => {\n this.zoomLevel = value;\n });\n\n this.lastGestureTouchDistance = 150;\n\n this.gestureType = null;\n }\n\n private raisePin() {\n if (!this.props.animatePin) return;\n Animated.timing(this.pinAnim, {\n toValue: { x: 0, y: -10 },\n useNativeDriver: true,\n easing: Easing.out(Easing.ease),\n duration: 100,\n }).start();\n }\n\n private dropPin() {\n if (!this.props.animatePin) return;\n Animated.timing(this.pinAnim, {\n toValue: { x: 0, y: 0 },\n useNativeDriver: true,\n easing: Easing.out(Easing.ease),\n duration: 100,\n }).start();\n }\n\n private set offsetX(x: number) {\n this.__setOffset('x', x);\n }\n\n private set offsetY(y: number) {\n this.__setOffset('y', y);\n }\n\n private get offsetX() {\n return this.__getOffset('x');\n }\n\n private get offsetY() {\n return this.__getOffset('y');\n }\n\n private __setOffset(axis: 'x' | 'y', offset: number) {\n const offsetState = this.__offsets[axis];\n\n if (this.props.bindToBorders) {\n const containerSize =\n axis === 'x' ? this.state.originalWidth : this.state.originalHeight;\n const contentSize =\n axis === 'x'\n ? this.props.contentWidth || this.state.originalWidth\n : this.props.contentHeight || this.state.originalHeight;\n\n const boundOffset =\n contentSize && containerSize && this.props.panBoundaryPadding != null\n ? applyPanBoundariesToOffset(\n offset,\n containerSize,\n contentSize,\n this.zoomLevel,\n this.props.panBoundaryPadding\n )\n : offset;\n\n if (!this.gestureType && !offsetState.boundaryCrossedAnimInEffect) {\n const boundariesApplied =\n boundOffset !== offset &&\n boundOffset.toFixed(3) !== offset.toFixed(3);\n if (boundariesApplied) {\n offsetState.boundaryCrossedAnimInEffect = true;\n getBoundaryCrossedAnim(this.panAnim[axis], boundOffset).start(() => {\n offsetState.boundaryCrossedAnimInEffect = false;\n });\n return;\n }\n }\n }\n\n offsetState.value = offset;\n }\n\n private __getOffset(axis: 'x' | 'y') {\n return this.__offsets[axis].value;\n }\n\n componentDidUpdate(\n prevProps: ReactNativeZoomableViewProps,\n prevState: ReactNativeZoomableViewState\n ) {\n const { zoomEnabled, initialZoom } = this.props;\n if (prevProps.zoomEnabled && !zoomEnabled && initialZoom) {\n this.zoomLevel = initialZoom;\n this.zoomAnim.setValue(this.zoomLevel);\n }\n if (\n !this.onTransformInvocationInitialized &&\n this._invokeOnTransform().successful\n ) {\n this.panAnim.addListener(() => this._invokeOnTransform());\n this.zoomAnim.addListener(() => this._invokeOnTransform());\n this.onTransformInvocationInitialized = true;\n }\n\n const currState = this.state;\n const originalMeasurementsChanged =\n currState.originalHeight !== prevState.originalHeight ||\n currState.originalWidth !== prevState.originalWidth ||\n currState.originalPageX !== prevState.originalPageX ||\n currState.originalPageY !== prevState.originalPageY ||\n currState.originalX !== prevState.originalX ||\n currState.originalY !== prevState.originalY;\n\n const staticPinPositionChanged =\n prevProps.staticPinPosition?.x !== this.props.staticPinPosition?.x ||\n prevProps.staticPinPosition?.y !== this.props.staticPinPosition?.y;\n\n // We use a custom `onLayout` event, so the clients can stay in-sync\n // with when the internal measurements are actually saved to the state,\n // thus helping them apply transformations at more accurate timings\n if (originalMeasurementsChanged) {\n const layout = {\n width: currState.originalWidth,\n height: currState.originalHeight,\n x: currState.originalX,\n y: currState.originalY,\n };\n this.props.onLayout?.({ nativeEvent: { layout } });\n }\n\n if (\n this.onTransformInvocationInitialized &&\n (originalMeasurementsChanged || staticPinPositionChanged)\n ) {\n this._invokeOnTransform();\n }\n }\n\n componentDidMount() {\n this.measureZoomSubject();\n // We've already run `grabZoomSubjectOriginalMeasurements` at various events\n // to make sure the measurements are promptly updated.\n // However, there might be cases we haven't accounted for, especially when\n // native processes are involved. To account for those cases,\n // we'll use an interval here to ensure we're always up-to-date.\n // The `setState` in `grabZoomSubjectOriginalMeasurements` won't trigger a rerender\n // if the values given haven't changed, so we're not running performance risk here.\n this.measureZoomSubjectInterval = setInterval(this.measureZoomSubject, 1e3);\n }\n\n componentWillUnmount() {\n this.measureZoomSubjectInterval &&\n clearInterval(this.measureZoomSubjectInterval);\n }\n\n debouncedOnStaticPinPositionChange = debounce(\n (position: Vec2D) => this.props.onStaticPinPositionChange?.(position),\n 100\n );\n\n /**\n * try to invoke onTransform\n * @private\n */\n _invokeOnTransform() {\n const zoomableViewEvent = this._getZoomableViewEventObject();\n const position = this._staticPinPosition();\n\n if (!zoomableViewEvent.originalWidth || !zoomableViewEvent.originalHeight)\n return { successful: false };\n\n this.props.onTransform?.(zoomableViewEvent);\n\n if (position) {\n this.props.onStaticPinPositionMove?.(position);\n this.debouncedOnStaticPinPositionChange(position);\n }\n\n return { successful: true };\n }\n\n /**\n * Returns additional information about components current state for external event hooks\n *\n * @returns {{}}\n * @private\n */\n _getZoomableViewEventObject(overwriteObj = {}): ZoomableViewEvent {\n return {\n zoomLevel: this.zoomLevel,\n offsetX: this.offsetX,\n offsetY: this.offsetY,\n originalHeight: this.state.originalHeight,\n originalWidth: this.state.originalWidth,\n originalPageX: this.state.originalPageX,\n originalPageY: this.state.originalPageY,\n ...overwriteObj,\n } as ZoomableViewEvent;\n }\n\n /**\n * Get the original box dimensions and save them for later use.\n * (They will be used to calculate boxBorders)\n *\n * @private\n */\n private measureZoomSubject = () => {\n // make sure we measure after animations are complete\n requestAnimationFrame(() => {\n // this setTimeout is here to fix a weird issue on iOS where the measurements are all `0`\n // when navigating back (react-navigation stack) from another view\n // while closing the keyboard at the same time\n setTimeout(() => {\n // In normal conditions, we're supposed to measure zoomSubject instead of its wrapper.\n // However, our zoomSubject may have been transformed by an initial zoomLevel or offset,\n // in which case these measurements will not represent the true \"original\" measurements.\n // We just need to make sure the zoomSubjectWrapper perfectly aligns with the zoomSubject\n // (no border, space, or anything between them)\n this.zoomSubjectWrapperRef.current?.measure(\n (x, y, width, height, pageX, pageY) => {\n // When the component is off-screen, these become all 0s, so we don't set them\n // to avoid messing up calculations, especially ones that are done right after\n // the component transitions from hidden to visible.\n if (!pageX && !pageY && !width && !height) return;\n\n // If these values are all the same, don't re-set them in state\n // this way we don't re-render\n if (\n this.state.originalX === x &&\n this.state.originalY === y &&\n this.state.originalWidth === width &&\n this.state.originalHeight === height &&\n this.state.originalPageX === pageX &&\n this.state.originalPageY === pageY\n ) {\n return;\n }\n\n this.setState({\n originalX: x,\n originalY: y,\n originalWidth: width,\n originalHeight: height,\n originalPageX: pageX,\n originalPageY: pageY,\n });\n }\n );\n });\n });\n };\n\n /**\n * Handles the start of touch events and checks for taps\n *\n * @param e\n * @param gestureState\n * @returns {boolean}\n *\n * @private\n */\n _handleStartShouldSetPanResponder = (\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n if (this.props.onStartShouldSetPanResponder) {\n this.props.onStartShouldSetPanResponder(\n e,\n gestureState,\n this._getZoomableViewEventObject(),\n false\n );\n }\n\n // Always set pan responder on start\n // of gesture so we can handle tap.\n // \"Pan threshold validation\" will be handled\n // in `onPanResponderMove` instead of in `onMoveShouldSetPanResponder`\n return true;\n };\n\n /**\n * Calculates pinch distance\n *\n * @param e\n * @param gestureState\n * @private\n */\n _handlePanResponderGrant: NonNullable<\n PanResponderCallbacks['onPanResponderGrant']\n > = (e, gestureState) => {\n if (this.props.onLongPress) {\n e.persist();\n this.longPressTimeout = setTimeout(() => {\n this.props.onLongPress?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n this.longPressTimeout = null;\n }, this.props.longPressDuration);\n }\n\n this.props.onPanResponderGrant?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n\n this.panAnim.stopAnimation();\n this.zoomAnim.stopAnimation();\n this.gestureStarted = true;\n\n this.raisePin();\n };\n\n /**\n * Handles the end of touch events\n *\n * @param e\n * @param gestureState\n *\n * @private\n */\n _handlePanResponderEnd: NonNullable<\n PanResponderCallbacks['onPanResponderEnd']\n > = (e, gestureState) => {\n if (!this.gestureType) {\n this._resolveAndHandleTap(e);\n }\n\n this.setState({ debugPoints: [] });\n\n this.lastGestureCenterPosition = null;\n\n const disableMomentum =\n this.props.disableMomentum ||\n (this.props.panEnabled &&\n this.gestureType === 'shift' &&\n this.props.disablePanOnInitialZoom &&\n this.zoomLevel === this.props.initialZoom);\n\n // Trigger final shift animation unless disablePanOnInitialZoom is set and we're on the initial zoom level\n // or disableMomentum\n if (!disableMomentum) {\n getPanMomentumDecayAnim(this.panAnim, {\n x: gestureState.vx / this.zoomLevel,\n y: gestureState.vy / this.zoomLevel,\n }).start();\n }\n\n if (this.longPressTimeout) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = null;\n }\n\n this.props.onPanResponderEnd?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n\n if (this.gestureType === 'pinch') {\n this.props.onZoomEnd?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n } else if (this.gestureType === 'shift') {\n this.props.onShiftingEnd?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n }\n\n if (this.props.staticPinPosition) {\n this._updateStaticPin();\n }\n\n this.dropPin();\n\n this.gestureType = null;\n this.gestureStarted = false;\n };\n\n /**\n * Handles the actual movement of our pan responder\n *\n * @param e\n * @param gestureState\n *\n * @private\n */\n _handlePanResponderMove = (\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => {\n if (this.props.onPanResponderMove) {\n if (\n this.props.onPanResponderMove(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n )\n ) {\n return false;\n }\n }\n\n // Only supports 2 touches and below,\n // any invalid number will cause the gesture to end.\n if (gestureState.numberActiveTouches <= 2) {\n if (!this.gestureStarted) {\n this._handlePanResponderGrant(e, gestureState);\n }\n } else {\n if (this.gestureStarted) {\n this._handlePanResponderEnd(e, gestureState);\n }\n return true;\n }\n\n if (gestureState.numberActiveTouches === 2) {\n if (this.longPressTimeout) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = null;\n }\n\n // change some measurement states when switching gesture to ensure a smooth transition\n if (this.gestureType !== 'pinch') {\n this.lastGestureCenterPosition = calcGestureCenterPoint(\n e,\n gestureState\n );\n this.lastGestureTouchDistance = calcGestureTouchDistance(\n e,\n gestureState\n );\n }\n this.gestureType = 'pinch';\n this._handlePinching(e, gestureState);\n } else if (gestureState.numberActiveTouches === 1) {\n if (\n this.longPressTimeout &&\n (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)\n ) {\n clearTimeout(this.longPressTimeout);\n this.longPressTimeout = null;\n }\n // change some measurement states when switching gesture to ensure a smooth transition\n if (this.gestureType !== 'shift') {\n this.lastGestureCenterPosition = calcGestureCenterPoint(\n e,\n gestureState\n );\n }\n\n const { dx, dy } = gestureState;\n const isShiftGesture = Math.abs(dx) > 2 || Math.abs(dy) > 2;\n if (isShiftGesture) {\n this.gestureType = 'shift';\n this._handleShifting(gestureState);\n }\n }\n };\n\n /**\n * Handles the pinch movement and zooming\n *\n * @param e\n * @param gestureState\n *\n * @private\n */\n _handlePinching(\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) {\n if (!this.props.zoomEnabled) return;\n\n const {\n maxZoom,\n minZoom,\n pinchToZoomInSensitivity,\n pinchToZoomOutSensitivity,\n } = this.props;\n\n const distance = calcGestureTouchDistance(e, gestureState);\n\n if (\n this.props.onZoomBefore &&\n this.props.onZoomBefore(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n )\n ) {\n return;\n }\n\n if (!distance) return;\n if (!this.lastGestureTouchDistance) return;\n\n // define the new zoom level and take zoom level sensitivity into consideration\n const zoomGrowthFromLastGestureState =\n distance / this.lastGestureTouchDistance;\n this.lastGestureTouchDistance = distance;\n\n const pinchToZoomSensitivity =\n zoomGrowthFromLastGestureState < 1\n ? pinchToZoomOutSensitivity\n : pinchToZoomInSensitivity;\n\n if (pinchToZoomSensitivity == null) return;\n const deltaGrowth = zoomGrowthFromLastGestureState - 1;\n // 0 - no resistance\n // 10 - 90% resistance\n const deltaGrowthAdjustedBySensitivity =\n deltaGrowth * (1 - (pinchToZoomSensitivity * 9) / 100);\n\n let newZoomLevel = this.zoomLevel * (1 + deltaGrowthAdjustedBySensitivity);\n\n // make sure max and min zoom levels are respected\n if (maxZoom != null && newZoomLevel > maxZoom) {\n newZoomLevel = maxZoom;\n }\n\n if (minZoom != null && newZoomLevel < minZoom) {\n newZoomLevel = minZoom;\n }\n\n const gestureCenterPoint = calcGestureCenterPoint(e, gestureState);\n\n if (!gestureCenterPoint) return;\n\n let zoomCenter = {\n x: gestureCenterPoint.x - this.state.originalPageX,\n y: gestureCenterPoint.y - this.state.originalPageY,\n };\n\n if (this.props.staticPinPosition) {\n // When we use a static pin position, the zoom centre is the same as that position,\n // otherwise the pin moves around way too much while zooming.\n zoomCenter = {\n x: this.props.staticPinPosition.x,\n y: this.props.staticPinPosition.y,\n };\n }\n\n // Uncomment to debug\n this.props.debug && this._setPinchDebugPoints(e, zoomCenter);\n\n const { originalHeight, originalWidth } = this.state;\n\n const oldOffsetX = this.offsetX;\n const oldOffsetY = this.offsetY;\n const oldScale = this.zoomLevel;\n const newScale = newZoomLevel;\n\n if (!originalHeight || !originalWidth) return;\n\n let offsetY = calcNewScaledOffsetForZoomCentering(\n oldOffsetY,\n originalHeight,\n oldScale,\n newScale,\n zoomCenter.y\n );\n let offsetX = calcNewScaledOffsetForZoomCentering(\n oldOffsetX,\n originalWidth,\n oldScale,\n newScale,\n zoomCenter.x\n );\n\n const offsetShift =\n this._calcOffsetShiftSinceLastGestureState(gestureCenterPoint);\n if (offsetShift) {\n offsetX += offsetShift.x;\n offsetY += offsetShift.y;\n }\n\n this.offsetX = offsetX;\n this.offsetY = offsetY;\n this.zoomLevel = newScale;\n\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n this.zoomAnim.setValue(this.zoomLevel);\n\n this.props.onZoomAfter?.(\n e,\n gestureState,\n this._getZoomableViewEventObject()\n );\n }\n\n /**\n * Used to debug pinch events\n * @param gestureResponderEvent\n * @param zoomCenter\n * @param points\n */\n _setPinchDebugPoints(\n gestureResponderEvent: GestureResponderEvent,\n zoomCenter: Vec2D,\n ...points: Vec2D[]\n ) {\n const { touches } = gestureResponderEvent.nativeEvent;\n const { originalPageY, originalPageX } = this.state;\n\n this.setState({\n debugPoints: [\n {\n x: touches[0].pageX - originalPageX,\n y: touches[0].pageY - originalPageY,\n },\n {\n x: touches[1].pageX - originalPageX,\n y: touches[1].pageY - originalPageY,\n },\n zoomCenter,\n ...points,\n ],\n });\n }\n\n /**\n * Calculates the amount the offset should shift since the last position during panning\n *\n * @param {Vec2D} gestureCenterPoint\n *\n * @private\n */\n _calcOffsetShiftSinceLastGestureState(gestureCenterPoint: Vec2D) {\n const { movementSensibility } = this.props;\n\n let shift = null;\n\n if (this.lastGestureCenterPosition && movementSensibility) {\n const dx = gestureCenterPoint.x - this.lastGestureCenterPosition.x;\n const dy = gestureCenterPoint.y - this.lastGestureCenterPosition.y;\n\n const shiftX = dx / this.zoomLevel / movementSensibility;\n const shiftY = dy / this.zoomLevel / movementSensibility;\n\n shift = {\n x: shiftX,\n y: shiftY,\n };\n }\n\n this.lastGestureCenterPosition = gestureCenterPoint;\n\n return shift;\n }\n\n /**\n * Handles movement by tap and move\n *\n * @param gestureState\n *\n * @private\n */\n _handleShifting(gestureState: PanResponderGestureState) {\n // Skips shifting if panEnabled is false or disablePanOnInitialZoom is true and we're on the initial zoom level\n if (\n !this.props.panEnabled ||\n (this.props.disablePanOnInitialZoom &&\n this.zoomLevel === this.props.initialZoom)\n ) {\n return;\n }\n const shift = this._calcOffsetShiftSinceLastGestureState({\n x: gestureState.moveX,\n y: gestureState.moveY,\n });\n if (!shift) return;\n\n const offsetX = this.offsetX + shift.x;\n const offsetY = this.offsetY + shift.y;\n\n if (\n this.props.debug &&\n this.state.originalPageX &&\n this.state.originalPageY\n ) {\n const x = gestureState.moveX - this.state.originalPageX;\n const y = gestureState.moveY - this.state.originalPageY;\n this.setState({ debugPoints: [{ x, y }] });\n }\n\n this._setNewOffsetPosition(offsetX, offsetY);\n\n this.raisePin();\n }\n\n /**\n * Set the state to offset moved\n *\n * @param {number} newOffsetX\n * @param {number} newOffsetY\n * @returns\n */\n _setNewOffsetPosition(newOffsetX: number, newOffsetY: number) {\n const { onShiftingBefore, onShiftingAfter } = this.props;\n\n if (onShiftingBefore?.(null, null, this._getZoomableViewEventObject())) {\n return;\n }\n\n this.offsetX = newOffsetX;\n this.offsetY = newOffsetY;\n\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n this.zoomAnim.setValue(this.zoomLevel);\n\n onShiftingAfter?.(null, null, this._getZoomableViewEventObject());\n }\n\n /**\n * Check whether the press event is double tap\n * or single tap and handle the event accordingly\n *\n * @param e\n *\n * @private\n */\n private _resolveAndHandleTap = (e: GestureResponderEvent) => {\n const now = Date.now();\n if (\n this.doubleTapFirstTapReleaseTimestamp &&\n this.props.doubleTapDelay &&\n now - this.doubleTapFirstTapReleaseTimestamp < this.props.doubleTapDelay\n ) {\n this.doubleTapFirstTap &&\n this._addTouch({\n ...this.doubleTapFirstTap,\n id: now.toString(),\n isSecondTap: true,\n });\n this.singleTapTimeoutId && clearTimeout(this.singleTapTimeoutId);\n delete this.doubleTapFirstTapReleaseTimestamp;\n delete this.singleTapTimeoutId;\n delete this.doubleTapFirstTap;\n this._handleDoubleTap(e);\n } else {\n this.doubleTapFirstTapReleaseTimestamp = now;\n this.doubleTapFirstTap = {\n id: now.toString(),\n x: e.nativeEvent.pageX - this.state.originalPageX,\n y: e.nativeEvent.pageY - this.state.originalPageY,\n };\n this._addTouch(this.doubleTapFirstTap);\n\n // persist event so e.nativeEvent is preserved after a timeout delay\n e.persist();\n this.singleTapTimeoutId = setTimeout(() => {\n delete this.doubleTapFirstTapReleaseTimestamp;\n delete this.singleTapTimeoutId;\n\n // Pan to the tapped location\n if (this.props.staticPinPosition && this.doubleTapFirstTap) {\n const tapX =\n this.props.staticPinPosition.x - this.doubleTapFirstTap.x;\n const tapY =\n this.props.staticPinPosition.y - this.doubleTapFirstTap.y;\n\n Animated.timing(this.panAnim, {\n toValue: {\n x: this.offsetX + tapX / this.zoomLevel,\n y: this.offsetY + tapY / this.zoomLevel,\n },\n useNativeDriver: true,\n duration: 200,\n }).start(() => {\n this._updateStaticPin();\n });\n }\n\n this.props.onSingleTap?.(e, this._getZoomableViewEventObject());\n }, this.props.doubleTapDelay);\n }\n };\n\n moveStaticPinTo = (position: Vec2D, duration?: number) => {\n const { originalWidth, originalHeight } = this.state;\n const { staticPinPosition, contentWidth, contentHeight } = this.props;\n\n if (!staticPinPosition) return;\n if (!originalWidth || !originalHeight) return;\n if (!contentWidth || !contentHeight) return;\n\n // Offset for the static pin\n const pinX = staticPinPosition.x - originalWidth / 2;\n const pinY = staticPinPosition.y - originalHeight / 2;\n\n this.offsetX = contentWidth / 2 - position.x + pinX / this.zoomLevel;\n this.offsetY = contentHeight / 2 - position.y + pinY / this.zoomLevel;\n\n if (duration) {\n Animated.timing(this.panAnim, {\n toValue: { x: this.offsetX, y: this.offsetY },\n useNativeDriver: true,\n duration,\n }).start();\n } else {\n this.panAnim.setValue({ x: this.offsetX, y: this.offsetY });\n }\n };\n\n private _staticPinPosition = () => {\n if (!this.props.staticPinPosition) return;\n if (!this.props.contentWidth || !this.props.contentHeight) return;\n\n return viewportPositionToImagePosition({\n viewportPosition: {\n x: this.props.staticPinPosition.x,\n y: this.props.staticPinPosition.y,\n },\n imageSize: {\n height: this.props.contentHeight,\n width: this.props.contentWidth,\n },\n zoomableEvent: {\n ...this._getZoomableViewEventObject(),\n offsetX: this.offsetX,\n offsetY: this.offsetY,\n zoomLevel: this.zoomLevel,\n },\n });\n };\n\n private _updateStaticPin = () => {\n const position = this._staticPinPosition();\n if (!position) return;\n this.props.onStaticPinPositionChange?.(position);\n };\n\n private _addTouch(touch: TouchPoint) {\n this.touches.push(touch);\n this.setState({ touches: [...this.touches] });\n }\n\n private _removeTouch(touch: TouchPoint) {\n this.touches.splice(this.touches.indexOf(touch), 1);\n this.setState({ touches: [...this.touches] });\n }\n\n /**\n * Handles the double tap event\n *\n * @param e\n *\n * @private\n */\n _handleDoubleTap(e: GestureResponderEvent) {\n const { onDoubleTapBefore, onDoubleTapAfter, doubleTapZoomToCenter } =\n this.props;\n\n onDoubleTapBefore?.(e, this._getZoomableViewEventObject());\n\n const nextZoomStep = this._getNextZoomStep();\n if (nextZoomStep == null) return;\n\n const { originalPageX, originalPageY } = this.state;\n\n // define new zoom position coordinates\n const zoomPositionCoordinates = {\n x: e.nativeEvent.pageX - originalPageX,\n y: e.nativeEvent.pageY - originalPageY,\n };\n\n // if doubleTapZoomToCenter enabled -> always zoom to center instead\n if (doubleTapZoomToCenter) {\n zoomPositionCoordinates.x = 0;\n zoomPositionCoordinates.y = 0;\n }\n\n this.zoomTo(nextZoomStep, zoomPositionCoordinates);\n\n onDoubleTapAfter?.(\n e,\n this._getZoomableViewEventObject({ zoomLevel: nextZoomStep })\n );\n }\n\n /**\n * Returns the next zoom step based on current step and zoomStep property.\n * If we are zoomed all the way in -> return to initialzoom\n *\n * @returns {*}\n */\n _getNextZoomStep() {\n const { zoomStep, maxZoom, initialZoom } = this.props;\n const { zoomLevel } = this;\n\n if (maxZoom == null) return;\n\n if (zoomLevel.toFixed(2) === maxZoom.toFixed(2)) {\n return initialZoom;\n }\n\n if (zoomStep == null) return;\n\n const nextZoomStep = zoomLevel * (1 + zoomStep);\n if (nextZoomStep > maxZoom) {\n return maxZoom;\n }\n\n return nextZoomStep;\n }\n\n /**\n * Zooms to a specific level. A \"zoom center\" can be provided, which specifies\n * the point that will remain in the same position on the screen after the zoom.\n * The coordinates of the zoom center is relative to the zoom subject.\n * { x: 0, y: 0 } is the very center of the zoom subject.\n *\n * @param newZoomLevel\n * @param zoomCenter - If not supplied, the container's center is the zoom center\n */\n zoomTo(newZoomLevel: number, zoomCenter?: Vec2D) {\n if (!this.props.zoomEnabled) return false;\n if (this.props.maxZoom && newZoomLevel > this.props.maxZoom) return false;\n if (this.props.minZoom && newZoomLevel < this.props.minZoom) return false;\n\n this.props.onZoomBefore?.(null, null, this._getZoomableViewEventObject());\n\n // == Perform Pan Animation to preserve the zoom center while zooming ==\n let listenerId = '';\n if (zoomCenter) {\n // Calculates panAnim values based on changes in zoomAnim.\n let prevScale = this.zoomLevel;\n // Since zoomAnim is calculated in native driver,\n // it will jitter panAnim once in a while,\n // because here panAnim is being calculated in js.\n // However the jittering should mostly occur in simulator.\n listenerId = this.zoomAnim.addListener(({ value: newScale }) => {\n this.panAnim.setValue({\n x: calcNewScaledOffsetForZoomCentering(\n this.offsetX,\n this.state.originalWidth,\n prevScale,\n newScale,\n zoomCenter.x\n ),\n y: calcNewScaledOffsetForZoomCentering(\n this.offsetY,\n this.state.originalHeight,\n prevScale,\n newScale,\n zoomCenter.y\n ),\n });\n prevScale = newScale;\n });\n }\n\n // == Perform Zoom Animation ==\n getZoomToAnimation(this.zoomAnim, newZoomLevel).start(() => {\n this.zoomAnim.removeListener(listenerId);\n });\n // == Zoom Animation Ends ==\n\n this.props.onZoomAfter?.(null, null, this._getZoomableViewEventObject());\n return true;\n }\n\n /**\n * Zooms in or out by a specified change level\n * Use a positive number for `zoomLevelChange` to zoom in\n * Use a negative number for `zoomLevelChange` to zoom out\n *\n * Returns a promise if everything was updated and a boolean, whether it could be updated or if it exceeded the min/max zoom limits.\n *\n * @param {number | null} zoomLevelChange\n *\n * @return {bool}\n */\n zoomBy(zoomLevelChange: number) {\n // if no zoom level Change given -> just use zoom step\n zoomLevelChange ||= this.props.zoomStep || 0;\n return this.zoomTo(this.zoomLevel + zoomLevelChange);\n }\n\n /**\n * Moves the zoomed view to a specified position\n * Returns a promise when finished\n *\n * @param {number} newOffsetX the new position we want to move it to (x-axis)\n * @param {number} newOffsetY the new position we want to move it to (y-axis)\n *\n * @return {bool}\n */\n moveTo(newOffsetX: number, newOffsetY: number) {\n const { originalWidth, originalHeight } = this.state;\n if (!originalWidth || !originalHeight) return;\n\n const offsetX = (newOffsetX - originalWidth / 2) / this.zoomLevel;\n const offsetY = (newOffsetY - originalHeight / 2) / this.zoomLevel;\n\n this._setNewOffsetPosition(-offsetX, -offsetY);\n }\n\n /**\n * Moves the zoomed view by a certain amount.\n *\n * Returns a promise when finished\n *\n * @param {number} offsetChangeX the amount we want to move the offset by (x-axis)\n * @param {number} offsetChangeY the amount we want to move the offset by (y-axis)\n *\n * @return {bool}\n */\n moveBy(offsetChangeX: number, offsetChangeY: number) {\n const offsetX =\n (this.offsetX * this.zoomLevel - offsetChangeX) / this.zoomLevel;\n const offsetY =\n (this.offsetY * this.zoomLevel - offsetChangeY) / this.zoomLevel;\n\n this._setNewOffsetPosition(offsetX, offsetY);\n }\n\n render() {\n const {\n staticPinIcon,\n children,\n visualTouchFeedbackEnabled,\n doubleTapDelay,\n staticPinPosition,\n onStaticPinLongPress,\n onStaticPinPress,\n pinProps,\n } = this.props;\n\n const { pinSize, touches, debugPoints = [] } = this.state;\n\n return (\n \n \n {children}\n \n\n {visualTouchFeedbackEnabled &&\n touches?.map(\n (touch) =>\n doubleTapDelay && (\n {\n this._removeTouch(touch);\n }}\n />\n )\n )}\n\n {/* For Debugging Only */}\n {debugPoints.map(({ x, y }, index) => {\n return ;\n })}\n\n {staticPinPosition && (\n {\n this.setState({ pinSize: size });\n }}\n pinProps={pinProps}\n />\n )}\n \n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n alignItems: 'center',\n flex: 1,\n justifyContent: 'center',\n overflow: 'hidden',\n position: 'relative',\n },\n zoomSubject: {\n alignItems: 'center',\n flex: 1,\n justifyContent: 'center',\n width: '100%',\n },\n});\n\nexport default ReactNativeZoomableView;\n\nexport { ReactNativeZoomableView };\n"]} \ No newline at end of file +{"version":3,"names":["debounce","React","Component","createRef","Animated","Easing","PanResponder","StyleSheet","View","getBoundaryCrossedAnim","getPanMomentumDecayAnim","getZoomToAnimation","AnimatedTouchFeedback","StaticPin","DebugTouchPoint","calcGestureCenterPoint","calcGestureTouchDistance","calcNewScaledOffsetForZoomCentering","applyPanBoundariesToOffset","viewportPositionToImagePosition","jsx","_jsx","jsxs","_jsxs","initialState","originalWidth","originalHeight","originalPageX","originalPageY","originalX","originalY","pinSize","width","height","ReactNativeZoomableView","defaultProps","zoomEnabled","panEnabled","initialZoom","initialOffsetX","initialOffsetY","maxZoom","minZoom","pinchToZoomInSensitivity","pinchToZoomOutSensitivity","movementSensibility","doubleTapDelay","bindToBorders","zoomStep","onLongPress","longPressDuration","contentWidth","undefined","contentHeight","panBoundaryPadding","visualTouchFeedbackEnabled","staticPinPosition","staticPinIcon","onStaticPinPositionChange","onStaticPinPositionMove","animatePin","disablePanOnInitialZoom","panAnim","ValueXY","x","y","zoomAnim","Value","pinAnim","__offsets","value","boundaryCrossedAnimInEffect","zoomLevel","lastGestureCenterPosition","lastGestureTouchDistance","_gestureStarted","gestureStarted","v","longPressTimeout","touches","constructor","props","state","gestureHandlers","create","onStartShouldSetPanResponder","_handleStartShouldSetPanResponder","onPanResponderGrant","_handlePanResponderGrant","onPanResponderMove","_handlePanResponderMove","onPanResponderRelease","_handlePanResponderEnd","onPanResponderTerminate","evt","gestureState","_getZoomableViewEventObject","onPanResponderTerminationRequest","onShouldBlockNativeResponder","onStartShouldSetPanResponderCapture","onMoveShouldSetPanResponderCapture","zoomSubjectWrapperRef","zoomAnimatedValue","panAnimatedValueXY","offsetX","offsetY","setValue","addListener","gestureType","raisePin","timing","toValue","useNativeDriver","easing","out","ease","duration","start","dropPin","__setOffset","__getOffset","axis","offset","offsetState","containerSize","contentSize","boundOffset","boundariesApplied","toFixed","componentDidUpdate","prevProps","prevState","onTransformInvocationInitialized","_invokeOnTransform","successful","currState","originalMeasurementsChanged","staticPinPositionChanged","layout","onLayout","nativeEvent","componentDidMount","measureZoomSubject","measureZoomSubjectInterval","setInterval","componentWillUnmount","clearInterval","debouncedOnStaticPinPositionChange","position","zoomableViewEvent","_staticPinPosition","onTransform","overwriteObj","requestAnimationFrame","setTimeout","current","measure","pageX","pageY","setState","e","persist","stopAnimation","_resolveAndHandleTap","debugPoints","disableMomentum","vx","vy","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","offsetShift","_calcOffsetShiftSinceLastGestureState","onZoomAfter","gestureResponderEvent","points","shift","shiftX","shiftY","moveX","moveY","_setNewOffsetPosition","newOffsetX","newOffsetY","onShiftingBefore","onShiftingAfter","now","Date","doubleTapFirstTapReleaseTimestamp","doubleTapFirstTap","_addTouch","id","toString","isSecondTap","singleTapTimeoutId","_handleDoubleTap","tapX","tapY","onSingleTap","moveStaticPinTo","pinX","pinY","viewportPosition","imageSize","zoomableEvent","touch","push","_removeTouch","splice","indexOf","onDoubleTapBefore","onDoubleTapAfter","doubleTapZoomToCenter","nextZoomStep","_getNextZoomStep","zoomPositionCoordinates","zoomTo","listenerId","prevScale","removeListener","zoomBy","zoomLevelChange","moveTo","moveBy","offsetChangeX","offsetChangeY","render","children","onStaticPinLongPress","onStaticPinPress","pinProps","style","styles","container","panHandlers","ref","zoomSubject","transform","scaleX","scaleY","getTranslateTransform","map","animationDuration","onAnimationDone","index","onPress","onParentMove","setPinSize","size","alignItems","flex","justifyContent","overflow"],"sourceRoot":"../../src","sources":["ReactNativeZoomableView.tsx"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,QAAQ;AACjC,OAAOC,KAAK,IAAIC,SAAS,EAAEC,SAAS,QAAmB,OAAO;AAC9D,SACEC,QAAQ,EACRC,MAAM,EAENC,YAAY,EAIZC,UAAU,EACVC,IAAI,QACC,cAAc;AAErB,SACEC,sBAAsB,EACtBC,uBAAuB,EACvBC,kBAAkB,QACb,cAAc;AACrB,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,0BAA0B,QAAQ,qCAAqC;AAChF,SAASC,+BAA+B,QAAQ,+BAA+B;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAUhF,MAAMC,YAA0C,GAAG;EACjDC,aAAa,EAAE,CAAC;E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ACP,eAAe;UAAakD,CAAC,EAAEA,CAAE;UAACC,CAAC,EAAEA;QAAE,GAAlB4M,KAAoB,CAAC;MACpD,CAAC,CAAC,EAEDrN,iBAAiB,iBAChBnC,IAAA,CAACR,SAAS;QACR4C,aAAa,EAAEA,aAAc;QAC7BD,iBAAiB,EAAEA,iBAAkB;QACrCzB,OAAO,EAAEA,OAAQ;QACjB+O,OAAO,EAAEhB,gBAAiB;QAC1B7M,WAAW,EAAE4M,oBAAqB;QAClCkB,YAAY,EAAE,IAAI,CAACrL,uBAAwB;QAC3CtB,OAAO,EAAE,IAAI,CAACA,OAAQ;QACtB4M,UAAU,EAAGC,IAAY,IAAK;UAC5B,IAAI,CAAClH,QAAQ,CAAC;YAAEhI,OAAO,EAAEkP;UAAK,CAAC,CAAC;QAClC,CAAE;QACFlB,QAAQ,EAAEA;MAAS,CACpB,CACF;IAAA,CACG,CAAC;EAEX;AACF;AAEA,MAAME,MAAM,GAAG1P,UAAU,CAAC6E,MAAM,CAAC;EAC/B8K,SAAS,EAAE;IACTgB,UAAU,EAAE,QAAQ;IACpBC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBC,QAAQ,EAAE,QAAQ;IAClBjI,QAAQ,EAAE;EACZ,CAAC;EACDiH,WAAW,EAAE;IACXa,UAAU,EAAE,QAAQ;IACpBC,IAAI,EAAE,CAAC;IACPC,cAAc,EAAE,QAAQ;IACxBpP,KAAK,EAAE;EACT;AACF,CAAC,CAAC;AAEF,eAAeE,uBAAuB;AAEtC,SAASA,uBAAuB","ignoreList":[]} diff --git a/lib/module/animations/index.js b/lib/module/animations/index.js index 1a2cfb1..8aae9b5 100644 --- a/lib/module/animations/index.js +++ b/lib/module/animations/index.js @@ -1,3 +1,5 @@ +"use strict"; + import { Animated, Easing } from 'react-native'; export function getBoundaryCrossedAnim(animValue, toValue) { return Animated.spring(animValue, { diff --git a/lib/module/animations/index.js.map b/lib/module/animations/index.js.map index 0dd60d4..7902608 100644 --- a/lib/module/animations/index.js.map +++ b/lib/module/animations/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":["Animated","Easing","getBoundaryCrossedAnim","animValue","toValue","spring","overshootClamping","useNativeDriver","getPanMomentumDecayAnim","velocity","decay","deceleration","getZoomToAnimation","timing","easing","out","ease"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,MAAnB,QAAiC,cAAjC;AAIA,OAAO,SAASC,sBAAT,CACLC,SADK,EAELC,OAFK,EAGL;AACA,SAAOJ,QAAQ,CAACK,MAAT,CAAgBF,SAAhB,EAA2B;AAChCG,IAAAA,iBAAiB,EAAE,IADa;AAEhCF,IAAAA,OAFgC;AAGhCG,IAAAA,eAAe,EAAE;AAHe,GAA3B,CAAP;AAKD;AAED,OAAO,SAASC,uBAAT,CACLL,SADK,EAELM,QAFK,EAGL;AACA,SAAOT,QAAQ,CAACU,KAAT,CAAeP,SAAf,EAA0B;AAC/BM,IAAAA,QAD+B;AAE/BE,IAAAA,YAAY,EAAE,KAFiB;AAG/BJ,IAAAA,eAAe,EAAE;AAHc,GAA1B,CAAP;AAKD;AAED,OAAO,SAASK,kBAAT,CAA4BT,SAA5B,EAAuDC,OAAvD,EAAwE;AAC7E,SAAOJ,QAAQ,CAACa,MAAT,CAAgBV,SAAhB,EAA2B;AAChCW,IAAAA,MAAM,EAAEb,MAAM,CAACc,GAAP,CAAWd,MAAM,CAACe,IAAlB,CADwB;AAEhCZ,IAAAA,OAFgC;AAGhCG,IAAAA,eAAe,EAAE;AAHe,GAA3B,CAAP;AAKD","sourcesContent":["import { Animated, Easing } from 'react-native';\n\nimport { Vec2D } from '../typings';\n\nexport function getBoundaryCrossedAnim(\n animValue: Animated.Value,\n toValue: number\n) {\n return Animated.spring(animValue, {\n overshootClamping: true,\n toValue,\n useNativeDriver: true,\n });\n}\n\nexport function getPanMomentumDecayAnim(\n animValue: Animated.Value | Animated.ValueXY,\n velocity: number | Vec2D\n) {\n return Animated.decay(animValue, {\n velocity,\n deceleration: 0.994,\n useNativeDriver: true,\n });\n}\n\nexport function getZoomToAnimation(animValue: Animated.Value, toValue: number) {\n return Animated.timing(animValue, {\n easing: Easing.out(Easing.ease),\n toValue,\n useNativeDriver: true,\n });\n}\n"]} \ No newline at end of file +{"version":3,"names":["Animated","Easing","getBoundaryCrossedAnim","animValue","toValue","spring","overshootClamping","useNativeDriver","getPanMomentumDecayAnim","velocity","decay","deceleration","getZoomToAnimation","timing","easing","out","ease"],"sourceRoot":"../../../src","sources":["animations/index.ts"],"mappings":";;AAAA,SAASA,QAAQ,EAAEC,MAAM,QAAQ,cAAc;AAI/C,OAAO,SAASC,sBAAsBA,CACpCC,SAAyB,EACzBC,OAAe,EACf;EACA,OAAOJ,QAAQ,CAACK,MAAM,CAACF,SAAS,EAAE;IAChCG,iBAAiB,EAAE,IAAI;IACvBF,OAAO;IACPG,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ;AAEA,OAAO,SAASC,uBAAuBA,CACrCL,SAA4C,EAC5CM,QAAwB,EACxB;EACA,OAAOT,QAAQ,CAACU,KAAK,CAACP,SAAS,EAAE;IAC/BM,QAAQ;IACRE,YAAY,EAAE,KAAK;IACnBJ,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ;AAEA,OAAO,SAASK,kBAAkBA,CAACT,SAAyB,EAAEC,OAAe,EAAE;EAC7E,OAAOJ,QAAQ,CAACa,MAAM,CAACV,SAAS,EAAE;IAChCW,MAAM,EAAEb,MAAM,CAACc,GAAG,CAACd,MAAM,CAACe,IAAI,CAAC;IAC/BZ,OAAO;IACPG,eAAe,EAAE;EACnB,CAAC,CAAC;AACJ","ignoreList":[]} diff --git a/lib/module/components/AnimatedTouchFeedback.js b/lib/module/components/AnimatedTouchFeedback.js index 58b3558..391b2e1 100644 --- a/lib/module/components/AnimatedTouchFeedback.js +++ b/lib/module/components/AnimatedTouchFeedback.js @@ -1,5 +1,8 @@ +"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, @@ -25,13 +28,9 @@ export const AnimatedTouchFeedback = ({ duration: outDuration, easing: Easing.out(Easing.ease), useNativeDriver: true - })]).start(() => { - var _onAnimationDoneRef$c; - - return (_onAnimationDoneRef$c = onAnimationDoneRef.current) === null || _onAnimationDoneRef$c === void 0 ? void 0 : _onAnimationDoneRef$c.call(onAnimationDoneRef); - }); + })]).start(() => onAnimationDoneRef.current?.()); }, [animationDelay, animationDuration]); - return /*#__PURE__*/React.createElement(Animated.View, { + return /*#__PURE__*/_jsx(Animated.View, { pointerEvents: "none", style: [styles.animatedTouchFeedback, { opacity: appearDisappearAnimRef.current.interpolate({ diff --git a/lib/module/components/AnimatedTouchFeedback.js.map b/lib/module/components/AnimatedTouchFeedback.js.map index 853ac5e..0f745d8 100644 --- a/lib/module/components/AnimatedTouchFeedback.js.map +++ b/lib/module/components/AnimatedTouchFeedback.js.map @@ -1 +1 @@ -{"version":3,"sources":["AnimatedTouchFeedback.tsx"],"names":["React","useEffect","useRef","Animated","Easing","StyleSheet","AnimatedTouchFeedback","x","y","animationDelay","animationDuration","onAnimationDone","appearDisappearAnimRef","Value","onAnimationDoneRef","current","setValue","inDuration","outDuration","sequence","timing","delay","toValue","duration","easing","linear","useNativeDriver","out","ease","start","styles","animatedTouchFeedback","opacity","interpolate","inputRange","outputRange","left","top","transform","scale","create","backgroundColor","borderRadius","height","position","width"],"mappings":"AAAA,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,MAA3B,QAAyC,OAAzC;AACA,SAASC,QAAT,EAAmBC,MAAnB,EAA2BC,UAA3B,QAA6C,cAA7C;AAEA,OAAO,MAAMC,qBAAqB,GAAG,CAAC;AACpCC,EAAAA,CADoC;AAEpCC,EAAAA,CAFoC;AAGpCC,EAAAA,cAHoC;AAIpCC,EAAAA,iBAJoC;AAKpCC,EAAAA;AALoC,CAAD,KAY/B;AACJ,QAAMC,sBAAsB,GAAG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,EAAE,CACLoB,MAAM,CAACC,qBADF,EAEL;AACEC,MAAAA,OAAO,EAAEpB,sBAAsB,CAACG,OAAvB,CAA+BkB,WAA/B,CAA2C;AAClDC,QAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADsC;AAElDC,QAAAA,WAAW,EAAE,CAAC,CAAD,EAAI,GAAJ;AAFqC,OAA3C,CADX;AAKEC,MAAAA,IAAI,EAAE7B,CAAC,GAAG,EALZ;AAME8B,MAAAA,GAAG,EAAE7B,CAAC,GAAG,EANX;AAOE8B,MAAAA,SAAS,EAAE,CACT;AACEC,QAAAA,KAAK,EAAE3B,sBAAsB,CAACG,OAAvB,CAA+BkB,WAA/B,CAA2C;AAChDC,UAAAA,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADoC;AAEhDC,UAAAA,WAAW,EAAE,CAAC,GAAD,EAAM,CAAN;AAFmC,SAA3C;AADT,OADS;AAPb,KAFK;AAFT,IADF;AAwBD,CA9DM;AAgEP,MAAML,MAAM,GAAGzB,UAAU,CAACmC,MAAX,CAAkB;AAC/BT,EAAAA,qBAAqB,EAAE;AACrBU,IAAAA,eAAe,EAAE,WADI;AAErBC,IAAAA,YAAY,EAAE,EAFO;AAGrBC,IAAAA,MAAM,EAAE,EAHa;AAIrBC,IAAAA,QAAQ,EAAE,UAJW;AAKrBC,IAAAA,KAAK,EAAE;AALc;AADQ,CAAlB,CAAf","sourcesContent":["import React, { useEffect, useRef } from 'react';\nimport { Animated, Easing, StyleSheet } from 'react-native';\n\nexport const AnimatedTouchFeedback = ({\n x,\n y,\n animationDelay,\n animationDuration,\n onAnimationDone,\n}: {\n x: number;\n y: number;\n animationDuration: number;\n animationDelay?: number;\n onAnimationDone?: () => void;\n}) => {\n const appearDisappearAnimRef = useRef(new Animated.Value(0));\n const onAnimationDoneRef = useRef(onAnimationDone);\n onAnimationDoneRef.current = onAnimationDone;\n\n useEffect(() => {\n appearDisappearAnimRef.current.setValue(0);\n const inDuration = animationDuration * 0.8;\n const outDuration = animationDuration - inDuration;\n Animated.sequence([\n Animated.timing(appearDisappearAnimRef.current, {\n delay: animationDelay || 0,\n toValue: 1,\n duration: inDuration,\n easing: Easing.linear,\n useNativeDriver: true,\n }),\n Animated.timing(appearDisappearAnimRef.current, {\n toValue: 0,\n duration: outDuration,\n easing: Easing.out(Easing.ease),\n useNativeDriver: true,\n }),\n ]).start(() => onAnimationDoneRef.current?.());\n }, [animationDelay, animationDuration]);\n\n return (\n \n );\n};\n\nconst styles = StyleSheet.create({\n animatedTouchFeedback: {\n backgroundColor: 'lightgray',\n borderRadius: 40,\n height: 40,\n position: 'absolute',\n width: 40,\n },\n});\n"]} \ No newline at end of file +{"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"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,EAAEC,MAAM,QAAQ,OAAO;AAChD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAE5D,OAAO,MAAMC,qBAAqB,GAAGA,CAAC;EACpCC,CAAC;EACDC,CAAC;EACDC,cAAc;EACdC,iBAAiB;EACjBC;AAOF,CAAC,KAAK;EACJ,MAAMC,sBAAsB,GAAGZ,MAAM,CAAiB,IAAIC,QAAQ,CAACY,KAAK,CAAC,CAAC,CAAC,CAAC;EAC5E,MAAMC,kBAAkB,GAAGd,MAAM,CAACW,eAAe,CAAC;EAClDG,kBAAkB,CAACC,OAAO,GAAGJ,eAAe;EAE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AsB,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 index e22eb94..c34c108 100644 --- a/lib/module/components/StaticPin.js +++ b/lib/module/components/StaticPin.js @@ -1,7 +1,8 @@ -function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } +"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, pinAnim, @@ -22,8 +23,9 @@ export const StaticPin = ({ 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 + tapTime.current = Date.now(); + // We want to handle tap on this so set true return true; }, onPanResponderMove: (evt, gestureState) => { @@ -34,40 +36,42 @@ export const StaticPin = ({ 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__*/React.createElement(Animated.View, _extends({ + return /*#__PURE__*/_jsx(Animated.View, { style: [{ left: staticPinPosition.x, top: staticPinPosition.y }, styles.pinWrapper, { opacity, transform - }] - }, pinProps), /*#__PURE__*/React.createElement(View, _extends({ - onLayout: ({ - nativeEvent: { - layout - } - }) => { - setPinSize(layout); - } - }, panResponder.panHandlers), staticPinIcon || - /*#__PURE__*/ - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment - React.createElement(Image, { - source: require('../assets/pin.png'), - style: styles.pin - }))); + }], + ...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: { diff --git a/lib/module/components/StaticPin.js.map b/lib/module/components/StaticPin.js.map index cc269dd..06eaba8 100644 --- a/lib/module/components/StaticPin.js.map +++ b/lib/module/components/StaticPin.js.map @@ -1 +1 @@ -{"version":3,"sources":["StaticPin.tsx"],"names":["React","Animated","Image","PanResponder","StyleSheet","View","StaticPin","staticPinPosition","pinAnim","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","useRef","transform","translateY","height","translateX","width","getTranslateTransform","opacity","panResponder","create","onStartShouldSetPanResponder","current","Date","now","onPanResponderMove","evt","gestureState","Math","abs","dx","dy","onPanResponderRelease","dt","left","x","top","y","styles","pinWrapper","nativeEvent","layout","panHandlers","require","pin","position"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SACEC,QADF,EAGEC,KAHF,EAIEC,YAJF,EAMEC,UANF,EAOEC,IAPF,QASO,cATP;AAYA,OAAO,MAAMC,SAAS,GAAG,CAAC;AACxBC,EAAAA,iBADwB;AAExBC,EAAAA,OAFwB;AAGxBC,EAAAA,aAHwB;AAIxB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,\n Image,\n PanResponder,\n PanResponderGestureState,\n StyleSheet,\n View,\n ViewProps,\n} from 'react-native';\nimport { Size2D } from 'src/typings';\n\nexport const StaticPin = ({\n staticPinPosition,\n pinAnim,\n staticPinIcon,\n pinSize,\n onParentMove,\n onPress,\n onLongPress,\n setPinSize,\n pinProps = {},\n}: {\n staticPinPosition: { x: number; y: number };\n pinAnim: Animated.ValueXY;\n staticPinIcon: React.ReactNode;\n pinSize: Size2D;\n /** Internal handler for passing move event to parent */\n onParentMove: (\n evt: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => boolean | undefined;\n onPress?: (evt: GestureResponderEvent) => void;\n onLongPress?: (evt: GestureResponderEvent) => void;\n setPinSize: (size: Size2D) => void;\n pinProps?: ViewProps;\n}) => {\n const tapTime = React.useRef(0);\n const transform = [\n { translateY: -pinSize.height },\n { translateX: -pinSize.width / 2 },\n ...pinAnim.getTranslateTransform(),\n ];\n\n const opacity = pinSize.width && pinSize.height ? 1 : 0;\n\n const panResponder = React.useRef(\n PanResponder.create({\n onStartShouldSetPanResponder: () => {\n tapTime.current = Date.now();\n\n // We want to handle tap on this so set true\n return true;\n },\n onPanResponderMove: (evt, gestureState) => {\n // However if the user moves finger we want to pass this evt to parent\n // to handle panning (tap not recognized)\n if (Math.abs(gestureState.dx) > 5 && Math.abs(gestureState.dy) > 5)\n onParentMove(evt, gestureState);\n },\n onPanResponderRelease: (evt, gestureState) => {\n if (Math.abs(gestureState.dx) > 5 || Math.abs(gestureState.dy) > 5)\n return;\n const dt = Date.now() - tapTime.current;\n if (onPress && dt < 500) {\n onPress(evt);\n }\n if (onLongPress && dt > 500) {\n // RN long press is 500ms\n onLongPress(evt);\n }\n },\n })\n ).current;\n\n return (\n \n {\n setPinSize(layout);\n }}\n {...panResponder.panHandlers}\n >\n {staticPinIcon || (\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n \n )}\n \n \n );\n};\n\nconst styles = StyleSheet.create({\n pin: {\n height: 64,\n width: 48,\n },\n pinWrapper: {\n position: 'absolute',\n },\n});\n"]} \ No newline at end of file +{"version":3,"names":["React","Animated","Image","PanResponder","StyleSheet","View","jsx","_jsx","StaticPin","staticPinPosition","pinAnim","staticPinIcon","pinSize","onParentMove","onPress","onLongPress","setPinSize","pinProps","tapTime","useRef","transform","translateY","height","translateX","width","getTranslateTransform","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,OAAO;EACPC,aAAa;EACbC,OAAO;EACPC,YAAY;EACZC,OAAO;EACPC,WAAW;EACXC,UAAU;EACVC,QAAQ,GAAG,CAAC;AAed,CAAC,KAAK;EACJ,MAAMC,OAAO,GAAGlB,KAAK,CAACmB,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,EAClC,GAAGd,OAAO,CAACe,qBAAqB,CAAC,CAAC,CACnC;EAED,MAAMC,OAAO,GAAGd,OAAO,CAACY,KAAK,IAAIZ,OAAO,CAACU,MAAM,GAAG,CAAC,GAAG,CAAC;EAEvD,MAAMK,YAAY,GAAG3B,KAAK,CAACmB,MAAM,CAC/BhB,YAAY,CAACyB,MAAM,CAAC;IAClBC,4BAA4B,EAAEA,CAAA,KAAM;MAClCX,OAAO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,UAAU,CAACoC,MAAM,CAAC;MACpB,CAAE;MAAA,GACEzB,YAAY,CAAC0B,WAAW;MAAAJ,QAAA,EAE3BtC,aAAa;MAAA;MACZ;MACAJ,IAAA,CAACL,KAAK;QAACoD,MAAM,EAAEC,OAAO,CAAC,mBAAmB,CAAE;QAACb,KAAK,EAAEK,MAAM,CAACS;MAAI,CAAE;IAClE,CACG;EAAC,CACM,CAAC;AAEpB,CAAC;AAED,MAAMT,MAAM,GAAG3C,UAAU,CAACwB,MAAM,CAAC;EAC/B4B,GAAG,EAAE;IACHlC,MAAM,EAAE,EAAE;IACVE,KAAK,EAAE;EACT,CAAC;EACDwB,UAAU,EAAE;IACVS,QAAQ,EAAE;EACZ;AACF,CAAC,CAAC","ignoreList":[]} diff --git a/lib/module/components/index.js b/lib/module/components/index.js index 8d08b10..040fe35 100644 --- a/lib/module/components/index.js +++ b/lib/module/components/index.js @@ -1,2 +1,4 @@ +"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 index f0db222..16f3c60 100644 --- a/lib/module/components/index.js.map +++ b/lib/module/components/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.tsx"],"names":["AnimatedTouchFeedback"],"mappings":"AAAA,SAASA,qBAAT,QAAsC,yBAAtC","sourcesContent":["export { AnimatedTouchFeedback } from './AnimatedTouchFeedback';\n"]} \ No newline at end of file +{"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 index 8f4ba2e..f689e53 100644 --- a/lib/module/debugHelper/index.js +++ b/lib/module/debugHelper/index.js @@ -1,5 +1,8 @@ +"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, @@ -7,7 +10,7 @@ export const DebugTouchPoint = ({ color = 'yellow' }) => { const radius = diameter / 2; - return /*#__PURE__*/React.createElement(View, { + return /*#__PURE__*/_jsx(View, { style: [styles.debugPoint, { width: diameter, height: diameter, @@ -26,7 +29,7 @@ export const DebugRect = ({ color = 'yellow' }) => { const width = 5; - return /*#__PURE__*/React.createElement(View, { + return /*#__PURE__*/_jsx(View, { style: [styles.debugRect, { width, height, diff --git a/lib/module/debugHelper/index.js.map b/lib/module/debugHelper/index.js.map index 4228b21..c87cf2b 100644 --- a/lib/module/debugHelper/index.js.map +++ b/lib/module/debugHelper/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.tsx"],"names":["React","StyleSheet","View","DebugTouchPoint","diameter","x","y","color","radius","styles","debugPoint","width","height","borderRadius","backgroundColor","left","top","DebugRect","debugRect","create","opacity","position"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,UAAT,EAAqBC,IAArB,QAAiC,cAAjC;AAEA,OAAO,MAAMC,eAAe,GAAG,CAAC;AAC9BC,EAAAA,QAAQ,GAAG,EADmB;AAE9BC,EAAAA,CAAC,GAAG,CAF0B;AAG9BC,EAAAA,CAAC,GAAG,CAH0B;AAI9BC,EAAAA,KAAK,GAAG;AAJsB,CAAD,KAKzB;AACJ,QAAMC,MAAM,GAAGJ,QAAQ,GAAG,CAA1B;AACA,sBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLK,MAAM,CAACC,UADF,EAEL;AACEC,MAAAA,KAAK,EAAEP,QADT;AAEEQ,MAAAA,MAAM,EAAER,QAFV;AAGES,MAAAA,YAAY,EAAET,QAHhB;AAIEU,MAAAA,eAAe,EAAEP,KAJnB;AAKEQ,MAAAA,IAAI,EAAEV,CAAC,GAAGG,MALZ;AAMEQ,MAAAA,GAAG,EAAEV,CAAC,GAAGE;AANX,KAFK,CADT;AAYE,IAAA,aAAa,EAAC;AAZhB,IADF;AAgBD,CAvBM;AAwBP,OAAO,MAAMS,SAAS,GAAG,CAAC;AACxBL,EAAAA,MADwB;AAExBP,EAAAA,CAAC,GAAG,CAFoB;AAGxBC,EAAAA,CAAC,GAAG,CAHoB;AAIxBC,EAAAA,KAAK,GAAG;AAJgB,CAAD,KAUnB;AACJ,QAAMI,KAAK,GAAG,CAAd;AACA,sBACE,oBAAC,IAAD;AACE,IAAA,KAAK,EAAE,CACLF,MAAM,CAACS,SADF,EAEL;AACEP,MAAAA,KADF;AAEEC,MAAAA,MAFF;AAGEE,MAAAA,eAAe,EAAEP,KAHnB;AAIEQ,MAAAA,IAAI,EAAEV,CAAC,GAAGM,KAAK,GAAG,CAJpB;AAKEK,MAAAA,GAAG,EAAEV;AALP,KAFK,CADT;AAWE,IAAA,aAAa,EAAC;AAXhB,IADF;AAeD,CA3BM;AA6BP,MAAMG,MAAM,GAAGR,UAAU,CAACkB,MAAX,CAAkB;AAC/BT,EAAAA,UAAU,EAAE;AACVU,IAAAA,OAAO,EAAE,GADC;AAEVC,IAAAA,QAAQ,EAAE;AAFA,GADmB;AAK/BH,EAAAA,SAAS,EAAE;AACTE,IAAAA,OAAO,EAAE,GADA;AAETC,IAAAA,QAAQ,EAAE;AAFD;AALoB,CAAlB,CAAf","sourcesContent":["import React from 'react';\nimport { StyleSheet, View } from 'react-native';\n\nexport const DebugTouchPoint = ({\n diameter = 20,\n x = 0,\n y = 0,\n color = 'yellow',\n}) => {\n const radius = diameter / 2;\n return (\n \n );\n};\nexport const DebugRect = ({\n height,\n x = 0,\n y = 0,\n color = 'yellow',\n}: {\n height: number;\n x: number;\n y: number;\n color: string;\n}) => {\n const width = 5;\n return (\n \n );\n};\n\nconst styles = StyleSheet.create({\n debugPoint: {\n opacity: 0.7,\n position: 'absolute',\n },\n debugRect: {\n opacity: 0.5,\n position: 'absolute',\n },\n});\n"]} \ No newline at end of file +{"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/applyPanBoundariesToOffset.js b/lib/module/helper/applyPanBoundariesToOffset.js index 4c90ed0..35276c0 100644 --- a/lib/module/helper/applyPanBoundariesToOffset.js +++ b/lib/module/helper/applyPanBoundariesToOffset.js @@ -1,3 +1,5 @@ +"use strict"; + /** * Takes a single offset value and calculates the correct offset value * to make sure it's within the pan boundaries @@ -17,38 +19,41 @@ export function applyPanBoundariesToOffset(offsetScaled, containerSize, contentS const contentStartBorderUnscaled = containerSize / 2 + offsetUnscaled - contentSizeUnscaled / 2; const contentEndBorderUnscaled = contentStartBorderUnscaled + contentSizeUnscaled; const containerStartBorder = 0; - const containerEndBorder = containerStartBorder + containerSize; // do not let boundary padding be greater than the container size or less than 0 + const containerEndBorder = containerStartBorder + containerSize; + // do not let boundary padding be greater than the container size or less than 0 if (!boundaryPadding || boundaryPadding < 0) boundaryPadding = 0; - if (boundaryPadding > containerSize) boundaryPadding = containerSize; // Calculate container's measurements with boundary padding applied. + if (boundaryPadding > containerSize) boundaryPadding = containerSize; + + // Calculate container's measurements with boundary padding applied. // this should shrink the container's size by the amount of the boundary padding, // so that the content inside can be panned a bit further away from the original container's boundaries. - const paddedContainerSize = containerSize - boundaryPadding * 2; const paddedContainerStartBorder = containerStartBorder + boundaryPadding; - const paddedContainerEndBorder = containerEndBorder - boundaryPadding; // if content is smaller than the padded container, - // don't let the content move + const paddedContainerEndBorder = containerEndBorder - boundaryPadding; + // if content is smaller than the padded container, + // don't let the content move if (contentSizeUnscaled < paddedContainerSize) { return 0; - } // if content is larger than the padded container, + } + + // if content is larger than the padded container, // don't let the padded container go outside of content + // maximum distance the content's center can move from its original position. // assuming the content original center is the container's center. - - const contentMaxOffsetScaled = (paddedContainerSize / 2 - contentSizeUnscaled / 2) / scale; - - if ( // content reaching the end boundary + if ( + // content reaching the end boundary contentEndBorderUnscaled < paddedContainerEndBorder) { return contentMaxOffsetScaled; } - - if ( // content reaching the start boundary + if ( + // content reaching the start boundary contentStartBorderUnscaled > paddedContainerStartBorder) { return -contentMaxOffsetScaled; } - return offsetScaled; } //# sourceMappingURL=applyPanBoundariesToOffset.js.map \ No newline at end of file diff --git a/lib/module/helper/applyPanBoundariesToOffset.js.map b/lib/module/helper/applyPanBoundariesToOffset.js.map index 56c3058..a7debcb 100644 --- a/lib/module/helper/applyPanBoundariesToOffset.js.map +++ b/lib/module/helper/applyPanBoundariesToOffset.js.map @@ -1 +1 @@ -{"version":3,"sources":["applyPanBoundariesToOffset.ts"],"names":["applyPanBoundariesToOffset","offsetScaled","containerSize","contentSize","scale","boundaryPadding","contentSizeUnscaled","offsetUnscaled","contentStartBorderUnscaled","contentEndBorderUnscaled","containerStartBorder","containerEndBorder","paddedContainerSize","paddedContainerStartBorder","paddedContainerEndBorder","contentMaxOffsetScaled"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,0BAAT,CACLC,YADK,EAELC,aAFK,EAGLC,WAHK,EAILC,KAJK,EAKLC,eALK,EAML;AACA,QAAMC,mBAAmB,GAAGH,WAAW,GAAGC,KAA1C;AACA,QAAMG,cAAc,GAAGN,YAAY,GAAGG,KAAtC;AAEA,QAAMI,0BAA0B,GAC9BN,aAAa,GAAG,CAAhB,GAAoBK,cAApB,GAAqCD,mBAAmB,GAAG,CAD7D;AAEA,QAAMG,wBAAwB,GAC5BD,0BAA0B,GAAGF,mBAD/B;AAGA,QAAMI,oBAAoB,GAAG,CAA7B;AACA,QAAMC,kBAAkB,GAAGD,oBAAoB,GAAGR,aAAlD,CAVA,CAYA;;AACA,MAAI,CAACG,eAAD,IAAoBA,eAAe,GAAG,CAA1C,EAA6CA,eAAe,GAAG,CAAlB;AAC7C,MAAIA,eAAe,GAAGH,aAAtB,EAAqCG,eAAe,GAAGH,aAAlB,CAdrC,CAgBA;AACA;AACA;;AACA,QAAMU,mBAAmB,GAAGV,aAAa,GAAGG,eAAe,GAAG,CAA9D;AACA,QAAMQ,0BAA0B,GAAGH,oBAAoB,GAAGL,eAA1D;AACA,QAAMS,wBAAwB,GAAGH,kBAAkB,GAAGN,eAAtD,CArBA,CAuBA;AACA;;AACA,MAAIC,mBAAmB,GAAGM,mBAA1B,EAA+C;AAC7C,WAAO,CAAP;AACD,GA3BD,CA6BA;AACA;AAEA;AACA;;;AACA,QAAMG,sBAAsB,GAC1B,CAACH,mBAAmB,GAAG,CAAtB,GAA0BN,mBAAmB,GAAG,CAAjD,IAAsDF,KADxD;;AAGA,OACE;AACAK,EAAAA,wBAAwB,GAAGK,wBAF7B,EAGE;AACA,WAAOC,sBAAP;AACD;;AACD,OACE;AACAP,EAAAA,0BAA0B,GAAGK,0BAF/B,EAGE;AACA,WAAO,CAACE,sBAAR;AACD;;AAED,SAAOd,YAAP;AACD","sourcesContent":["/**\n * Takes a single offset value and calculates the correct offset value\n * to make sure it's within the pan boundaries\n *\n *\n * @param offsetScaled\n * @param containerSize\n * @param contentSize\n * @param scale\n * @param boundaryPadding - see README\n *\n * @returns {number}\n */\nexport function applyPanBoundariesToOffset(\n offsetScaled: number,\n containerSize: number,\n contentSize: number,\n scale: number,\n boundaryPadding: number\n) {\n const contentSizeUnscaled = contentSize * scale;\n const offsetUnscaled = offsetScaled * scale;\n\n const contentStartBorderUnscaled =\n containerSize / 2 + offsetUnscaled - contentSizeUnscaled / 2;\n const contentEndBorderUnscaled =\n contentStartBorderUnscaled + contentSizeUnscaled;\n\n const containerStartBorder = 0;\n const containerEndBorder = containerStartBorder + containerSize;\n\n // do not let boundary padding be greater than the container size or less than 0\n if (!boundaryPadding || boundaryPadding < 0) boundaryPadding = 0;\n if (boundaryPadding > containerSize) boundaryPadding = containerSize;\n\n // Calculate container's measurements with boundary padding applied.\n // this should shrink the container's size by the amount of the boundary padding,\n // so that the content inside can be panned a bit further away from the original container's boundaries.\n const paddedContainerSize = containerSize - boundaryPadding * 2;\n const paddedContainerStartBorder = containerStartBorder + boundaryPadding;\n const paddedContainerEndBorder = containerEndBorder - boundaryPadding;\n\n // if content is smaller than the padded container,\n // don't let the content move\n if (contentSizeUnscaled < paddedContainerSize) {\n return 0;\n }\n\n // if content is larger than the padded container,\n // don't let the padded container go outside of content\n\n // maximum distance the content's center can move from its original position.\n // assuming the content original center is the container's center.\n const contentMaxOffsetScaled =\n (paddedContainerSize / 2 - contentSizeUnscaled / 2) / scale;\n\n if (\n // content reaching the end boundary\n contentEndBorderUnscaled < paddedContainerEndBorder\n ) {\n return contentMaxOffsetScaled;\n }\n if (\n // content reaching the start boundary\n contentStartBorderUnscaled > paddedContainerStartBorder\n ) {\n return -contentMaxOffsetScaled;\n }\n\n return offsetScaled;\n}\n"]} \ No newline at end of file +{"version":3,"names":["applyPanBoundariesToOffset","offsetScaled","containerSize","contentSize","scale","boundaryPadding","contentSizeUnscaled","offsetUnscaled","contentStartBorderUnscaled","contentEndBorderUnscaled","containerStartBorder","containerEndBorder","paddedContainerSize","paddedContainerStartBorder","paddedContainerEndBorder","contentMaxOffsetScaled"],"sourceRoot":"../../../src","sources":["helper/applyPanBoundariesToOffset.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,0BAA0BA,CACxCC,YAAoB,EACpBC,aAAqB,EACrBC,WAAmB,EACnBC,KAAa,EACbC,eAAuB,EACvB;EACA,MAAMC,mBAAmB,GAAGH,WAAW,GAAGC,KAAK;EAC/C,MAAMG,cAAc,GAAGN,YAAY,GAAGG,KAAK;EAE3C,MAAMI,0BAA0B,GAC9BN,aAAa,GAAG,CAAC,GAAGK,cAAc,GAAGD,mBAAmB,GAAG,CAAC;EAC9D,MAAMG,wBAAwB,GAC5BD,0BAA0B,GAAGF,mBAAmB;EAElD,MAAMI,oBAAoB,GAAG,CAAC;EAC9B,MAAMC,kBAAkB,GAAGD,oBAAoB,GAAGR,aAAa;;EAE/D;EACA,IAAI,CAACG,eAAe,IAAIA,eAAe,GAAG,CAAC,EAAEA,eAAe,GAAG,CAAC;EAChE,IAAIA,eAAe,GAAGH,aAAa,EAAEG,eAAe,GAAGH,aAAa;;EAEpE;EACA;EACA;EACA,MAAMU,mBAAmB,GAAGV,aAAa,GAAGG,eAAe,GAAG,CAAC;EAC/D,MAAMQ,0BAA0B,GAAGH,oBAAoB,GAAGL,eAAe;EACzE,MAAMS,wBAAwB,GAAGH,kBAAkB,GAAGN,eAAe;;EAErE;EACA;EACA,IAAIC,mBAAmB,GAAGM,mBAAmB,EAAE;IAC7C,OAAO,CAAC;EACV;;EAEA;EACA;;EAEA;EACA;EACA,MAAMG,sBAAsB,GAC1B,CAACH,mBAAmB,GAAG,CAAC,GAAGN,mBAAmB,GAAG,CAAC,IAAIF,KAAK;EAE7D;EACE;EACAK,wBAAwB,GAAGK,wBAAwB,EACnD;IACA,OAAOC,sBAAsB;EAC/B;EACA;EACE;EACAP,0BAA0B,GAAGK,0BAA0B,EACvD;IACA,OAAO,CAACE,sBAAsB;EAChC;EAEA,OAAOd,YAAY;AACrB","ignoreList":[]} diff --git a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js index 398a314..7ac687e 100644 --- a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js +++ b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js @@ -1,3 +1,5 @@ +"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 @@ -50,8 +52,9 @@ */ 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 growthRate = newScale / oldScale; + // these act like namespaces just for the sake of readability const zoomSubjectOriginalCenter = {}; const zoomSubjectCurrentCenter = {}; const zoomSubjectNewCenter = {}; diff --git a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map index de88ce6..a84ce62 100644 --- a/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map +++ b/lib/module/helper/calcNewScaledOffsetForZoomCentering.js.map @@ -1 +1 @@ -{"version":3,"sources":["calcNewScaledOffsetForZoomCentering.ts"],"names":["calcNewScaledOffsetForZoomCentering","oldOffsetXOrYScaled","zoomSubjectOriginalWidthOrHeight","oldScale","newScale","zoomCenterXOrY","oldOffSetUnscaled","growthRate","zoomSubjectOriginalCenter","zoomSubjectCurrentCenter","zoomSubjectNewCenter","xOrY","distanceToZoomCenter","newOffsetUnscaled"],"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,mCAAT,CACLC,mBADK,EAELC,gCAFK,EAGLC,QAHK,EAILC,QAJK,EAKLC,cALK,EAML;AACA,QAAMC,iBAAiB,GAAGL,mBAAmB,GAAGE,QAAhD;AACA,QAAMI,UAAU,GAAGH,QAAQ,GAAGD,QAA9B,CAFA,CAIA;;AACA,QAAMK,yBAAyB,GAAG,EAAlC;AACA,QAAMC,wBAAwB,GAAG,EAAjC;AACA,QAAMC,oBAAoB,GAAG,EAA7B;AAEAF,EAAAA,yBAAyB,CAACG,IAA1B,GAAiCT,gCAAgC,GAAG,CAApE;AACAO,EAAAA,wBAAwB,CAACE,IAAzB,GACEH,yBAAyB,CAACG,IAA1B,GAAiCL,iBADnC;AAEAG,EAAAA,wBAAwB,CAACG,oBAAzB,GACEH,wBAAwB,CAACE,IAAzB,GAAgCN,cADlC;AAGAK,EAAAA,oBAAoB,CAACE,oBAArB,GACEH,wBAAwB,CAACG,oBAAzB,GAAgDL,UADlD;AAEAG,EAAAA,oBAAoB,CAACC,IAArB,GACED,oBAAoB,CAACE,oBAArB,GAA4CP,cAD9C;AAGA,QAAMQ,iBAAiB,GACrBH,oBAAoB,CAACC,IAArB,GAA4BH,yBAAyB,CAACG,IADxD;AAGA,SAAOE,iBAAiB,GAAGT,QAA3B;AACD","sourcesContent":["/**\n * Calculates the new offset for the zoomSubject to ensure zoom center position is retained after zooming.\n * Parameters should correspond to whether we need the offset for the X or Y axis\n *\n * ## Terms Used:\n *\n * - Zoom Subject: the view that's being zoomed and panned\n * - Zoom Center: the point whose relative position to the window is retained\n * - Unscaled: a measurement in pixels denoting the true size as observed by the users' eyes\n * - Scaled: a measurement in pixels scaled to the \"scale transformation\" of the zoom subject to match with its true size.\n * *For example:*\n * If the scale on the zoom subject is 0.5,\n * then to draw an actual 4px line on the zoom subject, we need to scale it to 4px / 0.5 = 8px\n * 8px is the scaled measurement\n *\n * ## Overall idea of this algorithm:\n *\n * When users perform zooming by pinching the screen,\n * we need to shift the zoom subject so that the position of the zoom center is always the same.\n * The offset amount to shift the layer is the returned value.\n *\n *\n * ## How we achieve our goal:\n *\n * To retain, the zoom center position, whenever a zoom action is performed,\n * we just need to make sure the distances from all the points in the zoom subject\n * to the zoom center increases or decreases by the growth rate of the scale.\n *\n * ```\n * newDistanceAnyPointToZoomCenter = oldDistanceAnyPointToZoomCenter * (newScale/oldScale)\n * ```\n *\n * We can't calculate that for all the points because there are unlimited points on a plain.\n * However, due to the way `transform` works in RN, every point is scaled from the zoom subject center.\n * Therefore, it's sufficient to base our calculation on the distance from the zoom subject center to the zoom center.\n *\n * ```\n * newDistanceZoomSubjectCenterToZoomCenter = oldDistanceZoomSubjectCenterToZoomCenter * (newScale/oldScale)\n * ```\n *\n * Once we have `newDistanceZoomSubjectCenterToZoomCenter`,\n * we can easily calculate the position of the new center, which leads us to the offset amount.\n * Refer to the code for more details\n *\n * @param oldOffsetXOrYScaled\n * @param zoomSubjectOriginalWidthOrHeight\n * @param oldScale\n * @param newScale\n * @param zoomCenterXOrY\n */\nexport function calcNewScaledOffsetForZoomCentering(\n oldOffsetXOrYScaled: number,\n zoomSubjectOriginalWidthOrHeight: number,\n oldScale: number,\n newScale: number,\n zoomCenterXOrY: number\n) {\n const oldOffSetUnscaled = oldOffsetXOrYScaled * oldScale;\n const growthRate = newScale / oldScale;\n\n // these act like namespaces just for the sake of readability\n const zoomSubjectOriginalCenter = {} as Center;\n const zoomSubjectCurrentCenter = {} as Center;\n const zoomSubjectNewCenter = {} as Center;\n\n zoomSubjectOriginalCenter.xOrY = zoomSubjectOriginalWidthOrHeight / 2;\n zoomSubjectCurrentCenter.xOrY =\n zoomSubjectOriginalCenter.xOrY + oldOffSetUnscaled;\n zoomSubjectCurrentCenter.distanceToZoomCenter =\n zoomSubjectCurrentCenter.xOrY - zoomCenterXOrY;\n\n zoomSubjectNewCenter.distanceToZoomCenter =\n zoomSubjectCurrentCenter.distanceToZoomCenter * growthRate;\n zoomSubjectNewCenter.xOrY =\n zoomSubjectNewCenter.distanceToZoomCenter + zoomCenterXOrY;\n\n const newOffsetUnscaled =\n zoomSubjectNewCenter.xOrY - zoomSubjectOriginalCenter.xOrY;\n\n return newOffsetUnscaled / newScale;\n}\n\ninterface Center {\n xOrY: number;\n distanceToZoomCenter: number;\n}\n"]} \ No newline at end of file +{"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 index 3a0e7f4..97c2442 100644 --- a/lib/module/helper/coordinateConversion.js +++ b/lib/module/helper/coordinateConversion.js @@ -1,3 +1,5 @@ +"use strict"; + export const defaultTransformSubjectData = { offsetX: 0, offsetY: 0, @@ -7,6 +9,7 @@ export const defaultTransformSubjectData = { 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 @@ -18,7 +21,6 @@ export const defaultTransformSubjectData = { * @param imgSize * @param containerSize */ - export function applyContainResizeMode(imgSize, containerSize) { const { width: imageWidth, @@ -31,7 +33,6 @@ export function applyContainResizeMode(imgSize, containerSize) { const imageAspect = imageWidth / imageHeight; const areaAspect = areaWidth / areaHeight; let newSize; - if (imageAspect >= areaAspect) { // longest edge is horizontal newSize = { @@ -45,7 +46,6 @@ export function applyContainResizeMode(imgSize, containerSize) { 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; @@ -58,12 +58,12 @@ export function applyContainResizeMode(imgSize, containerSize) { scale }; } + /** * get the coord of image's origin relative to the transformSubject * @param resizedImageSize * @param transformSubject */ - export function getImageOriginOnTransformSubject(resizedImageSize, transformSubject) { const { offsetX, @@ -77,6 +77,7 @@ export function getImageOriginOnTransformSubject(resizedImageSize, transformSubj 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 * @@ -86,7 +87,6 @@ export function getImageOriginOnTransformSubject(resizedImageSize, transformSubj * * @return {Vec2D} returns null if point is out of the sheet's bound */ - export function viewportPositionToImagePosition({ viewportPosition, imageSize, diff --git a/lib/module/helper/coordinateConversion.js.map b/lib/module/helper/coordinateConversion.js.map index a16bcd9..b6b0ab8 100644 --- a/lib/module/helper/coordinateConversion.js.map +++ b/lib/module/helper/coordinateConversion.js.map @@ -1 +1 @@ -{"version":3,"sources":["coordinateConversion.ts"],"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"],"mappings":"AAEA,OAAO,MAAMA,2BAA8C,GAAG;AAC5DC,EAAAA,OAAO,EAAE,CADmD;AAE5DC,EAAAA,OAAO,EAAE,CAFmD;AAG5DC,EAAAA,SAAS,EAAE,CAHiD;AAI5DC,EAAAA,aAAa,EAAE,CAJ6C;AAK5DC,EAAAA,cAAc,EAAE,CAL4C;AAM5DC,EAAAA,aAAa,EAAE,CAN6C;AAO5DC,EAAAA,aAAa,EAAE;AAP6C,CAAvD;AAUP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CACLC,OADK,EAELC,aAFK,EAG0D;AAC/D,QAAM;AAAEC,IAAAA,KAAK,EAAEC,UAAT;AAAqBC,IAAAA,MAAM,EAAEC;AAA7B,MAA6CL,OAAnD;AACA,QAAM;AAAEE,IAAAA,KAAK,EAAEI,SAAT;AAAoBF,IAAAA,MAAM,EAAEG;AAA5B,MAA2CN,aAAjD;AACA,QAAMO,WAAW,GAAGL,UAAU,GAAGE,WAAjC;AACA,QAAMI,UAAU,GAAGH,SAAS,GAAGC,UAA/B;AAEA,MAAIG,OAAJ;;AACA,MAAIF,WAAW,IAAIC,UAAnB,EAA+B;AAC7B;AACAC,IAAAA,OAAO,GAAG;AAAER,MAAAA,KAAK,EAAEI,SAAT;AAAoBF,MAAAA,MAAM,EAAEE,SAAS,GAAGE;AAAxC,KAAV;AACD,GAHD,MAGO;AACL;AACAE,IAAAA,OAAO,GAAG;AAAER,MAAAA,KAAK,EAAEK,UAAU,GAAGC,WAAtB;AAAmCJ,MAAAA,MAAM,EAAEG;AAA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AAAA,KAAK,EAAEa;AAA/B,MACJ1B,sBAAsB,CAACuB,SAAD,EAAY;AAChCpB,IAAAA,KAAK,EAAEqB,aAAa,CAAC5B,aADW;AAEhCS,IAAAA,MAAM,EAAEmB,aAAa,CAAC3B;AAFU,GAAZ,CADxB;AAMA,MAAI6B,eAAe,IAAI,IAAvB,EAA6B,OAAO,IAAP;AAE7B,QAAMC,sBAAsB,GAAGX,gCAAgC,CAC7DS,cAD6D,EAE7DD,aAF6D,CAA/D;AAKA,QAAMI,YAAY,GAAG;AACnBT,IAAAA,CAAC,EACC,CAACG,gBAAgB,CAACH,CAAjB,GAAqBQ,sBAAsB,CAACR,CAA7C,IACAK,aAAa,CAAC7B,SADd,GAEA+B,eAJiB;AAKnBN,IAAAA,CAAC,EACC,CAACE,gBAAgB,CAACF,CAAjB,GAAqBO,sBAAsB,CAACP,CAA7C,IACAI,aAAa,CAAC7B,SADd,GAEA+B;AARiB,GAArB;AAWA,SAAOE,YAAP;AACD","sourcesContent":["import { Size2D, Vec2D, ZoomableViewEvent } from 'src/typings';\n\nexport const defaultTransformSubjectData: ZoomableViewEvent = {\n offsetX: 0,\n offsetY: 0,\n zoomLevel: 0,\n originalWidth: 0,\n originalHeight: 0,\n originalPageX: 0,\n originalPageY: 0,\n};\n\n/**\n * Assuming you have an image that's being resized to fit into a container\n * using the \"contain\" resize mode. You can use this function to calculate the\n * size of the image after fitting.\n *\n * Since our sheet is resized in this manner, we need this function\n * for things like pan boundaries and marker placement\n *\n * @param imgSize\n * @param containerSize\n */\nexport function applyContainResizeMode(\n imgSize: Size2D,\n containerSize: Size2D\n): { size: Size2D; scale: number } | { size: null; scale: null } {\n const { width: imageWidth, height: imageHeight } = imgSize;\n const { width: areaWidth, height: areaHeight } = containerSize;\n const imageAspect = imageWidth / imageHeight;\n const areaAspect = areaWidth / areaHeight;\n\n let newSize;\n if (imageAspect >= areaAspect) {\n // longest edge is horizontal\n newSize = { width: areaWidth, height: areaWidth / imageAspect };\n } else {\n // longest edge is vertical\n newSize = { width: areaHeight * imageAspect, height: areaHeight };\n }\n\n if (isNaN(newSize.height)) newSize.height = areaHeight;\n if (isNaN(newSize.width)) newSize.width = areaWidth;\n\n const scale = imageWidth\n ? newSize.width / imageWidth\n : newSize.height / imageHeight;\n\n if (!isFinite(scale)) return { size: null, scale: null };\n\n return {\n size: newSize,\n scale,\n };\n}\n\n/**\n * get the coord of image's origin relative to the transformSubject\n * @param resizedImageSize\n * @param transformSubject\n */\nexport function getImageOriginOnTransformSubject(\n resizedImageSize: Size2D,\n transformSubject: ZoomableViewEvent\n) {\n const { offsetX, offsetY, zoomLevel, originalWidth, originalHeight } =\n transformSubject;\n return {\n x:\n offsetX * zoomLevel +\n originalWidth / 2 -\n (resizedImageSize.width / 2) * zoomLevel,\n y:\n offsetY * zoomLevel +\n originalHeight / 2 -\n (resizedImageSize.height / 2) * zoomLevel,\n };\n}\n\n/**\n * Translates the coord system of a point from the viewport's space to the image's space\n *\n * @param pointOnContainer\n * @param sheetImageSize\n * @param transformSubject\n *\n * @return {Vec2D} returns null if point is out of the sheet's bound\n */\nexport function viewportPositionToImagePosition({\n viewportPosition,\n imageSize,\n zoomableEvent,\n}: {\n viewportPosition: Vec2D;\n imageSize: Size2D;\n zoomableEvent: ZoomableViewEvent;\n}): Vec2D | null {\n const { size: resizedImgSize, scale: resizedImgScale } =\n applyContainResizeMode(imageSize, {\n width: zoomableEvent.originalWidth,\n height: zoomableEvent.originalHeight,\n });\n\n if (resizedImgScale == null) return null;\n\n const sheetOriginOnContainer = getImageOriginOnTransformSubject(\n resizedImgSize,\n zoomableEvent\n );\n\n const pointOnSheet = {\n x:\n (viewportPosition.x - sheetOriginOnContainer.x) /\n zoomableEvent.zoomLevel /\n resizedImgScale,\n y:\n (viewportPosition.y - sheetOriginOnContainer.y) /\n zoomableEvent.zoomLevel /\n resizedImgScale,\n };\n\n return pointOnSheet;\n}\n"]} \ No newline at end of file +{"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,MAAM;IAAEC,KAAK,EAAEC,UAAU;IAAEC,MAAM,EAAEC;EAAY,CAAC,GAAGL,OAAO;EAC1D,MAAM;IAAEE,KAAK,EAAEI,SAAS;IAAEF,MAAM,EAAEG;EAAW,CAAC,GAAGN,aAAa;EAC9D,MAAMO,WAAW,GAAGL,UAAU,GAAGE,WAAW;EAC5C,MAAMI,UAAU,GAAGH,SAAS,GAAGC,UAAU;EAEzC,IAAIG,OAAO;EACX,IAAIF,WAAW,IAAIC,UAAU,EAAE;IAC7B;IACAC,OAAO,GAAG;MAAER,KAAK,EAAEI,SAAS;MAAEF,MAAM,EAAEE,SAAS,GAAGE;IAAY,CAAC;EACjE,CAAC,MAAM;IACL;IACAE,OAAO,GAAG;MAAER,KAAK,EAAEK,UAAU,GAAGC,WAAW;MAAEJ,MAAM,EAAEG;IAAW,CAAC;EACnE;EAEA,IAAII,KAAK,CAACD,OAAO,CAACN,MAAM,CAAC,EAAEM,OAAO,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AE,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 index 10c2ca9..6150782 100644 --- a/lib/module/helper/index.js +++ b/lib/module/helper/index.js @@ -1,4 +1,12 @@ +"use strict"; + export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering'; + +// Minimum distance between two touch points to be considered a valid pinch gesture +// Uses Apple's Human Interface Guidelines recommended minimum touch target size +// https://developer.apple.com/design/human-interface-guidelines/accessibility#Mobility +const MIN_PINCH_DISTANCE = 44; + /** * Calculates the gesture center point relative to the page coordinate system * @@ -10,11 +18,9 @@ export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoo * 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 { @@ -22,14 +28,12 @@ export function calcGestureCenterPoint(e, gestureState) { 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) { @@ -37,6 +41,6 @@ export function calcGestureTouchDistance(e, gestureState) { 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); + return Math.max(MIN_PINCH_DISTANCE, 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 index f60fb21..5ad6ed0 100644 --- a/lib/module/helper/index.js.map +++ b/lib/module/helper/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":["calcNewScaledOffsetForZoomCentering","calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","sqrt"],"mappings":"AAIA,SAASA,mCAAT,QAAoD,uCAApD;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,sBAAT,CACLC,CADK,EAELC,YAFK,EAGS;AACd,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAI,CAACA,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;;AAEjB,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,QAAI,CAACF,OAAO,CAAC,CAAD,CAAZ,EAAiB,OAAO,IAAP;AACjB,WAAO;AACLG,MAAAA,CAAC,EAAE,CAACH,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,GAAmBJ,OAAO,CAAC,CAAD,CAAP,CAAWI,KAA/B,IAAwC,CADtC;AAELC,MAAAA,CAAC,EAAE,CAACL,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,GAAmBN,OAAO,CAAC,CAAD,CAAP,CAAWM,KAA/B,IAAwC;AAFtC,KAAP;AAID;;AACD,MAAIP,YAAY,CAACG,mBAAb,KAAqC,CAAzC,EAA4C;AAC1C,WAAO;AACLC,MAAAA,CAAC,EAAEH,OAAO,CAAC,CAAD,CAAP,CAAWI,KADT;AAELC,MAAAA,CAAC,EAAEL,OAAO,CAAC,CAAD,CAAP,CAAWM;AAFT,KAAP;AAID;;AAED,SAAO,IAAP;AACD;AAED,OAAO,SAASC,wBAAT,CACLT,CADK,EAELC,YAFK,EAGU;AACf,QAAMC,OAAO,GAAGF,CAAC,CAACG,WAAF,CAAcD,OAA9B;AACA,MAAID,YAAY,CAACG,mBAAb,KAAqC,CAArC,IAA0C,CAACF,OAAO,CAAC,CAAD,CAAlD,IAAyD,CAACA,OAAO,CAAC,CAAD,CAArE,EACE,OAAO,IAAP;AAEF,QAAMQ,EAAE,GAAGC,IAAI,CAACC,GAAL,CAASV,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAX,GAAmBJ,OAAO,CAAC,CAAD,CAAP,CAAWI,KAAvC,CAAX;AACA,QAAMO,EAAE,GAAGF,IAAI,CAACC,GAAL,CAASV,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAX,GAAmBN,OAAO,CAAC,CAAD,CAAP,CAAWM,KAAvC,CAAX;AACA,SAAOG,IAAI,CAACG,IAAL,CAAUJ,EAAE,GAAGA,EAAL,GAAUG,EAAE,GAAGA,EAAzB,CAAP;AACD","sourcesContent":["import { GestureResponderEvent, PanResponderGestureState } from 'react-native';\n\nimport { Vec2D } from '../typings';\n\nexport { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering';\n\n/**\n * Calculates the gesture center point relative to the page coordinate system\n *\n * We're unable to use touch.locationX/Y\n * because locationX uses the axis system of the leaf element that the touch occurs on,\n * which makes it even more complicated to translate into our container's axis system.\n *\n * We're also unable to use gestureState.moveX/Y\n * because gestureState.moveX/Y is messed up on real device\n * (Sometimes it's the center point, but sometimes it randomly takes the position of one of the touches)\n */\nexport function calcGestureCenterPoint(\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n): Vec2D | null {\n const touches = e.nativeEvent.touches;\n if (!touches[0]) return null;\n\n if (gestureState.numberActiveTouches === 2) {\n if (!touches[1]) return null;\n return {\n x: (touches[0].pageX + touches[1].pageX) / 2,\n y: (touches[0].pageY + touches[1].pageY) / 2,\n };\n }\n if (gestureState.numberActiveTouches === 1) {\n return {\n x: touches[0].pageX,\n y: touches[0].pageY,\n };\n }\n\n return null;\n}\n\nexport function calcGestureTouchDistance(\n e: GestureResponderEvent,\n gestureState: PanResponderGestureState\n): number | null {\n const touches = e.nativeEvent.touches;\n if (gestureState.numberActiveTouches !== 2 || !touches[0] || !touches[1])\n return null;\n\n const dx = Math.abs(touches[0].pageX - touches[1].pageX);\n const dy = Math.abs(touches[0].pageY - touches[1].pageY);\n return Math.sqrt(dx * dx + dy * dy);\n}\n"]} \ No newline at end of file +{"version":3,"names":["calcNewScaledOffsetForZoomCentering","MIN_PINCH_DISTANCE","calcGestureCenterPoint","e","gestureState","touches","nativeEvent","numberActiveTouches","x","pageX","y","pageY","calcGestureTouchDistance","dx","Math","abs","dy","max","sqrt"],"sourceRoot":"../../../src","sources":["helper/index.ts"],"mappings":";;AAIA,SAASA,mCAAmC,QAAQ,uCAAuC;;AAE3F;AACA;AACA;AACA,MAAMC,kBAAkB,GAAG,EAAE;;AAE7B;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;EAExD,OAAOG,IAAI,CAACG,GAAG,CAAChB,kBAAkB,EAAEa,IAAI,CAACI,IAAI,CAACL,EAAE,GAAGA,EAAE,GAAGG,EAAE,GAAGA,EAAE,CAAC,CAAC;AACnE","ignoreList":[]} diff --git a/lib/module/index.js b/lib/module/index.js index 432f052..bd05c56 100644 --- a/lib/module/index.js +++ b/lib/module/index.js @@ -1,5 +1,8 @@ +"use strict"; + import { applyContainResizeMode, getImageOriginOnTransformSubject, viewportPositionToImagePosition } from './helper/coordinateConversion'; import ReactNativeZoomableView from './ReactNativeZoomableView'; -export { // Helper functions for coordinate conversion +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 index 747eb36..add721f 100644 --- a/lib/module/index.js.map +++ b/lib/module/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.tsx"],"names":["applyContainResizeMode","getImageOriginOnTransformSubject","viewportPositionToImagePosition","ReactNativeZoomableView"],"mappings":"AAAA,SACEA,sBADF,EAEEC,gCAFF,EAGEC,+BAHF,QAIO,+BAJP;AAKA,OAAOC,uBAAP,MAAoC,2BAApC;AAMA,SACE;AACAH,sBAFF,EAGEC,gCAHF,EAIEE,uBAJF,EAMED,+BANF","sourcesContent":["import {\n applyContainResizeMode,\n getImageOriginOnTransformSubject,\n viewportPositionToImagePosition,\n} from './helper/coordinateConversion';\nimport ReactNativeZoomableView from './ReactNativeZoomableView';\nimport type {\n ReactNativeZoomableViewProps,\n ZoomableViewEvent,\n} from './typings';\n\nexport {\n // Helper functions for coordinate conversion\n applyContainResizeMode,\n getImageOriginOnTransformSubject,\n ReactNativeZoomableView,\n ReactNativeZoomableViewProps,\n viewportPositionToImagePosition,\n ZoomableViewEvent,\n};\n"]} \ No newline at end of file +{"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 new file mode 100644 index 0000000..089153b --- /dev/null +++ b/lib/module/package.json @@ -0,0 +1 @@ +{"type":"module"} diff --git a/lib/module/typings/index.js b/lib/module/typings/index.js index 12922c4..f9391cf 100644 --- a/lib/module/typings/index.js +++ b/lib/module/typings/index.js @@ -1,9 +1,10 @@ -export let SwipeDirection; +"use strict"; -(function (SwipeDirection) { +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"; -})(SwipeDirection || (SwipeDirection = {})); + 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 index 377f5d5..533f3a9 100644 --- a/lib/module/typings/index.js.map +++ b/lib/module/typings/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["index.ts"],"names":["SwipeDirection"],"mappings":"AASA,WAAYA,cAAZ;;WAAYA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;AAAAA,EAAAA,c;GAAAA,c,KAAAA,c","sourcesContent":["import { ReactNode } from 'react';\nimport {\n Animated,\n GestureResponderEvent,\n LayoutChangeEvent,\n PanResponderGestureState,\n ViewProps,\n} from 'react-native';\n\nexport enum SwipeDirection {\n SWIPE_UP = 'SWIPE_UP',\n SWIPE_DOWN = 'SWIPE_DOWN',\n SWIPE_LEFT = 'SWIPE_LEFT',\n SWIPE_RIGHT = 'SWIPE_RIGHT',\n}\n\nexport interface ZoomableViewEvent {\n zoomLevel: number;\n offsetX: number;\n offsetY: number;\n originalHeight: number;\n originalWidth: number;\n originalPageX: number;\n originalPageY: number;\n}\n\nexport interface ReactNativeZoomableViewProps {\n // options\n style?: ViewProps['style'];\n children?: ReactNode;\n zoomEnabled?: boolean;\n panEnabled?: boolean;\n initialZoom?: number;\n initialOffsetX?: number;\n initialOffsetY?: number;\n contentWidth?: number;\n contentHeight?: number;\n panBoundaryPadding?: number;\n maxZoom?: number;\n minZoom?: number;\n doubleTapDelay?: number;\n doubleTapZoomToCenter?: boolean;\n bindToBorders?: boolean;\n zoomStep?: number;\n pinchToZoomInSensitivity?: number;\n pinchToZoomOutSensitivity?: number;\n movementSensibility?: number;\n longPressDuration?: number;\n visualTouchFeedbackEnabled?: boolean;\n disablePanOnInitialZoom?: boolean;\n\n // Zoom animated value ref\n zoomAnimatedValue?: Animated.Value;\n panAnimatedValueXY?: Animated.ValueXY;\n\n // debug\n debug?: boolean;\n\n // callbacks\n onLayout?: (event: Pick) => void;\n onTransform?: (zoomableViewEventObject: ZoomableViewEvent) => void;\n onSingleTap?: (\n event: GestureResponderEvent,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onDoubleTapBefore?: (\n event: GestureResponderEvent,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onDoubleTapAfter?: (\n event: GestureResponderEvent,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onShiftingBefore?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onShiftingAfter?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onShiftingEnd?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onZoomBefore?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean | undefined;\n onZoomAfter?: (\n event: GestureResponderEvent | null,\n gestureState: PanResponderGestureState | null,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onZoomEnd?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onLongPress?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onStartShouldSetPanResponder?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent,\n baseComponentResult: boolean\n ) => boolean;\n onPanResponderGrant?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onPanResponderEnd?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onPanResponderMove?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onPanResponderTerminate?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => void;\n onPanResponderTerminationRequest?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onShouldBlockNativeResponder?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState,\n zoomableViewEventObject: ZoomableViewEvent\n ) => boolean;\n onStartShouldSetPanResponderCapture?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => boolean;\n onMoveShouldSetPanResponderCapture?: (\n event: GestureResponderEvent,\n gestureState: PanResponderGestureState\n ) => boolean;\n onStaticPinPress?: (event: GestureResponderEvent) => void;\n onStaticPinLongPress?: (event: GestureResponderEvent) => void;\n staticPinPosition?: Vec2D;\n staticPinIcon?: React.ReactElement;\n onStaticPinPositionChange?: (position: Vec2D) => void;\n onStaticPinPositionMove?: (position: Vec2D) => void;\n animatePin: boolean;\n pinProps?: ViewProps;\n disableMomentum?: boolean;\n}\n\nexport interface Vec2D {\n x: number;\n y: number;\n}\n\nexport interface Size2D {\n width: number;\n height: number;\n}\n\nexport interface TouchPoint extends Vec2D {\n id: string;\n isSecondTap?: boolean;\n}\n\nexport interface ReactNativeZoomableViewState {\n touches?: TouchPoint[];\n originalWidth: number;\n originalHeight: number;\n originalPageX: number;\n originalPageY: number;\n originalX: number;\n originalY: number;\n debugPoints?: undefined | Vec2D[];\n pinSize: Size2D;\n}\n\nexport interface ReactNativeZoomableViewWithGesturesProps\n extends ReactNativeZoomableViewProps {\n swipeLengthThreshold?: number;\n swipeVelocityThreshold?: number;\n swipeDirectionalThreshold?: number;\n swipeMinZoom?: number;\n swipeMaxZoom?: number;\n swipeDisabled?: boolean;\n onSwipe?: (\n swipeDirection: SwipeDirection,\n gestureState: PanResponderGestureState\n ) => void;\n onSwipeUp?: (gestureState: PanResponderGestureState) => void;\n onSwipeDown?: (gestureState: PanResponderGestureState) => void;\n onSwipeLeft?: (gestureState: PanResponderGestureState) => void;\n onSwipeRight?: (gestureState: PanResponderGestureState) => void;\n}\n"]} \ No newline at end of file +{"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 index 92b4733..5e70a2a 100644 --- a/lib/typescript/ReactNativeZoomableView.d.ts +++ b/lib/typescript/ReactNativeZoomableView.d.ts @@ -1,5 +1,5 @@ /// -import { Component, RefObject } from 'react'; +import React, { Component, RefObject } from 'react'; import { GestureResponderEvent, PanResponderCallbacks, PanResponderGestureState, PanResponderInstance, View } from 'react-native'; import { ReactNativeZoomableViewProps, ReactNativeZoomableViewState, Vec2D, ZoomableViewEvent } from './typings'; declare class ReactNativeZoomableView extends Component { @@ -239,7 +239,8 @@ declare class ReactNativeZoomableView extends Component void) | undefined; -}) => JSX.Element; +}) => 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 new file mode 100644 index 0000000..47da034 --- /dev/null +++ b/lib/typescript/components/AnimatedTouchFeedback.d.ts.map @@ -0,0 +1 @@ +{"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 index f9f2e29..6f86563 100644 --- a/lib/typescript/components/StaticPin.d.ts +++ b/lib/typescript/components/StaticPin.d.ts @@ -15,4 +15,5 @@ export declare const StaticPin: ({ staticPinPosition, pinAnim, staticPinIcon, pi onLongPress?: ((evt: GestureResponderEvent) => void) | undefined; setPinSize: (size: Size2D) => void; pinProps?: ViewProps | undefined; -}) => JSX.Element; +}) => 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 new file mode 100644 index 0000000..9c8b351 --- /dev/null +++ b/lib/typescript/components/StaticPin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"StaticPin.d.ts","sourceRoot":"","sources":["../../../src/components/StaticPin.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,QAAQ,EACR,qBAAqB,EAGrB,wBAAwB,EAGxB,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,eAAO,MAAM,SAAS;uBAWD;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;aAClC,SAAS,OAAO;mBACV,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;;uBAkEnC,CAAC"} \ No newline at end of file diff --git a/lib/typescript/components/index.d.ts b/lib/typescript/components/index.d.ts index da7df19..dbcaede 100644 --- a/lib/typescript/components/index.d.ts +++ b/lib/typescript/components/index.d.ts @@ -1 +1,2 @@ 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 new file mode 100644 index 0000000..7c9cccd --- /dev/null +++ b/lib/typescript/components/index.d.ts.map @@ -0,0 +1 @@ +{"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 index b2bc7b0..b17e292 100644 --- a/lib/typescript/debugHelper/index.d.ts +++ b/lib/typescript/debugHelper/index.d.ts @@ -1,12 +1,14 @@ +import React from 'react'; export declare const DebugTouchPoint: ({ diameter, x, y, color, }: { diameter?: number | undefined; x?: number | undefined; y?: number | undefined; color?: string | undefined; -}) => JSX.Element; +}) => React.JSX.Element; export declare const DebugRect: ({ height, x, y, color, }: { height: number; x: number; y: number; color: string; -}) => JSX.Element; +}) => 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 new file mode 100644 index 0000000..86a4d35 --- /dev/null +++ b/lib/typescript/debugHelper/index.d.ts.map @@ -0,0 +1 @@ +{"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/applyPanBoundariesToOffset.d.ts b/lib/typescript/helper/applyPanBoundariesToOffset.d.ts index e735ca8..1fdb93d 100644 --- a/lib/typescript/helper/applyPanBoundariesToOffset.d.ts +++ b/lib/typescript/helper/applyPanBoundariesToOffset.d.ts @@ -12,3 +12,4 @@ * @returns {number} */ export declare function applyPanBoundariesToOffset(offsetScaled: number, containerSize: number, contentSize: number, scale: number, boundaryPadding: number): number; +//# sourceMappingURL=applyPanBoundariesToOffset.d.ts.map \ No newline at end of file diff --git a/lib/typescript/helper/applyPanBoundariesToOffset.d.ts.map b/lib/typescript/helper/applyPanBoundariesToOffset.d.ts.map new file mode 100644 index 0000000..89a116f --- /dev/null +++ b/lib/typescript/helper/applyPanBoundariesToOffset.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"applyPanBoundariesToOffset.d.ts","sourceRoot":"","sources":["../../../src/helper/applyPanBoundariesToOffset.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,0BAA0B,CACxC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,MAAM,UAoDxB"} \ No newline at end of file diff --git a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts index a6f4d7f..7503b33 100644 --- a/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts +++ b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts @@ -49,3 +49,4 @@ * @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 new file mode 100644 index 0000000..4ffc3f5 --- /dev/null +++ b/lib/typescript/helper/calcNewScaledOffsetForZoomCentering.d.ts.map @@ -0,0 +1 @@ +{"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 index edfd884..c8bfdc0 100644 --- a/lib/typescript/helper/coordinateConversion.d.ts +++ b/lib/typescript/helper/coordinateConversion.d.ts @@ -41,3 +41,4 @@ export declare function viewportPositionToImagePosition({ viewportPosition, imag 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 new file mode 100644 index 0000000..c43dfee --- /dev/null +++ b/lib/typescript/helper/coordinateConversion.d.ts.map @@ -0,0 +1 @@ +{"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 index a016441..bc85ca3 100644 --- a/lib/typescript/helper/index.d.ts +++ b/lib/typescript/helper/index.d.ts @@ -14,3 +14,4 @@ export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoo */ 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 new file mode 100644 index 0000000..6885d58 --- /dev/null +++ b/lib/typescript/helper/index.d.ts.map @@ -0,0 +1 @@ +{"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;AAO5F;;;;;;;;;;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,CASf"} \ No newline at end of file diff --git a/lib/typescript/index.d.ts b/lib/typescript/index.d.ts index a4f5571..7b02103 100644 --- a/lib/typescript/index.d.ts +++ b/lib/typescript/index.d.ts @@ -2,3 +2,4 @@ import { applyContainResizeMode, getImageOriginOnTransformSubject, viewportPosit 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 new file mode 100644 index 0000000..2a3655b --- /dev/null +++ b/lib/typescript/index.d.ts.map @@ -0,0 +1 @@ +{"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 index 32e2b03..62d2b23 100644 --- a/lib/typescript/typings/index.d.ts +++ b/lib/typescript/typings/index.d.ts @@ -108,3 +108,4 @@ export interface ReactNativeZoomableViewWithGesturesProps extends ReactNativeZoo 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 new file mode 100644 index 0000000..6023f50 --- /dev/null +++ b/lib/typescript/typings/index.d.ts.map @@ -0,0 +1 @@ +{"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,C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YAAY,EAAE,wBAAwB,KAAK,IAAI,CAAC;CACjE"} \ No newline at end of file diff --git a/src/helper/index.ts b/src/helper/index.ts index 9cf3a90..73f56dd 100644 --- a/src/helper/index.ts +++ b/src/helper/index.ts @@ -4,6 +4,11 @@ import { Vec2D } from '../typings'; export { calcNewScaledOffsetForZoomCentering } from './calcNewScaledOffsetForZoomCentering'; +// Minimum distance between two touch points to be considered a valid pinch gesture +// Uses Apple's Human Interface Guidelines recommended minimum touch target size +// https://developer.apple.com/design/human-interface-guidelines/accessibility#Mobility +const MIN_PINCH_DISTANCE = 44; + /** * Calculates the gesture center point relative to the page coordinate system * @@ -49,5 +54,6 @@ export function calcGestureTouchDistance( 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); + + return Math.max(MIN_PINCH_DISTANCE, Math.sqrt(dx * dx + dy * dy)); }