WebDemoCanvas test files synched with actual version in WD
This commit is contained in:
@@ -42,7 +42,7 @@ public final class WebDemoCanvasExamplesTest extends SingleFileTranslationTest {
|
||||
}
|
||||
|
||||
public void testFancyLines() throws Exception {
|
||||
doTest("Fancy lines.kt", "window");
|
||||
doTest("Fancy lines.kt", "$");
|
||||
}
|
||||
|
||||
public void testTrafficLight() throws Exception {
|
||||
|
||||
@@ -8,9 +8,10 @@ package fancylines
|
||||
|
||||
import js.dom.html5.*
|
||||
import js.dom.html.window
|
||||
import js.jquery.*
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
window.onload = {
|
||||
jq {
|
||||
FancyLines().run()
|
||||
}
|
||||
}
|
||||
@@ -63,4 +64,4 @@ class FancyLines() {
|
||||
window.setInterval({line()}, 40);
|
||||
window.setInterval({blank()}, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,9 +28,15 @@ val context: CanvasContext
|
||||
|
||||
val PATH_TO_IMAGES = "http://kotlin-demo.jetbrains.com/static/images/canvas/"
|
||||
|
||||
|
||||
|
||||
var _state: CanvasState? = null
|
||||
val state: CanvasState
|
||||
get() {
|
||||
return CanvasState(canvas)
|
||||
if (_state == null) {
|
||||
_state = CanvasState(canvas)
|
||||
}
|
||||
return _state!!
|
||||
}
|
||||
|
||||
val colors: Colors
|
||||
@@ -430,6 +436,7 @@ class CanvasState(val canvas: HTMLCanvasElement) {
|
||||
}
|
||||
return Vector(e.pageX, e.pageY) - offset
|
||||
}
|
||||
|
||||
fun draw() {
|
||||
clear()
|
||||
for (shape in shapes) {
|
||||
|
||||
Reference in New Issue
Block a user