OSDN Git Service

Fix the horizontal scale of Show Energy window
authorToshi Nagata <alchemist.2005@nifty.com>
Sat, 1 Oct 2022 06:43:36 +0000 (15:43 +0900)
committerToshi Nagata <alchemist.2005@nifty.com>
Sat, 1 Oct 2022 06:43:36 +0000 (15:43 +0900)
Scripts/commands.rb

index 563d4de..ee4c7ab 100755 (executable)
@@ -278,8 +278,14 @@ class Molecule
       max = wave_max.call
       h = max - min
       h = (h == 0.0 ? 1.0 : height / h)
-      w = wave.count
-      w = (w == 0 ? 1.0 : Float(width) / w)
+      c = wave.count
+      if c == 0
+        w = 1.0
+      elsif c == 1
+        w = Float(width)
+      else
+        w = Float(width) / (c - 1)
+      end
       lines = []
       a = []
       #  Skip the points that have exactly 0.0 value