Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

750 lines
22 KiB

  1. package wow.doge.mygame.utils
  2. /*
  3. * Copyright (c) 2011-2019, ScalaFX Project
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted provided that the following conditions are met:
  8. * * Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * * Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * * Neither the name of the ScalaFX Project nor the
  14. * names of its contributors may be used to endorse or promote products
  15. * derived from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  18. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  19. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  20. * DISCLAIMED. IN NO EVENT SHALL THE SCALAFX PROJECT OR ITS CONTRIBUTORS BE LIABLE
  21. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  23. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  24. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  25. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  26. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  27. */
  28. import javafx.scene.{input => jfxsi, layout => jfxsl, paint => jfxsp}
  29. import javafx.{
  30. collections => jfxc,
  31. event => jfxe,
  32. geometry => jfxg,
  33. scene => jfxs,
  34. util => jfxu
  35. }
  36. import scalafx.Includes._
  37. import scalafx.beans.property.{
  38. ObjectProperty,
  39. ReadOnlyDoubleProperty,
  40. ReadOnlyObjectProperty
  41. }
  42. import scalafx.collections._
  43. import scalafx.delegate.SFXDelegate
  44. import scalafx.geometry.NodeOrientation
  45. import scalafx.scene.image.WritableImage
  46. import scalafx.scene.input.{Dragboard, Mnemonic, TransferMode}
  47. import scalafx.scene.paint.Paint
  48. import com.goxr3plus.fxborderlessscene.borderless.{BorderlessScene => BScene}
  49. import scala.language.implicitConversions
  50. import scalafx.scene.Cursor
  51. import scalafx.scene._
  52. import scalafx.stage.Stage
  53. import scalafx.stage.StageStyle
  54. object BorderlessScene {
  55. implicit def sfxScene2jfx(v: BorderlessScene): Scene =
  56. if (v != null) v.delegate else null
  57. }
  58. /**
  59. * Wraps [[http://docs.oracle.com/javase/8/javafx/api/javafx/scene/Scene.html]].
  60. *
  61. * @constructor Create a new ScalaFX Scene with JavaFX Scene as delegate.
  62. * @param delegate JavaFX Scene delegated. Its default value is a JavaFX Scene with a
  63. * [[http://docs.oracle.com/javase/8/javafx/api/javafx/scene/Group.html Group]] as root Node.
  64. */
  65. class BorderlessScene(
  66. override val delegate: BScene
  67. ) extends SFXDelegate[BScene] {
  68. def this(stage: Stage, stageStyle: StageStyle, parent: Parent) =
  69. this(new BScene(stage, stageStyle, parent))
  70. /**
  71. * Returns the root Node of the scene graph
  72. */
  73. def root: ObjectProperty[jfxs.Parent] = delegate.rootProperty
  74. /**
  75. * Sets the root Node of the scene graph
  76. */
  77. def root_=(v: Parent): Unit = {
  78. root() = v
  79. }
  80. /**
  81. * Returns Nodes children from this Scene's `root`.
  82. */
  83. def getChildren =
  84. root.value match {
  85. case group: jfxs.Group => group.getChildren
  86. case pane: jfxsl.Pane => pane.getChildren
  87. case _ =>
  88. throw new IllegalStateException(
  89. "Cannot access children of root: " + root + "\n" +
  90. "Use a class that extends Group or Pane, or override the getChildren method."
  91. )
  92. }
  93. /**
  94. * Returns scene's antialiasing setting.
  95. */
  96. def antialiasing: SceneAntialiasing = delegate.getAntiAliasing
  97. /**
  98. * Returns Content's Node children from this Scene's `root`.
  99. */
  100. def content: jfxc.ObservableList[jfxs.Node] = getChildren
  101. /**
  102. * Sets the list of Nodes children from this Scene's `root`, replacing the prior content. If you want append to
  103. * current content, use `add` or similar.
  104. *
  105. * @param c list of Nodes children from this Scene's `root` to replace prior content.
  106. */
  107. def content_=(c: Iterable[Node]): Unit = {
  108. fillSFXCollection(this.content, c)
  109. }
  110. /**
  111. * Sets a Node child, replacing the prior content. If you want append to current content, use `add` or similar.
  112. *
  113. * @param n Node child to replace prior content.
  114. */
  115. def content_=(n: Node): Unit = {
  116. fillSFXCollectionWithOne(this.content, n)
  117. }
  118. /**
  119. * Specifies the type of camera use for rendering this `Scene`.
  120. */
  121. def camera: ObjectProperty[jfxs.Camera] = delegate.cameraProperty
  122. def camera_=(v: Camera): Unit = {
  123. camera() = v
  124. }
  125. /**
  126. * Defines the mouse cursor for this `Scene`.
  127. */
  128. def cursor: ObjectProperty[jfxs.Cursor] = delegate.cursorProperty
  129. def cursor_=(v: Cursor): Unit = {
  130. cursor() = v
  131. }
  132. /** The effective node orientation of a scene resolves the inheritance of node orientation, returning either left-to-right or right-to-left. */
  133. def effectiveNodeOrientation: ReadOnlyObjectProperty[jfxg.NodeOrientation] =
  134. delegate.effectiveNodeOrientationProperty
  135. /**
  136. * Specifies the event dispatcher for this scene.
  137. */
  138. def eventDispatcher: ObjectProperty[jfxe.EventDispatcher] =
  139. delegate.eventDispatcherProperty
  140. def eventDispatcher_=(v: jfxe.EventDispatcher): Unit = {
  141. eventDispatcher() = v
  142. }
  143. /**
  144. * Defines the background fill of this Scene.
  145. */
  146. def fill: ObjectProperty[jfxsp.Paint] = delegate.fillProperty
  147. def fill_=(v: Paint): Unit = {
  148. fill() = v
  149. }
  150. /**
  151. * The height of this Scene
  152. */
  153. def height: ReadOnlyDoubleProperty = delegate.heightProperty
  154. /**
  155. * The width of this Scene
  156. */
  157. def width: ReadOnlyDoubleProperty = delegate.widthProperty
  158. def nodeOrientation: ObjectProperty[jfxg.NodeOrientation] =
  159. delegate.nodeOrientationProperty
  160. def nodeOrientation_=(v: NodeOrientation): Unit = {
  161. ObjectProperty.fillProperty[jfxg.NodeOrientation](this.nodeOrientation, v)
  162. }
  163. /**
  164. * Defines a function to be called when a mouse button has been clicked (pressed and released) on this `Scene`.
  165. */
  166. def onContextMenuRequested = delegate.onContextMenuRequestedProperty
  167. def onContextMenuRequested_=(
  168. v: jfxe.EventHandler[_ >: jfxsi.ContextMenuEvent]
  169. ): Unit = {
  170. onContextMenuRequested() = v
  171. }
  172. /**
  173. * Defines a function to be called when drag gesture has been detected.
  174. */
  175. def onDragDetected = delegate.onDragDetectedProperty
  176. def onDragDetected_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  177. onDragDetected() = v
  178. }
  179. /**
  180. * Defines a function to be called when this `Scene` is a drag and drop gesture source after its data has been
  181. * dropped on a drop target.
  182. */
  183. def onDragDone = delegate.onDragDoneProperty
  184. def onDragDone_=(v: jfxe.EventHandler[_ >: jfxsi.DragEvent]): Unit = {
  185. onDragDone() = v
  186. }
  187. /**
  188. * Defines a function to be called when the mouse button is released on this `Scene` during drag and drop gesture.
  189. */
  190. def onDragDropped = delegate.onDragDroppedProperty
  191. def onDragDropped_=(v: jfxe.EventHandler[_ >: jfxsi.DragEvent]): Unit = {
  192. onDragDropped() = v
  193. }
  194. /**
  195. * Defines a function to be called when drag gesture enters this Scene.
  196. */
  197. def onDragEntered = delegate.onDragEnteredProperty
  198. def onDragEntered_=(v: jfxe.EventHandler[_ >: jfxsi.DragEvent]): Unit = {
  199. onDragEntered() = v
  200. }
  201. /**
  202. * Defines a function to be called when drag gesture exits this Scene.
  203. */
  204. def onDragExited = delegate.onDragExitedProperty
  205. def onDragExited_=(v: jfxe.EventHandler[_ >: jfxsi.DragEvent]): Unit = {
  206. onDragExited() = v
  207. }
  208. /**
  209. * Defines a function to be called when drag gesture progresses within this `Scene`.
  210. */
  211. def onDragOver = delegate.onDragOverProperty
  212. def onDragOver_=(v: jfxe.EventHandler[_ >: jfxsi.DragEvent]): Unit = {
  213. onDragOver() = v
  214. }
  215. /**
  216. * Defines a function to be called when this `Node` has input focus and the input method text has changed.
  217. */
  218. def onInputMethodTextChanged = delegate.onInputMethodTextChangedProperty
  219. def onInputMethodTextChanged_=(
  220. v: jfxe.EventHandler[_ >: jfxsi.InputMethodEvent]
  221. ): Unit = {
  222. onInputMethodTextChanged() = v
  223. }
  224. /**
  225. * Defines a function to be called when some `Node` of this `Scene` has input focus and a key has been pressed.
  226. */
  227. def onKeyPressed = delegate.onKeyPressedProperty
  228. def onKeyPressed_=(v: jfxe.EventHandler[_ >: jfxsi.KeyEvent]): Unit = {
  229. onKeyPressed() = v
  230. }
  231. /**
  232. * Defines a function to be called when some `Node` of this `Scene` has input focus and a key has been released.
  233. */
  234. def onKeyReleased = delegate.onKeyReleasedProperty
  235. def onKeyReleased_=(v: jfxe.EventHandler[_ >: jfxsi.KeyEvent]): Unit = {
  236. onKeyReleased() = v
  237. }
  238. /**
  239. * Defines a function to be called when some `Node` of this `Scene` has input focus and a key has been typed.
  240. */
  241. def onKeyTyped = delegate.onKeyTypedProperty
  242. def onKeyTyped_=(v: jfxe.EventHandler[_ >: jfxsi.KeyEvent]): Unit = {
  243. onKeyTyped() = v
  244. }
  245. /**
  246. * Defines a function to be called when a mouse button has been clicked (pressed and released) on this `Scene`.
  247. */
  248. def onMouseClicked = delegate.onMouseClickedProperty
  249. def onMouseClicked_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  250. onMouseClicked() = v
  251. }
  252. /**
  253. * Defines a function to be called when a mouse button is pressed on this `Scene` and then dragged.
  254. */
  255. def onMouseDragged = delegate.onMouseDraggedProperty
  256. def onMouseDragged_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  257. onMouseDragged() = v
  258. }
  259. /**
  260. * Defines a function to be called when a full press-drag-release gesture enters this `Scene`.
  261. */
  262. def onMouseDragEntered = delegate.onMouseDragEnteredProperty
  263. def onMouseDragEntered_=(
  264. v: jfxe.EventHandler[_ >: jfxsi.MouseDragEvent]
  265. ): Unit = {
  266. onMouseDragEntered() = v
  267. }
  268. /**
  269. * Defines a function to be called when a full press-drag-release gesture exits this `Scene`.
  270. */
  271. def onMouseDragExited = delegate.onMouseDragExitedProperty
  272. def onMouseDragExited_=(
  273. v: jfxe.EventHandler[_ >: jfxsi.MouseDragEvent]
  274. ): Unit = {
  275. onMouseDragExited() = v
  276. }
  277. /**
  278. * Defines a function to be called when a full press-drag-release gesture progresses within this `Scene`.
  279. */
  280. def onMouseDragOver = delegate.onMouseDragOverProperty
  281. def onMouseDragOver_=(
  282. v: jfxe.EventHandler[_ >: jfxsi.MouseDragEvent]
  283. ): Unit = {
  284. onMouseDragOver() = v
  285. }
  286. /**
  287. * Defines a function to be called when a full press-drag-release gesture ends within this `Scene`.
  288. */
  289. def onMouseDragReleased = delegate.onMouseDragReleasedProperty
  290. def onMouseDragReleased_=(
  291. v: jfxe.EventHandler[_ >: jfxsi.MouseDragEvent]
  292. ): Unit = {
  293. onMouseDragReleased() = v
  294. }
  295. /**
  296. * Defines a function to be called when the mouse enters this `Scene`.
  297. */
  298. def onMouseEntered = delegate.onMouseEnteredProperty
  299. def onMouseEntered_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  300. onMouseEntered() = v
  301. }
  302. /**
  303. * Defines a function to be called when the mouse exits this `Scene`.
  304. */
  305. def onMouseExited = delegate.onMouseExitedProperty
  306. def onMouseExited_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  307. onMouseExited() = v
  308. }
  309. /**
  310. * Defines a function to be called when mouse cursor moves within this `Scene` but no buttons have been pushed.
  311. */
  312. def onMouseMoved = delegate.onMouseMovedProperty
  313. def onMouseMoved_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  314. onMouseMoved() = v
  315. }
  316. /**
  317. * Defines a function to be called when a mouse button has been pressed on this `Scene`.
  318. */
  319. def onMousePressed = delegate.onMousePressedProperty
  320. def onMousePressed_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  321. onMousePressed() = v
  322. }
  323. /**
  324. * Defines a function to be called when a mouse button has been released on this `Scene`.
  325. */
  326. def onMouseReleased = delegate.onMouseReleasedProperty
  327. def onMouseReleased_=(v: jfxe.EventHandler[_ >: jfxsi.MouseEvent]): Unit = {
  328. onMouseReleased() = v
  329. }
  330. /**
  331. * Defines a function to be called when user performs a scrolling action.
  332. */
  333. def onScroll = delegate.onScrollProperty
  334. def onScroll_=(v: jfxe.EventHandler[_ >: jfxsi.ScrollEvent]): Unit = {
  335. onScroll() = v
  336. }
  337. /**
  338. * The URL of the user-agent stylesheet that will be used by this Scene in place of the the platform-default
  339. * user-agent stylesheet. If the URL does not resolve to a valid location, the platform-default user-agent
  340. * stylesheet will be used.
  341. *
  342. * For additional information about using CSS with the scene graph, see the
  343. * [[http://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html CSS Reference Guide]].
  344. *
  345. * @return The URL of the user-agent stylesheet that will be used by this SubScene, or null if has not been set.
  346. */
  347. def userAgentStylesheet: ObjectProperty[String] =
  348. delegate.userAgentStylesheetProperty
  349. /**
  350. * Set the URL of the user-agent stylesheet that will be used by this Scene in place of the the platform-default
  351. * user-agent stylesheet. If the URL does not resolve to a valid location, the platform-default user-agent
  352. * stylesheet will be used.
  353. *
  354. * For additional information about using CSS with the scene graph, see the
  355. * [[http://docs.oracle.com/javase/8/javafx/api/javafx/scene/doc-files/cssref.html CSS Reference Guide]].
  356. *
  357. * @param url The URL is a hierarchical URI of the form `[scheme:][//authority][path]`.
  358. * If the URL does not have a `[scheme:]` component, the URL is considered to be the `[path]`
  359. * component only. Any leading '/' character of the `[path]` is ignored and the `[path]` is
  360. * treated as a path relative to the root of the application's classpath.
  361. */
  362. def userAgentStylesheet_=(url: String): Unit = {
  363. ObjectProperty.fillProperty[String](userAgentStylesheet, url)
  364. }
  365. /**
  366. * The `Window` for this Scene
  367. */
  368. def window: ReadOnlyObjectProperty[javafx.stage.Window] =
  369. delegate.windowProperty
  370. /**
  371. * The horizontal location of this `Scene` on the `Window`.
  372. */
  373. def x: ReadOnlyDoubleProperty = delegate.xProperty
  374. /**
  375. * The vertical location of this `Scene` on the `Window`.
  376. */
  377. def y: ReadOnlyDoubleProperty = delegate.yProperty
  378. /**
  379. * Retrieves the depth buffer attribute for this scene.
  380. */
  381. def depthBuffer = delegate.isDepthBuffer
  382. /**
  383. * Gets an observable list of string URLs linking to the stylesheets to use with this Parent's contents.
  384. */
  385. def stylesheets: jfxc.ObservableList[String] = delegate.getStylesheets
  386. /**
  387. * Sets the list of stylesheets URLs, replacing the prior content. If you want append to current content, use `add` or
  388. * similar.
  389. *
  390. * @param c list of stylesheets URLs to replace prior content.
  391. */
  392. def stylesheets_=(c: Iterable[String]): Unit = {
  393. fillCollection(stylesheets, c)
  394. }
  395. /**
  396. * Looks for any node within the scene graph based on the specified CSS selector.
  397. *
  398. * @param selector The css selector to look up
  399. * @return A [[scala.Some]] containing the Node in the scene which matches the CSS selector, or [[scala.None]]
  400. * if none is found.
  401. */
  402. def lookup(selector: String): Option[Node] = Option(delegate.lookup(selector))
  403. /**
  404. * Registers the specified mnemonic.
  405. *
  406. * @param m The Mnemonic
  407. */
  408. def addMnemonic(m: Mnemonic): Unit = {
  409. delegate.addMnemonic(m)
  410. }
  411. /**
  412. * Unregisters the specified mnemonic.
  413. *
  414. * @param m The Mnemonic to be removed.
  415. */
  416. def removeMnemonic(m: Mnemonic): Unit = {
  417. delegate.removeMnemonic(m)
  418. }
  419. /**
  420. * Gets the list of mnemonics for this `Scene`.
  421. */
  422. def getMnemonics
  423. : jfxc.ObservableMap[jfxsi.KeyCombination, jfxc.ObservableList[
  424. jfxsi.Mnemonic
  425. ]] = delegate.getMnemonics
  426. /**
  427. * Gets the list of accelerators for this Scene.
  428. */
  429. def accelerators: jfxc.ObservableMap[jfxsi.KeyCombination, Runnable] =
  430. delegate.getAccelerators
  431. /**
  432. * Confirms a potential drag and drop gesture that is recognized over this `Scene`.
  433. *
  434. * @param transferModes The supported `TransferMode`(s) of this `Node`
  435. * @return A `Dragboard` to place this `Scene`'s data on
  436. */
  437. def startDragAndDrop(transferModes: TransferMode*): Dragboard =
  438. delegate.startDragAndDrop(transferModes.map(_.delegate): _*)
  439. /**
  440. * Starts a full press-drag-release gesture with this scene as gesture source.
  441. */
  442. def startFullDrag(): Unit = {
  443. delegate.startFullDrag()
  444. }
  445. /**
  446. * The scene's current focus owner node. This node's "focused" variable might be false if this scene has no window,
  447. * or if the window is inactive (window.focused == false).
  448. *
  449. * @since 2.2
  450. */
  451. def focusOwner: ReadOnlyObjectProperty[jfxs.Node] =
  452. delegate.focusOwnerProperty()
  453. /**
  454. * Defines a function to be called when user performs a rotation action.
  455. *
  456. * @since 2.2
  457. */
  458. def onRotate = delegate.onRotateProperty
  459. def onRotate_=(v: jfxe.EventHandler[_ >: jfxsi.RotateEvent]): Unit = {
  460. onRotate() = v
  461. }
  462. /**
  463. * Defines a function to be called when a rotation gesture ends.
  464. *
  465. * @since 2.2
  466. */
  467. def onRotationFinished = delegate.onRotationFinishedProperty()
  468. def onRotationFinished_=(
  469. v: jfxe.EventHandler[_ >: jfxsi.RotateEvent]
  470. ): Unit = {
  471. onRotationFinished() = v
  472. }
  473. /**
  474. * Defines a function to be called when a rotation gesture starts.
  475. *
  476. * @since 2.2
  477. */
  478. def onRotationStarted = delegate.onRotationFinishedProperty()
  479. def onRotationStarted_=(
  480. v: jfxe.EventHandler[_ >: jfxsi.RotateEvent]
  481. ): Unit = {
  482. onRotationStarted() = v
  483. }
  484. /**
  485. * Defines a function to be called when a Scroll gesture ends.
  486. *
  487. * @since 2.2
  488. */
  489. def onScrollFinished = delegate.onScrollFinishedProperty()
  490. def onScrollFinished_=(v: jfxe.EventHandler[_ >: jfxsi.ScrollEvent]): Unit = {
  491. onScrollFinished() = v
  492. }
  493. /**
  494. * Defines a function to be called when a Scroll gesture starts.
  495. *
  496. * @since 2.2
  497. */
  498. def onScrollStarted = delegate.onScrollStartedProperty()
  499. def onScrollStarted_=(v: jfxe.EventHandler[_ >: jfxsi.ScrollEvent]): Unit = {
  500. onScrollStarted() = v
  501. }
  502. /**
  503. * Defines a function to be called when a Swipe Down gesture starts.
  504. *
  505. * @since 2.2
  506. */
  507. def onSwipeDown = delegate.onSwipeDownProperty()
  508. def onSwipeDown_=(v: jfxe.EventHandler[_ >: jfxsi.SwipeEvent]): Unit = {
  509. onSwipeDown() = v
  510. }
  511. /**
  512. * Defines a function to be called when a Swipe Down gesture starts.
  513. *
  514. * @since 2.2
  515. */
  516. def onSwipeLeft = delegate.onSwipeLeftProperty()
  517. def onSwipeLeft_=(v: jfxe.EventHandler[_ >: jfxsi.SwipeEvent]): Unit = {
  518. onSwipeLeft() = v
  519. }
  520. /**
  521. * Defines a function to be called when a Swipe Up gesture starts.
  522. *
  523. * @since 2.2
  524. */
  525. def onSwipeUp = delegate.onSwipeUpProperty()
  526. def onSwipeUp_=(v: jfxe.EventHandler[_ >: jfxsi.SwipeEvent]): Unit = {
  527. onSwipeUp() = v
  528. }
  529. /**
  530. * Defines a function to be called when a Swipe Right gesture starts.
  531. *
  532. * @since 2.2
  533. */
  534. def onSwipeRight = delegate.onSwipeRightProperty()
  535. def onSwipeRight_=(v: jfxe.EventHandler[_ >: jfxsi.SwipeEvent]): Unit = {
  536. onSwipeRight() = v
  537. }
  538. /**
  539. * Defines a function to be called when user performs a Touch action.
  540. *
  541. * @since 2.2
  542. */
  543. def onZoom = delegate.onZoomProperty()
  544. def onZoom_=(v: jfxe.EventHandler[_ >: jfxsi.ZoomEvent]): Unit = {
  545. onZoom() = v
  546. }
  547. /**
  548. * Defines a function to be called when a Zoom gesture ends.
  549. *
  550. * @since 2.2
  551. */
  552. def onZoomFinished = delegate.onZoomFinishedProperty()
  553. def onZoomFinished_=(v: jfxe.EventHandler[_ >: jfxsi.ZoomEvent]): Unit = {
  554. onZoomFinished() = v
  555. }
  556. /**
  557. * Defines a function to be called when a Zoom gesture starts.
  558. *
  559. * @since 2.2
  560. */
  561. def onZoomStarted = delegate.onZoomStartedProperty()
  562. def onZoomStarted_=(v: jfxe.EventHandler[_ >: jfxsi.ZoomEvent]): Unit = {
  563. onZoomStarted() = v
  564. }
  565. /**
  566. * Defines a function to be called when user performs a Touch Moved action.
  567. *
  568. * @since 2.2
  569. */
  570. def onTouchMoved = delegate.onTouchMovedProperty()
  571. def onTouchMoved_=(v: jfxe.EventHandler[_ >: jfxsi.TouchEvent]): Unit = {
  572. onTouchMoved() = v
  573. }
  574. /**
  575. * Defines a function to be called when user performs a Touch Pressed action.
  576. *
  577. * @since 2.2
  578. */
  579. def onTouchPressed = delegate.onTouchPressedProperty()
  580. def onTouchPressed_=(v: jfxe.EventHandler[_ >: jfxsi.TouchEvent]): Unit = {
  581. onTouchPressed() = v
  582. }
  583. /**
  584. * Defines a function to be called when user performs a Touch Released action.
  585. *
  586. * @since 2.2
  587. */
  588. def onTouchReleased = delegate.onTouchReleasedProperty()
  589. def onTouchReleased_=(v: jfxe.EventHandler[_ >: jfxsi.TouchEvent]): Unit = {
  590. onTouchReleased() = v
  591. }
  592. /**
  593. * Defines a function to be called when user performs a Touch Stationary action.
  594. *
  595. * @since 2.2
  596. */
  597. def onTouchStationary = delegate.onTouchStationaryProperty()
  598. def onTouchStationary_=(v: jfxe.EventHandler[_ >: jfxsi.TouchEvent]): Unit = {
  599. onTouchStationary() = v
  600. }
  601. /**
  602. * Takes a snapshot of this scene and returns the rendered image when it is ready.
  603. *
  604. * @param image The writable image that will be used to hold the rendered scene.
  605. * @return the rendered image
  606. *
  607. * @since 2.2
  608. */
  609. def snapshot(image: WritableImage): WritableImage = delegate.snapshot(image)
  610. /**
  611. * Takes a snapshot of this scene at the next frame and calls the specified callback method when the image is ready.
  612. *
  613. * @param callback A function to be called when the image is ready.
  614. * @param image The writable image that will be used to hold the rendered scene.
  615. *
  616. * @since 2.2
  617. */
  618. def snapshot(callback: SnapshotResult => Unit, image: WritableImage): Unit = {
  619. val javaCallback = new jfxu.Callback[jfxs.SnapshotResult, java.lang.Void] {
  620. def call(result: jfxs.SnapshotResult): java.lang.Void = {
  621. callback(new SnapshotResult(result))
  622. null
  623. }
  624. }
  625. delegate.snapshot(javaCallback, image)
  626. }
  627. }