Enabling decoration

master
Richard Hopkins 2020-05-11 10:51:44 +01:00
parent d6cb2bba18
commit 898f0c67b9
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
//
// Time Travellers Watch
// Written May 2020 by Richard Hopkins
// based on a skeleton app by Gordon Williams
//
const locale = require('locale'); const locale = require('locale');
const widgetHeight=24; const widgetHeight=24;
let timer = null; let timer = null;
@ -8,6 +13,8 @@ const radius = Math.round(Math.min(g.getWidth()/2,(g.getHeight()-widgetHeight) /
const cirRad = 2*Math.PI; const cirRad = 2*Math.PI;
const proportion = 0.3; // relative size of hour hand const proportion = 0.3; // relative size of hour hand
const thickness = 4; // thickness of decorative lines const thickness = 4; // thickness of decorative lines
const settings = require("Storage").readJSON("app.json", 1);
const decoration = settings['decoration']
const drawSegment = (params) => { const drawSegment = (params) => {
angle1 = params.start/360*cirRad; angle1 = params.start/360*cirRad;
@ -71,7 +78,7 @@ const drawThickLine = (params) => {
const drawHands = () => { const drawHands = () => {
drawMinuteHand(); drawMinuteHand();
drawHourHand(); drawHourHand();
drawDecoration(); if (decoration) {drawDecoration()};
}; };
const drawDecoration = () => { const drawDecoration = () => {

View File

@ -23,7 +23,7 @@
onchange: m => {save('widgets', m)} onchange: m => {save('widgets', m)}
}, },
'Decoration': { 'Decoration': {
value: 0|settings['decoration'], value: 1|settings['decoration'],
min:0,max:1, min:0,max:1,
format: m => onoff[m], format: m => onoff[m],
onchange: m => {save('decoration', m)} onchange: m => {save('decoration', m)}