korge: can click on stuff
parent
0a97b37244
commit
8d4ba39793
|
|
@ -1,6 +1,7 @@
|
|||
import de.itkl.docthor.core.DocumentViewer
|
||||
import de.itkl.textprocessing.Document
|
||||
import korlibs.event.Key
|
||||
import korlibs.image.bitmap.context2d
|
||||
import korlibs.korge.*
|
||||
import korlibs.korge.scene.*
|
||||
import korlibs.korge.view.*
|
||||
|
|
@ -10,6 +11,8 @@ import korlibs.io.file.std.*
|
|||
import korlibs.korge.input.*
|
||||
import korlibs.korge.tween.get
|
||||
import korlibs.korge.tween.tween
|
||||
import korlibs.korge.ui.tooltip
|
||||
import korlibs.logger.AnsiEscape
|
||||
import korlibs.math.geom.*
|
||||
import korlibs.math.geom.shape.toShape2D
|
||||
import korlibs.math.geom.shape.toShape2d
|
||||
|
|
@ -73,15 +76,18 @@ class ViewDocument(private val document: Document) : Scene() {
|
|||
}
|
||||
val imageFile = localCurrentDirVfs["assets/xs-reg/00001.jpg"].readBitmap()
|
||||
image(imageFile)
|
||||
|
||||
document.retrieveOcrPages().first().words.forEach { word ->
|
||||
|
||||
solidRect(
|
||||
width = word.rectangle.width,
|
||||
height = word.rectangle.height,
|
||||
color = Colors.AQUAMARINE.withA(128)
|
||||
) {
|
||||
x = word.rectangle.x
|
||||
y = word.rectangle.y
|
||||
}.onClick {
|
||||
println(word.text)
|
||||
}
|
||||
}
|
||||
|
||||
val shape = VectorPath {
|
||||
moveTo(0, 0)
|
||||
lineTo(100, 0)
|
||||
lineTo(100, 100)
|
||||
close()
|
||||
}.toShape2D()
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue