Browse Source

fix viewbox, aggiunti limiti

master
michele 1 year ago
parent
commit
904796f73c
  1. 7
      clock.js

7
clock.js

@ -14,7 +14,7 @@ module.exports = RED => { @@ -14,7 +14,7 @@ module.exports = RED => {
this.on( 'close', ui.addWidget( {
node: this,
format: `
<svg version="1.1" viewBox="0 0 4094 1000" xmlns="http://www.w3.org/2000/svg">
<svg version="1.1" viewBox="586 0 4094 1000" xmlns="http://www.w3.org/2000/svg">
<path style="display: {{ segs[ 2 ][ 0 ] ? 'block' : 'none' }}" d="m 1336.646,8e-5 h 332.31 l 33.735,36.176 -84.078,78.404 h -247.65 l -73.113,-78.404 z" />
<path style="display: {{ segs[ 2 ][ 1 ] ? 'block' : 'none' }}" d="m 1259.171,72.249 75.498,80.961 -16.917,241.93 -74.915,69.86 -38.525,-41.313 22.462,-321.23 z" />
<path style="display: {{ segs[ 2 ][ 2 ] ? 'block' : 'none' }}" d="m 1627.016,389.16 15.725,-224.88 95.964,-89.488 19.36,20.761 -23.784,340.13 -34.168,31.863 z" />
@ -77,6 +77,11 @@ module.exports = RED => { @@ -77,6 +77,11 @@ module.exports = RED => {
beforeEmit: msg => ( { msg } ),
initController: $scope => $scope.$watch( 'msg.payload', payload => {
const total_seconds = +payload || 0;
const maxtime = 999 * 3600 + 59 * 60 + 59;
if (total_seconds < 0) total_seconds = 0;
else if (total_seconds > maxtime) total_seconds = maxtime;
let remaining_seconds = total_seconds;
let hours = Math.floor(remaining_seconds / 3600.0);

Loading…
Cancel
Save