www/js/webcam-ng.js

Wed, 01 May 2024 14:38:37 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Wed, 01 May 2024 14:38:37 +0200
changeset 715
f5d85af156ab
parent 710
abe60578d695
permissions
-rw-r--r--

Added device_present() function to easy update device present from one-wire and simulator devices. When a simulator temperature sensor present is changed, the device table is changed too. Controlling simulator relays is now for each simulator. The simulator runs under the state machine. If something changed in the running simulator, all data is broadcasted over websocket. Completed the web editor.

/*****************************************************************************
 * Copyright (C) 2019
 *   
 * Michiel Broek <mbroek at mbse dot eu>
 *
 * This file is part of ThermFerm
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2, or (at your option) any
 * later version.
 *
 * ThermFerm is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with ThermFerm; see the file COPYING.  If not, write to the Free
 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
 *****************************************************************************/

var phi = 0, flipped = 0, mirrored = 0;

function setXformClass () {
	$('.xform').each(function(idx,el) {
		el.className = "xform x" +(flipped ? "-flipped":"") + (mirrored ? "-mirrored" : "") + "-rotated-" + phi;
	});
}



$(document).ready(function () {

	// set rotation angle phi and toggle rotate class
	$("#rotate").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-rotate-right.png" });
	$('#rotate').click(function() {
		phi = (phi + 90) % 360;
		setXformClass();
		if (phi % 180) {
			$('.xform-p').addClass('rotated');
		} else {
			$('.xform-p').removeClass('rotated');
		}
	});
	// toggle mirror class component
	$("#mirror").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-flip-horizontal.png" });
	$('#mirror').click(function() {
		mirrored = ! mirrored;
		setXformClass();
	});
	// toggle flip class componen
	$("#flip").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-flip-vertical.png" });
	$('#flip').click(function() {
		flipped = ! flipped;
		setXformClass();
	});

	$("#Close").jqxButton({ template: "success", width: 125, theme: theme });
	$("#Close").click(function () {
		window.close();
	});

});

mercurial