www-thermferm/js/webcam.js

changeset 581
b56988cc516b
equal deleted inserted replaced
580:96207ff84eaa 581:b56988cc516b
1 /*****************************************************************************
2 * Copyright (C) 2019
3 *
4 * Michiel Broek <mbroek at mbse dot eu>
5 *
6 * This file is part of ThermFerm
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2, or (at your option) any
11 * later version.
12 *
13 * ThermFerm is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with ThermFerm; see the file COPYING. If not, write to the Free
20 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *****************************************************************************/
22
23 var phi = 0, flipped = 0, mirrored = 0;
24
25 function setXformClass () {
26 $('.xform').each(function(idx,el) {
27 el.className = "xform x" +(flipped ? "-flipped":"") + (mirrored ? "-mirrored" : "") + "-rotated-" + phi;
28 });
29 }
30
31
32
33 $(document).ready(function () {
34
35 // set rotation angle phi and toggle rotate class
36 $("#rotate").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-rotate-right.png" });
37 $('#rotate').click(function() {
38 phi = (phi + 90) % 360;
39 setXformClass();
40 if (phi % 180) {
41 $('.xform-p').addClass('rotated');
42 } else {
43 $('.xform-p').removeClass('rotated');
44 }
45 });
46 // toggle mirror class component
47 $("#mirror").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-flip-horizontal.png" });
48 $('#mirror').click(function() {
49 mirrored = ! mirrored;
50 setXformClass();
51 });
52 // toggle flip class componen
53 $("#flip").jqxButton({ template: "info", width: 50, height: 50, theme: theme, imgWidth: 32, imgHeight: 32, imgSrc:"images/object-flip-vertical.png" });
54 $('#flip').click(function() {
55 flipped = ! flipped;
56 setXformClass();
57 });
58
59 $("#Close").jqxButton({ template: "success", width: 125, theme: theme });
60 $("#Close").click(function () {
61 window.close();
62 });
63
64 });

mercurial