diff --git a/apps/mtimer/mtimer.app.js b/apps/mtimer/mtimer.app.js index c55a24e98..f2a83dbc6 100644 --- a/apps/mtimer/mtimer.app.js +++ b/apps/mtimer/mtimer.app.js @@ -5,13 +5,14 @@ const resetImg = require("heatshrink").decompress(atob("kkkwIJGgwCBhkP/4EB4f//gIB/8P+EA/+Ah4BB8EAvkA/EAgPgh4EBh4RCgFwDAUHAwIABnADCgPAAgUcBBY9BAYUOuAEC8YDChgkCgPDFoUcBA88EgUDwJUBgF4hwDBg8AJYICBJoUegE+BgPAgPwgJkC+CCCn//J4X/DgUAsCbFA==")); const deleteImg = require("heatshrink").decompress(atob("mUywIROgP/8AGD//8AocwgYFDhkA4AFCBQMwAgMH/4ACwAjBAAQmBjAVCsEAgwFCBIMBwAFBBIQOBBIYYssEBwIYCjkA8AYCgeAuAYDuE4DAcOjgxDgPOGIk/GIkHwAYDgPgJQihBDAdzwAYDnFwDAcchwYDAgPADAUHgE4DARaBgyV1DBTzD/AIBAoRxBABgA==")); const okImg = require("heatshrink").decompress(atob("mEwwIWThACBiACBjgCBnACBnwCBvgCB/wCBv8AgP8AoMfwED+EPAIPAg/gv/+AYMP4P//+DBoOHAoPh+EHCwXw8AgB4ED/AmBn4CBFgV+AQg+CIgQUCj4CB+ACBh5HB+EwhEPwEB8F4jkHAoV8nwFBgfAn18AYIBBj/4AoZGBAoZdBApIRFDoopBg/AGopBCjwFCJohZFMoxxFPoqJFSopGBj4mCg6tBUwKEBAoI0BaoTZCDAb/MABg=")); - const pauseImg = require("heatshrink").decompress(atob("mEwwI1yj/8Aod//+AAgMB///4AFBgfwgfgAoMHBIP4AoMPAQN4AQMeAQM8AQMcBAsYhkOAoM4jkOg4FBuAFIHgIFCgYFB+AFE8AFWDoopFGpBBCJopZFMopxFPoqJFSoqhFVoq5GAFo=")); - const playImg = require("heatshrink").decompress(atob("mEwwI1yj/8Aod//+AAgMB///4AFBgfwgfgAoMHBIP4AoMPAQN4AQMeAQM8AQMcBAsHgEOAoM4h/AA4MAuEP8AFE+EHHgIFB/EDAoPwh/+AoXgh//AqgdFFIo1HIIZNFLIplFOIp9FRIqVFUIqtFXIwAt")); + const pauseImg = require("heatshrink").decompress(atob("mUywI2zh/8AIIFBgf/AIIMC//AAIIFBn/wAIIY/DH4Y9AGA=")); + const playImg = require("heatshrink").decompress(atob("mUywIpmgYGF+AFEn4FEh/gDAn+Bgn/Bgk//gYE//ADAf/Bgn/Bgk///4DAn/wAYDBggFB/4YE/5TCDAQMCDARGDAoRTCDAQMCDAYsBDAYyCAooYCLAQYCAoQYCMgYwEDAQFDDAIFDDAR8FSogFEDAKuEQIYYCAok/AokPUAYYBAokAAooAkA")); const timerImg = require("heatshrink").decompress(atob("mEwwIoln////8AqcD4ABBArXgg4FCgIpBwAFHgAFBJwd//xUEIAQABj/4AocP+AFDg/gApIRFDos+vgFDvk+Aof4j4ECgPwh5TDL4IFCMopxG4ODAofD4YFD4/jApC/XAEQ=")); const alarmImg = require("heatshrink").decompress(atob("mEwwIWThACBiACBjgCBnACBnwCBvgCB/wCBv8AgP8AoMfwED+EPAIPAg/gv/+AYMP4P//+DBoOHAoPh+EHCwXw8AgB4ED/AmBn4CBFgV+AQl8gfAIgX4AoMfAoPwAoMPI4IFDwEB8AFBg4FGAYIBeEoQBCIYQBBgJ3BAYJnBv+HHYRtBIIXwgB6BwBZBLgJZBMoKhCWAhxCPoqJFSoqfBj4mCg6tBHAKEBAoI0BaoTZCDAb/MABg")); const alarmOnImg = require("heatshrink").decompress(atob("mEwwJC/ABMf////AFBAgIABgEBAoeAgYFD4EH8AUBAYMPwAFBgPwj4mC+H4jwEBgf8vAFCg/+vE8Aoc8AoUP/4FVDoQpFGopBFJopZFMopxFPoqJGAH4AGA=")); const alarmOffImg = require("heatshrink").decompress(atob("mEwwJC/ABMf////AFBAgIABgEBAoeAgYFD4EH8AUBAYMPwAFBgPwj8PE4X4j0/4AFBvEev4YCvE8Aoc8nn/+AFVDogpFGopBFJopZFMopxFPoqJGAH4AGA==")); + const sched = require("sched"); const settings = sched.getSettings(); const TimePicker = require("timepicker").TimePicker; @@ -87,7 +88,6 @@ }; const ms2String = function(ms, mode, includeSeconds) { - "jit"; const hms = ms2hms(ms, mode); if (hms.m < 10) hms.m = "0" + hms.m; if (hms.s < 10) hms.s = "0" + hms.s; @@ -149,7 +149,7 @@ const midX = (r.x + r.x2) / 2; const midY = (r.y + r.y2) / 2; const halfImg = 25; - g.setColor(1, 0, 0).fillRect({ x: r.x, y: r.y + 4, x2: r.x2 - 3, y2: r.y2 }).setColor(g.theme.fg); + g.setColor(1, 0, 0).fillRect({ x: r.x, y: r.y + 4, x2: r.x2 - 3, y2: r.y2 - 3}).setColor(g.theme.fg); g.drawImage(deleteImg, midX - halfImg, midY - halfImg); }; @@ -157,7 +157,7 @@ const midX = (r.x + r.x2) / 2; const midY = (r.y + r.y2) / 2; const halfImg = 16; - g.setColor(0, 0, 1).fillRect({ x: r.x, y: r.y + 4, x2: r.x2 - 3, y2: r.y2 }).setColor(g.theme.fg); + g.setColor(0, 0, 1).fillRect({ x: r.x, y: r.y + 4, x2: r.x2 - 3, y2: r.y2 - 3}).setColor(g.theme.fg); g.drawImage(resetImg, midX - halfImg, midY - halfImg); }; @@ -170,7 +170,6 @@ }; const drawTimerProgress = function(value, maxValue, x, y) { - "jit"; const len = 115; const t = 16; const x2 = x + len; @@ -212,10 +211,10 @@ let timeToAlarm; if (alarm.on) { - g.setColor(0, 1, 0.5).drawImage(alarmOnImg, r.x2 - 45, r.y).setColor(-1); + g.setColor(0, 1, 0.5).drawImage(alarmOnImg, r.x2 - 50, r.y + 5).setColor(-1); timeToAlarm = sched.getTimeToAlarm(alarm); } else { - g.setColor(0.5, 0.5, 0.5).drawImage(alarmOffImg, r.x2 - 45, r.y).setColor(-1); + g.setColor(0.5, 0.5, 0.5).drawImage(alarmOffImg, r.x2 - 50, r.y + 5).setColor(-1); timeToAlarm = 0; } const timeStr = ms2String(alarm.t, "alarm"); @@ -244,13 +243,21 @@ g.setBgColor(g.theme.bg).setColor(g.theme.fg); }; - const drawEmpty = function(r) { + const drawEmpty = function(r, mode) { const midX = (r.x2 + r.x) / 2; const midY = (r.y2 + r.y) / 2; g.setColor(0.25, 0.25, 0.25); - g.setFontAlign(0, 0).setFont("Vector:80"); - g.drawString("O", midX, midY); - g.drawString("/", midX, midY); + // g.setFontAlign(0, 0).setFont("Vector:80"); + // g.drawString("o", midX, midY); + // g.drawString("/", midX, midY); + // g.drawImage(nullImg, midX, midY); + g.setColor(-1); + g.drawCircle(midX, midY - 20, 30); + g.drawLine(midX + 30, midY - 50, midX - 30, midY + 10); + let str; + if (mode === "timer") str = "No Timers"; + else if (mode === "alarm") str = "No Alarms"; + g.setColor(0.5, 0.5, 0.5).setFont("Vector:20").drawString(str, midX, r.y2 - 30); } const drawTimeUp = function(timer, r) { @@ -415,14 +422,16 @@ const drawTbMax = function(r) { g.clearRect(r.x, r.y, r.x2, r.y2); - g.setColor(0, 0, 0.25).fillRect(r.x, r.y, r.x + 96, r.y2); - g.setColor(0, 0.5, 0.5); + //g.setColor(0, 0, 0.25).fillRect(r.x, r.y, r.x + 96, r.y2); + g.setColor(0, 1, 1); if (mode === "timer") { - g.fillRect(r.x, r.y, r.x + 47, r.y2); + g.fillRect({x: r.x, y: r.y, x2: r.x + 47, y2: r.y2, r: 10}); + g.setColor(0, 0, 0).fillRect({x: r.x + 3, y: r.y + 3, x2: r.x + 44, y2: r.y2, r: 8}); } else { - g.fillRect(r.x + 48, r.y, r.x + 99, r.y2); + g.fillRect({x: r.x + 48, y: r.y, x2: r.x + 99, y2: r.y2, r: 10}); + g.setColor(0, 0, 0).fillRect({x: r.x + 51, y: r.y + 3, x2: r.x + 96, y2: r.y2, r: 8}); } - g.fillRect(r.x, r.y2, r.x2, r.y2 - 3); + g.setColor(0, 1, 1).fillRect(r.x, r.y2, r.x2, r.y2 - 3); // bottom line const midY = (r.y + r.y2) / 2; const midX = (r.x2 - 20); g.setColor(g.theme.fg); @@ -470,7 +479,7 @@ const timerScroller = new Scroller({ h: 75, c: timerIndexes.length, draw: (i, r, d) => drawTimer(i, r, d), - drawEmpty: (r) => drawEmpty(r), + drawEmpty: (r) => drawEmpty(r, "timer"), select: (i, r, x) => timerTouchHandler(i, r, x), button1: (i) => remove(i), button2: (i) => resetTimer(i), @@ -482,7 +491,7 @@ const alarmScroller = new Scroller({ h: 95, c: alarmIndexes.length, draw: (i, r, d) => drawAlarm(i, r, d), - drawEmpty: (r) => drawEmpty(r), + drawEmpty: (r) => drawEmpty(r, "alarm"), select: (i, r, x) => alarmTouchHandler(i, r, x), button1: (i) => remove(i), button2: undefined, diff --git a/apps/mtimer/scroller.lib.js b/apps/mtimer/scroller.lib.js index 54f9babeb..a19a90930 100644 --- a/apps/mtimer/scroller.lib.js +++ b/apps/mtimer/scroller.lib.js @@ -170,7 +170,7 @@ exports.Scroller = function(options) { if (this.touchStart && d.b === 0) { this.mode = undefined; this.selectedX = this.x; - let b1min, b1max, b2min, b2max; + let b1x1, b1x2, b2x1, b2x2; if (this.drawButton2 === undefined) { b1x1 = this.x + this.w - this.buttonW; b1x2 = this.x + this.w; @@ -178,7 +178,7 @@ exports.Scroller = function(options) { b1x1 = this.x + this.w - this.buttonsW; b1x2 = this.x + this.w - this.buttonW; } - b2min = this.x + this.w - this.buttonW; + b2x1 = this.x + this.w - this.buttonW; if (d.x > b1x1 && d.x < b1x2) { // button 1: delete this.removingSelection = this.selected; this.c--; diff --git a/apps/mtimer/timepicker.lib.js b/apps/mtimer/timepicker.lib.js index c5f58f426..8f4490d3d 100644 --- a/apps/mtimer/timepicker.lib.js +++ b/apps/mtimer/timepicker.lib.js @@ -411,9 +411,9 @@ const Poly = require("poly").Poly; } } if (!this.btid) { - this.buzzLen = 10; - this.buzzStrength = 1; - this.btid = setTimeout(() => { this.buzzLen = 45; }, 150); + this.buzzLen = 25; + this.buzzStrength = 0.75; + this.btid = setTimeout(() => { this.buzzLen = 50; this.buzzStrength = 1}, 150); } const delta = Math.max(Math.abs(d.dx), Math.abs(d.dy));