Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lokosologames/unity_pinchablescrollrect
Unity - Pinchable Scroll Rect allow user to zoom in and out on the Scroll Rect with both Touch Input and Mouse Input
https://github.com/lokosologames/unity_pinchablescrollrect
csharp unity unity-input unity-scripts unity-touch unity-ui
Last synced: 4 months ago
JSON representation
Unity - Pinchable Scroll Rect allow user to zoom in and out on the Scroll Rect with both Touch Input and Mouse Input
- Host: GitHub
- URL: https://github.com/lokosologames/unity_pinchablescrollrect
- Owner: LokoSoloGames
- License: mit
- Created: 2022-02-12T11:47:57.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2023-07-15T18:33:30.000Z (over 1 year ago)
- Last Synced: 2024-10-10T10:24:20.457Z (4 months ago)
- Topics: csharp, unity, unity-input, unity-scripts, unity-touch, unity-ui
- Language: C#
- Homepage: https://youtu.be/y7vdNfElQzw
- Size: 505 KB
- Stars: 44
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Pinchable ScrollRect for Unity
Pinchable ScrollRect allows users to zoom in and out on the ScrollRect with both touches pinching input or mouse scroll input.[![openupm](https://img.shields.io/npm/v/com.lokosolo.pinchable-scrollrect?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.lokosolo.pinchable-scrollrect/)
## Features
* Customizable pinching behaviour with inherited Unity ScrollRect behaviour.
* Overridden OnScroll behaviour for mouse scroll to perform zooming behaviour.
* Customized pinching gesture to perform the same zooming behaviour as mouse scroll input for touches.
* Transformed standard Unity Event IPointerUp & IPointerDown interface into IPinch interface for further customization of touch behaviour## Getting Started
* Use it same as the way you use the Unity ScrollRect component.
* Add a UI/ScrollView from the GameObject Menu
* Select the ScrollRect added, click on the context dropdown menu
* Select "Replace as Pinchable"## Important Remarks
* PinchInputDetector component must have a higher execution order than PinchableScrollRect component or any IPinchHandler component in order to consume the original OnDrag pointer event beforehand.
* Without PinchInputDetector, the ScrollRect can still perform zooming with mouse scroll input but not touch input.
* The absolute minimum scale of the Content of the ScrollRect is 1. A customizable lower bound and upper bound of the scale can be set on inspector.
* Any third touches detected after pinching will be ignore, even after both pinching touches are lifted.
* Editor script is needed in order to serialize the extra fields added to the PinchableScrollRect component.## License
This plugin is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.