WebDemoCanvas test files synched with actual version in WD

This commit is contained in:
pTalanov
2012-06-05 16:46:52 +04:00
parent c5ebfdcea7
commit d11b0a617c
3 changed files with 12 additions and 4 deletions
@@ -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) {