From 87cd1a7e37859738fcd7ef8c2fe2875e5429ebdf Mon Sep 17 00:00:00 2001 From: LazeMSS Date: Mon, 25 Jan 2021 08:46:46 +0100 Subject: [PATCH] Increased the margin for on target temp: #10 --- octoprint_toptemp/static/css/TopTemp.css | 4 +++ octoprint_toptemp/static/js/TopTemp.js | 44 ++++++++++++++---------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/octoprint_toptemp/static/css/TopTemp.css b/octoprint_toptemp/static/css/TopTemp.css index fefbbc8..cfa95a1 100644 --- a/octoprint_toptemp/static/css/TopTemp.css +++ b/octoprint_toptemp/static/css/TopTemp.css @@ -34,6 +34,10 @@ margin-top: 5px; } +#navbar_plugin_toptemp .leftPad{ + padding-left: 3px; +} + .UICHeaderIcons #navbar_plugin_toptemp{ margin-top: -6px; } diff --git a/octoprint_toptemp/static/js/TopTemp.js b/octoprint_toptemp/static/js/TopTemp.js index e9bbefd..93d018f 100644 --- a/octoprint_toptemp/static/js/TopTemp.js +++ b/octoprint_toptemp/static/js/TopTemp.js @@ -126,27 +126,35 @@ $(function() { // Append actual data outputstr += self.formatTempLabel(name,data.actual,iSettings); - // Append target if different - if (!customType){ - if (typeof data.target != undefined && data.target != data.actual && data.target > 0){ - // Show arrow - if (iSettings.showTargetArrow()){ - if (data.target > data.actual){ - outputstr += ''; - }else if (data.target < data.actual){ - outputstr += ''; - } + // Append target if not custom type, we have a target and told to show it + if (!customType && typeof data.target != undefined && data.target > 0){ + var offsetL = data.target - 0.5; + var offsetU = data.target + 0.5; + var ontarget = false; + + // show arrows between temps + if (iSettings.showTargetArrow()){ + // Inside target margin + if (data.actual >= offsetL && data.actual <= offsetU){ + ontarget = true; + }else if (data.actual < offsetL){ + outputstr += ''; + }else if (data.actual > offsetU){ + outputstr += ''; } - // Show target temp - if (iSettings.showTargetTemp()){ - if (!iSettings.showTargetArrow()){ - outputstr += "/"; - } - outputstr += self.formatTempLabel(name,data.target,iSettings); + } + + // Show checkered if on target + if (ontarget){ + outputstr += ''; + }else if (iSettings.showTargetTemp()){ + // No arrow to seperate then we use text + if (!iSettings.showTargetArrow()){ + outputstr += "/"; } - }else if(typeof data.target != undefined && data.target == data.actual && iSettings.showTargetArrow()){ - outputstr += ''; + outputstr += self.formatTempLabel(name,data.target,iSettings); } + } // Should we add an icon