Skip to content

Commit

Permalink
Tweak batch pics.
Browse files Browse the repository at this point in the history
  • Loading branch information
litan committed Feb 6, 2021
1 parent cc46ad0 commit 4df3ea5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/main/scala/net/kogics/kojo/lite/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package net.kogics.kojo.lite
object Versions {
val KojoMajorVersion = "2.9"
val KojoVersion = "2.9.09"
val KojoRevision = "r2"
val KojoBuildDate = "15 January 2020"
val KojoRevision = "r3"
val KojoBuildDate = "6 February 2021"
val JavaVersion = {
val jrv = System.getProperty("java.runtime.version")
val arch = System.getProperty("os.arch")
Expand Down
17 changes: 10 additions & 7 deletions src/main/scala/net/kogics/kojo/picture/pics.scala
Original file line number Diff line number Diff line change
Expand Up @@ -872,23 +872,26 @@ class BatchPics(pics: List[Picture]) extends BasePicList(pics) {
}
}

var currPic = 0
var currPicIndex = 0
var lastDraw = System.currentTimeMillis

def currentPicture = pics(currPicIndex)

override def showNext(gap: Long) = Utils.runInSwingThread {
val currTime = System.currentTimeMillis
if (currTime - lastDraw > gap) {
pics(currPic).invisible()
currPic += 1
if (currPic == pics.size) {
currPic = 0
pics(currPicIndex).invisible()
currPicIndex += 1
if (currPicIndex == pics.size) {
currPicIndex = 0
}
pics(currPic).visible()
pics(currPicIndex).visible()
lastDraw = currTime
}
}

override def picGeom: Geometry = Utils.runInSwingThreadAndWait {
pgTransform.transform(pics(currPic).picGeom)
pgTransform.transform(pics(currPicIndex).picGeom)
}

def copy = BatchPics(picsCopy).withGap(padding)
Expand Down

0 comments on commit 4df3ea5

Please sign in to comment.