{"id":15056170,"url":"https://github.com/tom91136/gesturefx","last_synced_at":"2025-04-10T04:07:02.427Z","repository":{"id":52232305,"uuid":"99486588","full_name":"tom91136/GestureFX","owner":"tom91136","description":"A lightweight pinch-to-zoom pane for JavaFX","archived":false,"fork":false,"pushed_at":"2021-05-04T14:14:00.000Z","size":880,"stargazers_count":66,"open_issues_count":1,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-10T04:06:56.681Z","etag":null,"topics":["image-viewer","imageview","java","java8","javafx","javafx-library","pinch-to-zoom"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tom91136.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-06T12:59:09.000Z","updated_at":"2025-01-21T09:58:24.000Z","dependencies_parsed_at":"2022-09-11T10:04:16.293Z","dependency_job_id":null,"html_url":"https://github.com/tom91136/GestureFX","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom91136%2FGestureFX","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom91136%2FGestureFX/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom91136%2FGestureFX/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tom91136%2FGestureFX/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tom91136","download_url":"https://codeload.github.com/tom91136/GestureFX/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248154984,"owners_count":21056543,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["image-viewer","imageview","java","java8","javafx","javafx-library","pinch-to-zoom"],"created_at":"2024-09-24T21:48:39.568Z","updated_at":"2025-04-10T04:07:02.396Z","avatar_url":"https://github.com/tom91136.png","language":"Java","readme":"GestureFX\n==========\n\n[![Java CI](https://github.com/tom91136/GestureFX/actions/workflows/main.yaml/badge.svg)](https://github.com/tom91136/GestureFX/actions/workflows/main.yaml)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\nA lightweight gesture enabled pane for JavaFX\n \nFeatures\n\n * Accepts any `Node` or implementations of `net.kurobako.gesturefx.GesturePane.Transformable`\n * Pinch-to-zoom\n * Configurable behavior for trackpad events\n * Works with touch screen devices\n * Works in Swing via JFXPanel\n * Zoom/scroll to coordinate with animations\n * Mostly works in SceneBuilder*\n * Zero dependency\n * Works with both Java 8 and OpenJFX 11+\n\nFor comparison, this library is similar to [PhotoView](https://github.com/chrisbanes/PhotoView) \nfor Android but supports gestures on any `Node` subclass.\n\n*SceneBuilder renders the control properly and all the exposed properties are editable in the \nsidebar. Unfortunately, I have no idea how to make SceneBuilder treat this control as a \ncontainer/control so the only way to add `GesturePane` to your FXML is to add it in XML and then \nopen it in SceneBuilder. Pull requests welcome on solving this.\n\n## How to use\n\n**Versions \u003c= 0.6.0 was published on JCenter, versions \u003e= 0.7.1 is now published on Maven Central**\n\nFor Maven users, add the following to pom\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003enet.kurobako\u003c/groupId\u003e\n    \u003cartifactId\u003egesturefx\u003c/artifactId\u003e\n    \u003cversion\u003e0.7.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor SBT\n```scala\n\"net.kurobako\" % \"gesturefx\" % \"0.7.1\"    \n```\n\nAlternatively, you can download the jar [here](https://repo.maven.apache.org/maven2/net/kurobako/gesturefx/0.7.1/gesturefx-0.7.1.jar)\n and add it to your classpath. This library has no dependencies, so you do not need to download \nanything else.\n \nVersion history in available in [CHANGELOG.md](CHANGELOG.md)\n\n## Quick start\n\nAdding an `ImageView` to `GesturePane`:\n\n```java\nNode node = new ImageView(getClass().getResource(\"/lena.png\").toExternalForm());\nGesturePane pane = new GesturePane(node);\n```\n\nTranslate or zoom:\n\n```java\nGesturePane pane = //...\n\n// zoom to 1x \npane.zoomTo(1);\n\n// centre on point [42,42] \npane.centreOn(new Point2D(42, 42));\n\n```\nAnd with animations:\n\n```java\npane.animate(Duration.millis(200)).zoomTo(1);\n// animate with some options\npane.animate(Duration.millis(200))\n\t\t.interpolateWith(Interpolator.EASE_BOTH)\n\t\t.beforeStart(() -\u003e System.out.println(\"Starting...\"))\n\t\t.afterFinished(() -\u003e System.out.println(\"Done!\"))\n\t\t.centreOn(new Point2D(42, 42));\n\n```\nDouble click to zoom in:\n```java\n// zoom*2 on double-click\nGesturePane pane = //...\npane.setOnMouseClicked(e -\u003e {\n\tif (e.getButton() == MouseButton.PRIMARY \u0026\u0026 e.getClickCount() == 2) {\n\t\tPoint2D pivotOnTarget = pane.targetPointAt(new Point2D(e.getX(), e.getY()))\n\t\t\t\t                        .orElse(pane.targetPointAtViewportCentre());\n\t\t// increment of scale makes more sense exponentially instead of linearly \n\t\tpane.animate(Duration.millis(200))\n\t\t\t\t.interpolateWith(Interpolator.EASE_BOTH)\n\t\t\t\t.zoomBy(pane.getCurrentScale(), pivotOnTarget);\n\t}\n});\n```\n\nFor more interesting examples, take a look at the [samples](gesturefx-sample/src/main/java/net/kurobako/gesturefx/sample).\n\n## Samples\n\nSeveral samples have been included demoing interesting uses of the gesture pane.\n\n**JavaFX 8**\n\nYou can download the sample jar [here](https://repo.maven.apache.org/maven2/net/kurobako/gesturefx-sample/0.7.1/gesturefx-sample-0.7.1-jar-with-dependencies.jar) \nor clone the project and run:\n\n    ./mvnw install\n    ./mvnw exec:java -pl gesturefx-sample\n    \n\n**OpenJFX 11+**\n\nMake sure you have at least JDK 11 installed:\n\n    \u003e java -version\n    openjdk version \"11.0.4\" 2019-07-16\n    OpenJDK Runtime Environment 18.9 (build 11.0.4+11)\n    OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11, mixed mode, sharing)\n\n\nRun the sample jar with the following:\n\n    java -Dglass.gtk.uiScale=200% --module-path path/to/javafx-sdk-13/lib --add-modules javafx.controls,javafx.fxml,javafx.web,javafx.swing -jar gesturefx-sample-0.7.1-jar-with-dependencies.jar\n\nSee \u003chttps://openjfx.io/openjfx-docs/#install-javafx\u003e for more details.\n\nThe `-Dglass.gtk.uiScale=200%` flag is optional if OpenJFX does not detect HiDPI monitors automatically. \nOn Windows the flag should be `-Dglass.win.uiScale=N%`.\n\n\n## How to build\n\nTo ensure the project is usable with Java 8 and [OpenJFX](https://openjfx.io/), you must build against Java 8. \n\nPrerequisites:\n\n * JDK 8 with JavaFX\n \nBe aware that some OpenJDK distributions does not include JavaFX or have missing webkit libraries which is required for the sample to build. \n\nClone the project and then in project root:\n\n    # *nix:\n    ./mvnw clean package \n    # Windows:\n    mvnw clean package\n\nIf JDK 8 is not your main JDK, prepend the correct `JAVA_HOME` before any maven command (e.g `JAVA_HOME=/usr/java/jdk1.8.0_161/ mvn clean compile`).\n\nThis project uses maven wrapper so you do not need to install maven\nbeforehand.\n\nFor testing on new platforms, it is recommended to run tests headful. Add the headful flag to test\nwith real window:\n\n    mvnw test -Dheadful\n\n**NOTE: Be aware that running the tests headful will spawn actual windows and take over the mouse \nand keyboard; you will see the test window flicker while different unit tests are invoked.**\n\n## Release process\n\n1. Commit all changes before release\n2. Make sure `${user.home}/.m2/settings.xml` exist, if not copy it from maven home (i.e `cp usr/share/maven/conf/settings.xml ~/.m2/settings.xml` ) and add the following section to `\u003cservers\u003e\u003c/servers\u003e`:\n\n    ```xml\n    \u003cserver\u003e\n      \u003cid\u003eossrh\u003c/id\u003e\n      \u003cusername\u003e${jira-username}\u003c/username\u003e\n      \u003cpassword\u003e${jira-password}\u003c/password\u003e\n    \u003c/server\u003e\n    ```\n    Look up jira-username and jira-password is the username and password for sonatype, also make sure machine has SSH access to GitHub\n3. Run `mvn release:prepare -DdryRun=true -Darguments=-DskipTests`, make sure it succeeds \n4. Run `mvn release:clean` to clean up from the release dry run \n5. Run `mvn release:prepare -Darguments=-DskipTests`, maven will tag and commit the new version. \n6. Inspect the commits after `release:prepare` and do a push, also push the tags via `git push --tags`\n7. Finally, run `mvn clean release:perform -Darguments=-DskipTests` to create docs and sources and upload sonatype\n8. Complete the release process by closing via `cd target/checkout \u0026\u0026 mvn nexus-staging:release` \n\n## Motivation\n\nSomeone has to do it.\n\n## Acknowledgements\n\nFeatures or designs of this library was originally developed as part of an undergraduate coursework \nassignment at the \n[*University of Bristol*](http://www.bristol.ac.uk/engineering/departments/computerscience/). \n\n\n\u003cimg src=\"https://www.yourkit.com/images/yklogo.png\" align=\"right\" /\u003e\n\nYourKit supports the GestureFX project with its full-featured Java Profiler.\nYourKit, LLC is the creator [YourKit Java Profiler](https://www.yourkit.com/java/profiler/index.jsp)\nand [YourKit .NET Profiler](https://www.yourkit.com/.net/profiler/index.jsp),\ninnovative and intelligent tools for profiling Java and .NET applications.\n\n\n## Licence\n\n    Copyright 2021 WeiChen Lin\n    \n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n    \n       http://www.apache.org/licenses/LICENSE-2.0\n    \n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom91136%2Fgesturefx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftom91136%2Fgesturefx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftom91136%2Fgesturefx/lists"}