fix: fixed widget positioning for rounded corners, fixed logo

This commit is contained in:
Савелий Савенок 2024-10-20 03:08:32 +03:00
parent e8062061b4
commit a75ffcbfb8
6 changed files with 23 additions and 17 deletions

View File

@ -6,7 +6,7 @@
"appType": "watchface", "appType": "watchface",
"version": { "version": {
"code": 1, "code": 1,
"name": "1.0.0" "name": "1.0.1"
}, },
"icon": "icon.png", "icon": "icon.png",
"vender": "zepp", "vender": "zepp",
@ -31,7 +31,7 @@
"path": "watchface/index", "path": "watchface/index",
"main": 1, "main": 1,
"editable": 0, "editable": 0,
"lockscreen": 0, "lockscreen": 1,
"hightCost": 0 "hightCost": 0
} }
}, },

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@ -3,15 +3,16 @@ import * as hmUI from '@zos/ui'
import fontArray from '../fontData/secondaryFont' import fontArray from '../fontData/secondaryFont'
let batteryWg; let batteryWg;
const moduleX = 310
const moduleY = 10
export default function(){ export default function(){
console.log("[modules]: battery module init") console.log("[modules]: battery module init")
let battery = new hmSensor.Battery() let battery = new hmSensor.Battery()
updateBatteryWidget(battery.getCurrent()) updateBatteryWidget(battery.getCurrent())
battery.onChange(() => updateBatteryWidget(battery.getCurrent())) battery.onChange(() => updateBatteryWidget(battery.getCurrent()))
hmUI.createWidget(hmUI.widget.IMG, { hmUI.createWidget(hmUI.widget.IMG, {
x: 355, x: moduleX,
y: 10, y: moduleY,
src: 'date/perc.PNG' src: 'date/perc.PNG'
}) })
} }
@ -20,8 +21,8 @@ function updateBatteryWidget(batteryPercentage){
hmUI.deleteWidget(batteryWg) hmUI.deleteWidget(batteryWg)
} }
batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { batteryWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
x: 270, x: moduleX - 85,
y: 10, y: moduleY,
type: hmUI.data_type.BATTERY, type: hmUI.data_type.BATTERY,
font_array: fontArray, font_array: fontArray,
h_space: 1, h_space: 1,

View File

@ -1,23 +1,26 @@
import * as hmUI from '@zos/ui' import * as hmUI from '@zos/ui'
import fontArray from '../fontData/secondaryFont' import fontArray from '../fontData/secondaryFont'
const moduleX = 50
const moduleY = 10
export default function () { export default function () {
console.log("[modules]: date module init") console.log("[modules]: date module init")
hmUI.createWidget(hmUI.widget.IMG_DATE, { hmUI.createWidget(hmUI.widget.IMG_DATE, {
day_startX: 10, day_startX: moduleX,
day_startY: 10, day_startY: moduleY,
day_align: hmUI.align.LEFT, day_align: hmUI.align.LEFT,
day_space: 0, day_space: 0,
day_zero: 1, day_zero: 1,
day_en_array: fontArray day_en_array: fontArray
}) })
hmUI.createWidget(hmUI.widget.IMG, { hmUI.createWidget(hmUI.widget.IMG, {
x: 54, x: moduleX + 44,
y: 14, y: moduleY + 4,
src: 'date/point.PNG' src: 'date/point.PNG'
}) })
hmUI.createWidget(hmUI.widget.IMG_DATE, { hmUI.createWidget(hmUI.widget.IMG_DATE, {
month_startX: 70, month_startX: moduleX + 60,
month_startY: 10, month_startY: moduleY,
month_align: hmUI.align.LEFT, month_align: hmUI.align.LEFT,
month_space: 0, month_space: 0,
month_zero: 1, month_zero: 1,

View File

@ -3,14 +3,16 @@ import * as hmUI from '@zos/ui';
import secondaryFont from '../fontData/secondaryFont'; import secondaryFont from '../fontData/secondaryFont';
let distWg; let distWg;
const moduleX = 50
const moduleY = 405
export default function(){ export default function(){
console.log("[modules]: distance module init") console.log("[modules]: distance module init")
let distance = new hmSensor.Distance(); let distance = new hmSensor.Distance();
updateDistance(distance.getCurrent()) updateDistance(distance.getCurrent())
distance.onChange(() => updateDistance(distance.getCurrent())) distance.onChange(() => updateDistance(distance.getCurrent()))
hmUI.createWidget(hmUI.widget.IMG, { hmUI.createWidget(hmUI.widget.IMG, {
x: 10, x: moduleX,
y: 405, y: moduleY,
src: 'misc/dist.PNG' src: 'misc/dist.PNG'
}) })
} }
@ -24,8 +26,8 @@ function updateDistance(dist){
} }
dist = (dist * 1000).toFixed(0) dist = (dist * 1000).toFixed(0)
distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, { distWg = hmUI.createWidget(hmUI.widget.TEXT_IMG, {
x: 160, x: moduleX + 150,
y: 405, y: moduleY,
type: hmUI.data_type.DISTANCE, type: hmUI.data_type.DISTANCE,
font_array: secondaryFont, font_array: secondaryFont,
h_space: 1, h_space: 1,