Skip to content

Commit

Permalink
Merge pull request #335 from anilanar/window-move-to-and-move-by
Browse files Browse the repository at this point in the history
Add moveTo and moveBy to Window
  • Loading branch information
japgolly authored Aug 12, 2021
2 parents b9cf7f2 + 9e0102f commit 45ad801
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 9 deletions.
7 changes: 6 additions & 1 deletion api-reports/2_12.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2876,7 +2876,6 @@ raw/CanvasRenderingContext2D[JC] def isPointInPath(x: Double, y: Double): Boolea
raw/CanvasRenderingContext2D[JC] def isPointInPath(x: Double, y: Double, fillRule: String): Boolean
raw/CanvasRenderingContext2D[JC] def lineTo(x: Double, y: Double): Unit
raw/CanvasRenderingContext2D[JC] def measureText(text: String): TextMetrics
raw/CanvasRenderingContext2D[JC] def moveBy(deltaX: Double, deltaY: Double): Unit
raw/CanvasRenderingContext2D[JC] def moveTo(x: Double, y: Double): Unit
raw/CanvasRenderingContext2D[JC] def putImageData(imagedata: ImageData, dx: Double, dy: Double, dirtyX: Double?, dirtyY: Double?, dirtyWidth: Double?, dirtyHeight: Double?): Unit
raw/CanvasRenderingContext2D[JC] def quadraticCurveTo(cpx: Double, cpy: Double, x: Double, y: Double): Unit
Expand Down Expand Up @@ -24062,6 +24061,8 @@ raw/Window[JC] def innerWidth: Double
raw/Window[JC] def length: Int
raw/Window[JC] def localStorage: Storage
raw/Window[JC] def matchMedia(mediaQuery: String): MediaQueryList
raw/Window[JC] def moveBy(deltaX: Int, deltaY: Int): Unit
raw/Window[JC] def moveTo(x: Int, y: Int): Unit
raw/Window[JC] def navigator: Navigator
raw/Window[JC] def open(url: String?, target: String?, features: String?, replace: Boolean?): Window
raw/Window[JC] def outerHeight: Int
Expand All @@ -24077,11 +24078,15 @@ raw/Window[JC] def prompt(message: String, default: String?): String
raw/Window[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
raw/Window[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
raw/Window[JC] def requestAnimationFrame(callback: js.Function1[Double, _]): Int
raw/Window[JC] def resizeBy(deltaX: Int, deltaY: Int): Unit
raw/Window[JC] def resizeTo(width: Int, height: Int): Unit
raw/Window[JC] def screen: Screen
raw/Window[JC] def screenY: Int
raw/Window[JC] def scroll(x: Int, y: Int): Unit
raw/Window[JC] def scrollBy(x: Int, y: Int): Unit
raw/Window[JC] def scrollTo(x: Int, y: Int): Unit
raw/Window[JC] def scrollX: Double
raw/Window[JC] def scrollY: Double
raw/Window[JC] def self: Window
raw/Window[JC] def sessionStorage: Storage
raw/Window[JC] def setInterval(handler: js.Function0[Any], timeout: Double): Int
Expand Down
7 changes: 6 additions & 1 deletion api-reports/2_13.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2876,7 +2876,6 @@ raw/CanvasRenderingContext2D[JC] def isPointInPath(x: Double, y: Double): Boolea
raw/CanvasRenderingContext2D[JC] def isPointInPath(x: Double, y: Double, fillRule: String): Boolean
raw/CanvasRenderingContext2D[JC] def lineTo(x: Double, y: Double): Unit
raw/CanvasRenderingContext2D[JC] def measureText(text: String): TextMetrics
raw/CanvasRenderingContext2D[JC] def moveBy(deltaX: Double, deltaY: Double): Unit
raw/CanvasRenderingContext2D[JC] def moveTo(x: Double, y: Double): Unit
raw/CanvasRenderingContext2D[JC] def putImageData(imagedata: ImageData, dx: Double, dy: Double, dirtyX: Double?, dirtyY: Double?, dirtyWidth: Double?, dirtyHeight: Double?): Unit
raw/CanvasRenderingContext2D[JC] def quadraticCurveTo(cpx: Double, cpy: Double, x: Double, y: Double): Unit
Expand Down Expand Up @@ -24062,6 +24061,8 @@ raw/Window[JC] def innerWidth: Double
raw/Window[JC] def length: Int
raw/Window[JC] def localStorage: Storage
raw/Window[JC] def matchMedia(mediaQuery: String): MediaQueryList
raw/Window[JC] def moveBy(deltaX: Int, deltaY: Int): Unit
raw/Window[JC] def moveTo(x: Int, y: Int): Unit
raw/Window[JC] def navigator: Navigator
raw/Window[JC] def open(url: String?, target: String?, features: String?, replace: Boolean?): Window
raw/Window[JC] def outerHeight: Int
Expand All @@ -24077,11 +24078,15 @@ raw/Window[JC] def prompt(message: String, default: String?): String
raw/Window[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], options: EventListenerOptions): Unit
raw/Window[JC] def removeEventListener[T <: Event](`type`: String, listener: js.Function1[T, _], useCapture: Boolean?): Unit
raw/Window[JC] def requestAnimationFrame(callback: js.Function1[Double, _]): Int
raw/Window[JC] def resizeBy(deltaX: Int, deltaY: Int): Unit
raw/Window[JC] def resizeTo(width: Int, height: Int): Unit
raw/Window[JC] def screen: Screen
raw/Window[JC] def screenY: Int
raw/Window[JC] def scroll(x: Int, y: Int): Unit
raw/Window[JC] def scrollBy(x: Int, y: Int): Unit
raw/Window[JC] def scrollTo(x: Int, y: Int): Unit
raw/Window[JC] def scrollX: Double
raw/Window[JC] def scrollY: Double
raw/Window[JC] def self: Window
raw/Window[JC] def sessionStorage: Storage
raw/Window[JC] def setInterval(handler: js.Function0[Any], timeout: Double): Int
Expand Down
55 changes: 48 additions & 7 deletions src/main/scala/org/scalajs/dom/raw/lib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2762,6 +2762,54 @@ class Window
* MDN
*/
var lostpointercapture: js.Function1[PointerEvent, _] = js.native

/**
* Moves the window to the specified coordinates.
*
* MDN
*/
def moveTo(x: Int, y: Int): Unit = js.native

/**
* Moves the current window by a specified amount.
*
* MDN
*/
def moveBy(deltaX: Int, deltaY: Int): Unit = js.native

/**
* Dynamically resizes window.
*
* MDN
*/
def resizeTo(width: Int, height: Int): Unit = js.native

/**
* Resizes the current window by a certain amount.
*
* MDN
*/
def resizeBy(deltaX: Int, deltaY: Int): Unit = js.native

/**
* The read-only scrollX property of the Window interface returns the number
* of pixels that the document is currently scrolled horizontally. This value
* is subpixel precise in modern browsers, meaning that it isn't necessarily
* a whole number. You can get the number of pixels the document is scrolled
* vertically from the scrollY property.
*
* MDN
*/
def scrollX: Double = js.native

/**
* The read-only scrollY property of the Window interface returns the number
* of pixels that the document is currently scrolled vertically. This value
* is subpixel precise in modern browsers, meaning that it isn't necessarily
* a whole number. You can get the number of pixels the document is scrolled
* horizontally from the scrollX property.
*/
def scrollY: Double = js.native
}

/**
Expand Down Expand Up @@ -3901,13 +3949,6 @@ class CanvasRenderingContext2D extends js.Object {
*/
def moveTo(x: Double, y: Double): Unit = js.native

/**
* Moves the current window by a specified amount.
*
* MDN
*/
def moveBy(deltaX: Double, deltaY: Double): Unit = js.native

/**
* Returns an ImageData object representing the underlying pixel data for the area of
* the canvas denoted by the rectangle which starts at (sx, sy) and has an sw width and sh
Expand Down

0 comments on commit 45ad801

Please sign in to comment.