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016 - present The Material Motion Authors. All Rights Reserved.\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\r\n *  use this file except in compliance with the License. You may obtain a copy\r\n *  of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\r\n *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n *  License for the specific language governing permissions and limitations\r\n *  under the License.\r\n */\r\nimport { Axis, State, } from '../enums';\r\nimport { anyOf, not, when, } from '../aggregators';\r\nimport { getVelocity$, } from '../getVelocity$';\r\nimport { createProperty, } from '../observables/';\r\nimport { subscribe, } from '../subscribe';\r\nexport class Tossable {\r\n    constructor({ draggable, spring }) {\r\n        this.state$ = createProperty({\r\n            initialValue: State.AT_REST,\r\n        });\r\n        /**\r\n         * This is the point from which all other resistance calculations are\r\n         * measured.\r\n         */\r\n        this.resistanceOrigin$ = createProperty({\r\n            initialValue: { x: 0, y: 0 },\r\n        });\r\n        /**\r\n         * This is the distance from the origin that an item can be freely dragged\r\n         * without encountering resistance.\r\n         */\r\n        this.radiusUntilResistance$ = createProperty({\r\n            initialValue: 0,\r\n        });\r\n        /**\r\n         * For carousels or swipeable lists, this is the width of one item.\r\n         *\r\n         * To apply resistance, the calculation needs to determine the amount of\r\n         * progress through a drag.  `resistanceBasis` is the denominator in this\r\n         * calculation. For instance, if a drag is 20px beyond `radiusUntilResistance`\r\n         * and `resistanceBasis` is 50, the drag progress used by the resistance\r\n         * calculation is 40%.\r\n         *\r\n         * Note: a drag cannot move farther than `resistanceBasis` beyond\r\n         * `radiusUntilResistance`.\r\n         */\r\n        this.resistanceBasis$ = createProperty({\r\n            initialValue: 0,\r\n        });\r\n        /**\r\n         * This value determines how far beyond `radiusUntilResistance` a drag is\r\n         * limited to.\r\n         *\r\n         * It works in conjunction with `resistanceBasis`.  If `resistanceBasis` is 50\r\n         * and `resistanceFactor` is 5, the drag is limited to 10px (basis / factor)\r\n         * beyond `radiusUntilResistance`.\r\n         */\r\n        this.resistanceFactor$ = createProperty({\r\n            initialValue: 0,\r\n        });\r\n        this.location$ = createProperty({\r\n            initialValue: { x: 0, y: 0 },\r\n        });\r\n        this.draggable = draggable;\r\n        this.spring = spring;\r\n        const dragIsAtRest$ = draggable.state$.rewrite({\r\n            mapping: {\r\n                [State.AT_REST]: true,\r\n                [State.ACTIVE]: false,\r\n            }\r\n        }).dedupe();\r\n        const whenDragIsAtRest$ = when(dragIsAtRest$);\r\n        const whenDragIsActive$ = when(not(dragIsAtRest$));\r\n        // This block needs to come before the one that sets spring enabled to\r\n        // ensure the spring initializes with the correct values; otherwise, it will\r\n        // start from 0\r\n        subscribe({\r\n            sink: spring.initialValue$,\r\n            source: this.location$._debounce({ pulse$: whenDragIsAtRest$ }),\r\n        });\r\n        const locationOnDown$ = this.location$._debounce({ pulse$: whenDragIsActive$ });\r\n        this.draggedLocation$ = draggable.value$.addedBy({\r\n            value$: locationOnDown$,\r\n            onlyEmitWithUpstream: true\r\n        })._reactiveMap({\r\n            transform: ({ upstream: location, resistanceOrigin, radiusUntilResistance, resistanceBasis, resistanceFactor, }) => {\r\n                if (!resistanceFactor) {\r\n                    return location;\r\n                }\r\n                // We apply resistance radially, leading to all the trig below.  In most\r\n                // cases, the draggable element will be axis locked, which means there's\r\n                // room to short circuit the logic here with simpler solutions when we\r\n                // know either x or y is constant.\r\n                const locationFromOrigin = {\r\n                    x: location.x - resistanceOrigin.x,\r\n                    y: location.y - resistanceOrigin.y,\r\n                };\r\n                const overflowRadius = Math.sqrt(Math.pow(locationFromOrigin.x, 2) + Math.pow(locationFromOrigin.y, 2)) - radiusUntilResistance;\r\n                const resistanceProgress = Math.max(0, Math.min(1, overflowRadius / resistanceBasis));\r\n                if (overflowRadius < 0) {\r\n                    return location;\r\n                }\r\n                const radiusWithResistance = resistanceBasis / resistanceFactor * Math.sin(resistanceProgress * Math.PI / 2) + radiusUntilResistance;\r\n                const angle = Math.atan2(locationFromOrigin.y, locationFromOrigin.x);\r\n                return {\r\n                    x: resistanceOrigin.x + radiusWithResistance * Math.cos(angle),\r\n                    y: resistanceOrigin.y + radiusWithResistance * Math.sin(angle),\r\n                };\r\n            },\r\n            inputs: {\r\n                resistanceOrigin: this.resistanceOrigin$,\r\n                radiusUntilResistance: this.radiusUntilResistance$,\r\n                resistanceBasis: this.resistanceBasis$,\r\n                resistanceFactor: this.resistanceFactor$,\r\n            },\r\n            onlyEmitWithUpstream: true,\r\n        });\r\n        this.velocity$ = getVelocity$({\r\n            // Since drag starts at rest, whenDragIsAtRest$ emits immediately.  Thus,\r\n            // we start with { 0, 0 } to ensure velocity doesn't emit undefined.\r\n            value$: this.draggedLocation$.startWith({ x: 0, y: 0 }),\r\n            pulse$: whenDragIsAtRest$,\r\n        });\r\n        subscribe({\r\n            sink: spring.initialVelocity$,\r\n            source: this.velocity$,\r\n        });\r\n        subscribe({\r\n            sink: spring.enabled$,\r\n            source: dragIsAtRest$,\r\n        });\r\n        subscribe({\r\n            sink: this.state$,\r\n            source: anyOf([\r\n                spring.state$.isAnyOf([State.ACTIVE]),\r\n                draggable.state$.isAnyOf([State.ACTIVE]),\r\n            ]).rewrite({\r\n                mapping: {\r\n                    true: State.ACTIVE,\r\n                    false: State.AT_REST,\r\n                },\r\n            }).dedupe(),\r\n        });\r\n        subscribe({\r\n            sink: this.location$,\r\n            source: spring.enabled$.rewrite({\r\n                mapping: {\r\n                    true: spring.value$,\r\n                    false: this.draggedLocation$,\r\n                },\r\n                emitOnKeyChange: false,\r\n            })._debounce(),\r\n        });\r\n        this.styleStreams = {\r\n            translate$: this.location$,\r\n            willChange$: this.state$.rewrite({\r\n                mapping: {\r\n                    [State.ACTIVE]: 'transform',\r\n                    [State.AT_REST]: '',\r\n                },\r\n            }),\r\n        };\r\n    }\r\n    get state() {\r\n        return this.state$.read();\r\n    }\r\n    get resistanceOrigin() {\r\n        return this.resistanceOrigin$.read();\r\n    }\r\n    set resistanceOrigin(value) {\r\n        this.resistanceOrigin$.write(value);\r\n    }\r\n    get radiusUntilResistance() {\r\n        return this.radiusUntilResistance$.read();\r\n    }\r\n    set radiusUntilResistance(value) {\r\n        this.radiusUntilResistance$.write(value);\r\n    }\r\n    get resistanceBasis() {\r\n        return this.resistanceBasis$.read();\r\n    }\r\n    set resistanceBasis(value) {\r\n        this.resistanceBasis$.write(value);\r\n    }\r\n    get resistanceFactor() {\r\n        return this.resistanceFactor$.read();\r\n    }\r\n    set resistanceFactor(value) {\r\n        this.resistanceFactor$.write(value);\r\n    }\r\n}\r\nexport default Tossable;\r\nexport function applyLinearResistanceToTossable({ tossable, min$, max$, axis$, basis$, factor$, }) {\r\n    subscribe({\r\n        sink: tossable.resistanceBasis$,\r\n        source: basis$,\r\n    });\r\n    subscribe({\r\n        sink: tossable.resistanceFactor$,\r\n        source: factor$,\r\n    });\r\n    subscribe({\r\n        sink: tossable.radiusUntilResistance$,\r\n        source: min$._reactiveMap({\r\n            transform: ({ upstream: min, max }) => Math.abs(max - min) / 2,\r\n            inputs: {\r\n                max: max$,\r\n            }\r\n        }),\r\n    });\r\n    subscribe({\r\n        sink: tossable.resistanceOrigin$,\r\n        source: axis$._reactiveMap({\r\n            transform: ({ upstream: axis, min, max }) => {\r\n                const linearCenter = min + (max - min) / 2;\r\n                if (axis === Axis.X) {\r\n                    return {\r\n                        x: linearCenter,\r\n                        y: 0,\r\n                    };\r\n                }\r\n                else if (axis === Axis.Y) {\r\n                    return {\r\n                        x: 0,\r\n                        y: linearCenter,\r\n                    };\r\n                }\r\n                else {\r\n                    console.warn(`Cannot apply linear resistance if axis isn't locked`);\r\n                }\r\n            },\r\n            inputs: {\r\n                min: min$,\r\n                max: max$,\r\n            },\r\n        }),\r\n    });\r\n}\r\n//# sourceMappingURL=Tossable.js.map","dts":{"name":"/Users/brentons/Projects/material-motion-js/packages/core/interactions/Tossable.d.ts","text":"/** @license\r\n *  Copyright 2016 - present The Material Motion Authors. All Rights Reserved.\r\n *\r\n *  Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\r\n *  use this file except in compliance with the License. You may obtain a copy\r\n *  of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n *  Unless required by applicable law or agreed to in writing, software\r\n *  distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\r\n *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n *  License for the specific language governing permissions and limitations\r\n *  under the License.\r\n */\r\nimport { Axis, State } from '../enums';\r\nimport { MotionProperty } from '../observables/';\r\nimport { ObservableWithMotionOperators, Point2D, TranslateStyleStreams } from '../types';\r\nimport { Draggable } from './Draggable';\r\nimport { Point2DSpring } from './Point2DSpring';\r\nexport declare type TossableArgs = {\r\n    draggable: Draggable;\r\n    spring: Point2DSpring;\r\n};\r\nexport declare class Tossable {\r\n    readonly state$: MotionProperty<State>;\r\n    readonly state: State;\r\n    /**\r\n     * This is the point from which all other resistance calculations are\r\n     * measured.\r\n     */\r\n    readonly resistanceOrigin$: MotionProperty<Point2D>;\r\n    resistanceOrigin: Point2D;\r\n    /**\r\n     * This is the distance from the origin that an item can be freely dragged\r\n     * without encountering resistance.\r\n     */\r\n    readonly radiusUntilResistance$: MotionProperty<number>;\r\n    radiusUntilResistance: number;\r\n    /**\r\n     * For carousels or swipeable lists, this is the width of one item.\r\n     *\r\n     * To apply resistance, the calculation needs to determine the amount of\r\n     * progress through a drag.  `resistanceBasis` is the denominator in this\r\n     * calculation. For instance, if a drag is 20px beyond `radiusUntilResistance`\r\n     * and `resistanceBasis` is 50, the drag progress used by the resistance\r\n     * calculation is 40%.\r\n     *\r\n     * Note: a drag cannot move farther than `resistanceBasis` beyond\r\n     * `radiusUntilResistance`.\r\n     */\r\n    readonly resistanceBasis$: MotionProperty<number>;\r\n    resistanceBasis: number;\r\n    /**\r\n     * This value determines how far beyond `radiusUntilResistance` a drag is\r\n     * limited to.\r\n     *\r\n     * It works in conjunction with `resistanceBasis`.  If `resistanceBasis` is 50\r\n     * and `resistanceFactor` is 5, the drag is limited to 10px (basis / factor)\r\n     * beyond `radiusUntilResistance`.\r\n     */\r\n    readonly resistanceFactor$: MotionProperty<number>;\r\n    resistanceFactor: number;\r\n    readonly location$: MotionProperty<Point2D>;\r\n    readonly velocity$: ObservableWithMotionOperators<Point2D>;\r\n    readonly draggedLocation$: ObservableWithMotionOperators<Point2D>;\r\n    readonly draggable: Draggable;\r\n    readonly spring: Point2DSpring;\r\n    readonly styleStreams: TranslateStyleStreams;\r\n    constructor({draggable, spring}: TossableArgs);\r\n}\r\nexport default Tossable;\r\nexport declare type ApplyLinearResistanceToTossableArgs = {\r\n    tossable: Tossable;\r\n    min$: ObservableWithMotionOperators<number>;\r\n    max$: ObservableWithMotionOperators<number>;\r\n    axis$: ObservableWithMotionOperators<Axis>;\r\n    basis$: ObservableWithMotionOperators<number>;\r\n    factor$: ObservableWithMotionOperators<number>;\r\n};\r\nexport declare function applyLinearResistanceToTossable({tossable, min$, max$, axis$, basis$, factor$}: ApplyLinearResistanceToTossableArgs): void;\r\n"}}
