Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

printerdemo_mcu: react on pointer up rather than click #2959

Merged
merged 1 commit into from Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 30 additions & 8 deletions examples/printerdemo_mcu/ui/common.slint
Expand Up @@ -71,7 +71,11 @@ export component Page inherits Rectangle {
width: 14px;
height: 24px;
TouchArea {
clicked => { root.back() }
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
root.back()
}
}
width: 400%;
height: 200%;
x: (parent.width - self.width) / 2;
Expand All @@ -88,7 +92,11 @@ export component Page inherits Rectangle {
// Allow clicking on the title as well to get back easier when just
// using fingers on a small screen.
if (root.has-back-button) : TouchArea {
clicked => { root.back() }
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
root.back()
}
}
}
}
}
Expand All @@ -110,8 +118,10 @@ component SquareButton inherits Rectangle {
y: -4px;
width: parent.width + 8px;
height: parent.height + 8px;
clicked => {
root.clicked();
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
root.clicked()
}
}
}
Image {
Expand Down Expand Up @@ -200,7 +210,11 @@ export component ComboBox inherits Rectangle {
TouchArea {
width: 100%;
height: 100%;
clicked => { popup.show(); }
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
popup.show()
}
}
}

popup := PopupWindow {
Expand Down Expand Up @@ -261,8 +275,10 @@ export component CheckBox inherits Rectangle {
}

TouchArea {
clicked => {
root.checked = !root.checked;
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
root.checked = !root.checked;
}
}
}
}
Expand Down Expand Up @@ -304,5 +320,11 @@ export component PushButton inherits Rectangle {
}
}

touch-area := TouchArea { clicked => { root.clicked() } }
touch-area := TouchArea {
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
root.clicked()
}
}
}
}
8 changes: 5 additions & 3 deletions examples/printerdemo_mcu/ui/printer_queue.slint
Expand Up @@ -37,7 +37,7 @@ export global PrinterQueue {
} else {
"Unknown job status"
}
}
}
}


Expand Down Expand Up @@ -156,8 +156,10 @@ component NarrowPrintQueueElement inherits Rectangle {


TouchArea {
clicked => {
root.expanded = !root.expanded;
pointer-event(ev) => {
if (ev.kind == PointerEventKind.up) {
root.expanded = !root.expanded;
}
}
}

Expand Down