Several bugfixes
- Fixed event invisibility when offset is after event's half width - Fixed event being shown outside timeline component - When timer reaches 24:00:00, new day is automatically started
This commit is contained in:
parent
bb230ab4dc
commit
b5e9a4115a
7 changed files with 79 additions and 27 deletions
|
@ -7,6 +7,7 @@ export component AppWindow inherits Window {
|
|||
callback start-new-event <=> record.start-new-event;
|
||||
callback stop-event <=> record.stop-event;
|
||||
callback chain-event <=> record.chain-event;
|
||||
callback new-day-started <=> record.new-day-started;
|
||||
callback update-record-offset(int);
|
||||
callback save-log;
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@ import { VerticalBox, LineEdit, Button, ComboBox } from "std-widgets.slint";
|
|||
import { Timeline } from "timeline.slint";
|
||||
|
||||
export component RecordWidget inherits VerticalBox {
|
||||
callback new-day-started <=> tl.new-day-started;
|
||||
callback update-visible-time(string);
|
||||
callback start-new-event(string);
|
||||
callback chain-event(string);
|
||||
|
|
|
@ -22,7 +22,7 @@ export component ReviewWidget inherits VerticalBox {
|
|||
spacing-horizontal: 16px;
|
||||
Slider {
|
||||
minimum: visible-time;
|
||||
maximum: 24 * 3600;
|
||||
maximum: tl.max-offset;
|
||||
value: offset;
|
||||
row: 0;
|
||||
colspan: 2;
|
||||
|
|
|
@ -24,16 +24,24 @@ global TimeString {
|
|||
}
|
||||
|
||||
export component Timeline inherits Rectangle {
|
||||
callback new-day-started;
|
||||
|
||||
in-out property<bool> updating: true;
|
||||
in-out property<[TimelineEvent]> events: [];
|
||||
in-out property<int> visible-time: 3600;
|
||||
property<int> visible-offset: max(offset, visible-time);
|
||||
in-out property<int> offset: 0;
|
||||
out property<int> max-offset: 24 * 3600 - 1;
|
||||
|
||||
timer := Timer {
|
||||
interval: 1s;
|
||||
running: updating;
|
||||
triggered => {
|
||||
if (offset >= max-offset) {
|
||||
root.new-day-started();
|
||||
offset = 0;
|
||||
return;
|
||||
}
|
||||
offset += 1;
|
||||
}
|
||||
}
|
||||
|
@ -70,10 +78,10 @@ export component Timeline inherits Rectangle {
|
|||
y: parent.height / 4;
|
||||
z: 1;
|
||||
width: event.finished ?
|
||||
(event.duration) / visible-time * parent.width + min(real-x, 0):
|
||||
min(parent.width - self.x, event.duration / visible-time * parent.width + min(real-x, 0)):
|
||||
parent.width - self.x;
|
||||
height: parent.height / 2;
|
||||
visible: self.real-x + self.width > 0 && self.real-x < parent.width;
|
||||
visible: self.width > 0 && self.real-x < parent.width;
|
||||
border-color: black;
|
||||
border-width: 1px;
|
||||
background: red;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue