From 41ac41cd9f7e545c3c38b8ed3530522604701626 Mon Sep 17 00:00:00 2001 From: Toshi Nagata Date: Sat, 1 Oct 2022 15:43:36 +0900 Subject: [PATCH] Fix the horizontal scale of Show Energy window --- Scripts/commands.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Scripts/commands.rb b/Scripts/commands.rb index 563d4de..ee4c7ab 100755 --- a/Scripts/commands.rb +++ b/Scripts/commands.rb @@ -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 -- 2.11.0