Skip to content

Commit

Permalink
Fixed methods"
Browse files Browse the repository at this point in the history
;
  • Loading branch information
VOSID8 committed Aug 22, 2024
1 parent 24bc8c5 commit 37f2618
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
15 changes: 4 additions & 11 deletions canvas/src/main/scala/doodle/canvas/algebra/Immediate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ trait Immediate {
y: Int,
segments: Array[Double] = Array.empty[Double]
): Unit
def beginPath(): Unit
def clearRect(x: Int, y: Int, width: Int, height: Int): Unit
def clip(): Unit
def clipArc(
Expand All @@ -66,7 +65,6 @@ trait Immediate {
counterclockwise: Boolean = false
): Unit
def clipRect(x: Int, y: Int, width: Int, height: Int): Unit
def closePath(): Unit
def circle(
x: Double,
y: Double,
Expand Down Expand Up @@ -185,6 +183,7 @@ class ImmediateImpl(
val x0 = x - rasterWidth / 2
val y0 = y - rasterHeight / 2
ctx.beginPath()
ctx.setLineDash(segments.toJSArray)
ctx.arc(x0, y0, diameter / 2, startAngle, endAngle, counterclockwise)
if closedPath then ctx.closePath();
ctx.stroke()
Expand Down Expand Up @@ -219,10 +218,6 @@ class ImmediateImpl(
ctx.stroke()
}

def beginPath(): Unit = {
ctx.beginPath();
}

def clearRect(x: Int, y: Int, width: Int, height: Int): Unit = {
val x0 = x / 2
val y0 = y / 2
Expand Down Expand Up @@ -253,10 +248,6 @@ class ImmediateImpl(
region.rect(x0, y0, width, height)
}

def closePath(): Unit = {
ctx.closePath()
}

def circle(
x: Double,
y: Double,
Expand Down Expand Up @@ -299,6 +290,7 @@ class ImmediateImpl(
val x0 = x - rasterWidth / 2
val y0 = y - rasterHeight / 2
ctx.beginPath()
ctx.setLineDash(segments.toJSArray)
ctx.ellipse(x0, y0, width / 2, height / 2, 0, 0, 2 * Math.PI)
ctx.fill()
}
Expand All @@ -317,6 +309,7 @@ class ImmediateImpl(
val x0 = x - rasterWidth / 2
val y0 = y - rasterHeight / 2
ctx.beginPath()
ctx.setLineDash(segments.toJSArray)
ctx.ellipse(
x0,
y0,
Expand Down Expand Up @@ -493,8 +486,8 @@ class ImmediateImpl(
val x0 = x - rasterWidth / 2
val y0 = y - rasterHeight / 2
ctx.beginPath()
ctx.setLineDash(segments.toJSArray)
ctx.rect(x0, y0, size, size)
ctx.stroke()
}

def transform(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ import scala.scalajs.js.annotation.*
@JSExportTopLevel("CanvasImmediateMode")
object Experiment {

def roof =
Picture
.triangle(200, 100)
.fillColor(Color.blue)
.strokeColor(Color.black)
.debug

def drawHotel =
(ctx: Immediate) => {

Expand Down

0 comments on commit 37f2618

Please sign in to comment.