Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
litan committed Oct 28, 2019
1 parent 61f7dd3 commit 7c40ea2
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
3 changes: 1 addition & 2 deletions src/main/scala/net/kogics/kojo/lite/SettingsWindow.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import javax.swing.JFrame
import javax.swing.JPanel
import javax.swing.JTabbedPane
import javax.swing.JTextField
import javax.swing.event.ChangeEvent

import net.kogics.kojo.util.Utils
import net.kogics.kojo.widget.ColPanel
Expand Down Expand Up @@ -111,7 +110,7 @@ class SettingsWindow(owner: JFrame) extends JDialog(owner) {
def setCurrentAspectRatio(): Unit = {
val cb = Builtins.instance.canvasBounds
val r = cb.width / cb.height
currentAspectTf.setText(f"$r%2.2f")
currentAspectTf.setText(f"$r%2.3f")
}

val adjustCanvasBtn = new JButton(Utils.loadString("S_AdjustCanvas"))
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/net/kogics/kojo/lite/Versions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package net.kogics.kojo.lite
object Versions {
val KojoMajorVersion = "2.7"
val KojoVersion = "2.7.08"
val KojoRevision = "r17"
val KojoRevision = "r18"
val KojoBuildDate = "28 October 2019"
val JavaVersion = {
val jrv = System.getProperty("java.runtime.version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ class SpriteCanvas(val kojoCtx: core.KojoCtx) extends PSwingCanvas with SCanvas
val file = fchooser.chooseFile(Utils.stripDots(Utils.loadString("S_SaveAs")), "PNG Image File", "png")
if (file != null) {
Utils.appProperty("export.image.dpi") match {
case Some(sDpi) if sDpi.length > 0 =>
case Some(sDpi) =>
val dpi = sDpi.toInt
val dim = Utils.appProperty("export.image.dimension").getOrElse("height")
val inches = Utils.appProperty("export.image.inches") match {
Expand All @@ -980,9 +980,6 @@ class SpriteCanvas(val kojoCtx: core.KojoCtx) extends PSwingCanvas with SCanvas
exportImageToFile(file, width, heightForWidth(width))
}

case Some(sDpi) if sDpi.length == 0 =>
exportImageToFile(file, SpriteCanvas.this.getWidth, SpriteCanvas.this.getHeight)

case None =>
exportImageToFile(file, SpriteCanvas.this.getWidth, SpriteCanvas.this.getHeight)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/net/kogics/kojo/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ object Utils {
|
|# Specify canvas image export options
|# export.image.dpi=nn
|# export.image.inches=nn or a4
|# export.image.inches=nn or a4, a3, etc.
|# export.image.dimension=width or height
""".stripMargin

Expand All @@ -827,7 +827,7 @@ object Utils {

def appProperty(key: String) = {
val ret = kojoProps.getProperty(key)
if (ret != null) Some(ret) else None
if (ret != null && ret.length > 0) Some(ret) else None
}

def updateAppProperties(props: Map[String, String]): Unit = {
Expand Down

0 comments on commit 7c40ea2

Please sign in to comment.