From 713e696ef6468d86bb713d591e777b30d9d9d4e6 Mon Sep 17 00:00:00 2001 From: David Walsh Date: Wed, 27 Mar 2019 19:01:55 -0400 Subject: [PATCH] Cleanup --- backend/js/update_guis.js | 57 ---------------------------------- data_display/js/update_guis.js | 44 -------------------------- 2 files changed, 101 deletions(-) diff --git a/backend/js/update_guis.js b/backend/js/update_guis.js index 747b502..08e6599 100644 --- a/backend/js/update_guis.js +++ b/backend/js/update_guis.js @@ -1,62 +1,5 @@ -$("#myImage").click ( function (evt) { - - var jThis = $(this); - var offsetFromParent = jThis.position (); - var topThickness = (jThis.outerHeight(true) - jThis.height() ) / 2; - var leftThickness = (jThis.outerWidth (true) - jThis.width () ) / 2; - - //--- (x,y) coordinates of the mouse click relative to the image. - var x = evt.pageX - offsetFromParent.left - leftThickness; - var y = evt.pageY - offsetFromParent.top - topThickness; - - ReportDims (); - $('#rez').append ('

User clicked at: ' + x + ', ' + y + ' (x,y).

') -} ); - - -function ReportDims () { - w = $("#myImage").width (); - h = $("#myImage").height (); - $('#rez').text ('The image is ' + w + ' by ' + h + ' (w by h).'); -} - -ReportDims (); - -function updateVoltage(voltage) -{ - - var voltage_min = 9.5; - var voltage_max = 12.5; - var voltage_range = voltage_max - voltage_min; - - var voltage_percentage = (voltage - voltage_min) / voltage_range * 100; - - var voltage_string = ""; - voltage_string = voltage_string.concat(voltage_percentage); - voltage_string = voltage_string.substring(0,4); - voltage_string = voltage_string.concat('%'); - - document.getElementById("VoltageDisplay").style.width = voltage_string; - document.getElementById("VoltageDisplay").innerHTML = voltage_string; - - if (voltage_percentage < 50 && voltage_percentage > 25 ) { - document.getElementById("VoltageDisplay").className = "progress-bar progress-bar-warning" - } - else if ( voltage_percentage <= 25) - { - document.getElementById("VoltageDisplay").className = "progress-bar progress-bar-danger" - var sound = document.getElementById("audio"); - sound.play() - console.log("Pay Sound") - } - else - { - document.getElementById("VoltageDisplay").className = "progress-bar progress-bar-success" - } -}; - function updateTopicsGUI() { diff --git a/data_display/js/update_guis.js b/data_display/js/update_guis.js index 9de9459..e69de29 100644 --- a/data_display/js/update_guis.js +++ b/data_display/js/update_guis.js @@ -1,44 +0,0 @@ -function sendRosMessageExample() -{ - publishStringExample(String(document.getElementById("sendRosMessageExample").value)) -} - -function update_sendRosMessageExample(msg) -{ - document.getElementById("recievedMessageDiv").innerHTML = msg -} - -function update_ProgressBar(value) -{ - -// This would be a great way of getting a float or int from a rosTopic and displaying it. -// I would suggest storing the data as a data field in the ros_scripts then updating it every 500 or 1000 ms rather than updating the gui every time you recieve a message - var num_string = ""; - num_string = num_string.concat(value); - num_string = num_string.substring(0,4); - num_string = num_string.concat("%"); - - doc = document.getElementById("progressBar1"); - - doc.style.width = num_string; - doc.innerHTML = num_string; - - if (value < 50 && value > 25 ) { - doc.className = "progress-bar progress-bar-warning"; - } - else if ( value <= 25) - { - doc.className = "progress-bar progress-bar-danger"; - } - else - { - doc.className = "progress-bar progress-bar-success"; - } -} - - -window.setInterval(function(){ - - update_ProgressBar(Math.random() * 100); - -}, 1000);