mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
parent
2983ae48c4
commit
3b6e0e5802
3 changed files with 39 additions and 5 deletions
|
@ -3,10 +3,14 @@ All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
### Changed
|
### Added
|
||||||
|
|
||||||
- Enable support for compressed SVG (.svgz).
|
- Enable support for compressed SVG (.svgz).
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed the PointerEvent.kind always being down
|
||||||
|
|
||||||
## [0.1.3] - 2021-10-06
|
## [0.1.3] - 2021-10-06
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
|
@ -427,7 +427,7 @@ impl Item for TouchArea {
|
||||||
Self::FIELD_OFFSETS.pressed.apply_pin(self).set(false);
|
Self::FIELD_OFFSETS.pressed.apply_pin(self).set(false);
|
||||||
Self::FIELD_OFFSETS.pointer_event.apply_pin(self).call(&(PointerEvent {
|
Self::FIELD_OFFSETS.pointer_event.apply_pin(self).call(&(PointerEvent {
|
||||||
button: PointerEventButton::none,
|
button: PointerEventButton::none,
|
||||||
kind: PointerEventKind::down,
|
kind: PointerEventKind::cancel,
|
||||||
},));
|
},));
|
||||||
}
|
}
|
||||||
MouseEvent::MouseReleased { button, .. } => {
|
MouseEvent::MouseReleased { button, .. } => {
|
||||||
|
@ -437,7 +437,7 @@ impl Item for TouchArea {
|
||||||
Self::FIELD_OFFSETS
|
Self::FIELD_OFFSETS
|
||||||
.pointer_event
|
.pointer_event
|
||||||
.apply_pin(self)
|
.apply_pin(self)
|
||||||
.call(&(PointerEvent { button, kind: PointerEventKind::down },));
|
.call(&(PointerEvent { button, kind: PointerEventKind::up },));
|
||||||
}
|
}
|
||||||
MouseEvent::MouseMoved { .. } => {
|
MouseEvent::MouseMoved { .. } => {
|
||||||
return if self.pressed() {
|
return if self.pressed() {
|
||||||
|
|
|
@ -12,6 +12,8 @@ TestCase := Rectangle {
|
||||||
property <int> touch2;
|
property <int> touch2;
|
||||||
property <int> touch3;
|
property <int> touch3;
|
||||||
|
|
||||||
|
property <string> pointer-event-test;
|
||||||
|
|
||||||
TouchArea {
|
TouchArea {
|
||||||
x: 100phx;
|
x: 100phx;
|
||||||
y: 100phx;
|
y: 100phx;
|
||||||
|
@ -31,9 +33,31 @@ TestCase := Rectangle {
|
||||||
y: 100phx;
|
y: 100phx;
|
||||||
width: 5phx;
|
width: 5phx;
|
||||||
height: 5phx;
|
height: 5phx;
|
||||||
clicked => { touch2+=1; }
|
clicked => {
|
||||||
|
pointer-event-test += "click";
|
||||||
|
touch2+=1;
|
||||||
|
}
|
||||||
pointer-event(e) => {
|
pointer-event(e) => {
|
||||||
if (e.kind == PointerEventKind.cancel || e.button == PointerEventButton.right) {}
|
if (e.kind == PointerEventKind.cancel) {
|
||||||
|
pointer-event-test += "cancel";
|
||||||
|
} else if (e.kind == PointerEventKind.up) {
|
||||||
|
pointer-event-test += "up";
|
||||||
|
} else if (e.kind == PointerEventKind.down) {
|
||||||
|
pointer-event-test += "down";
|
||||||
|
} else {
|
||||||
|
pointer-event-test += "err";
|
||||||
|
}
|
||||||
|
if (e.button == PointerEventButton.right) {
|
||||||
|
pointer-event-test += "right";
|
||||||
|
} else if (e.button == PointerEventButton.left) {
|
||||||
|
pointer-event-test += "left";
|
||||||
|
} else if (e.button == PointerEventButton.middle) {
|
||||||
|
pointer-event-test += "middle";
|
||||||
|
} else if (e.button == PointerEventButton.none) {
|
||||||
|
pointer-event-test += "none";
|
||||||
|
} else {
|
||||||
|
pointer-event-test += "other";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +91,8 @@ assert_eq(instance.get_touch1(), 1);
|
||||||
assert_eq(instance.get_touch2(), 1);
|
assert_eq(instance.get_touch2(), 1);
|
||||||
assert_eq(instance.get_touch3(), 1);
|
assert_eq(instance.get_touch3(), 1);
|
||||||
|
|
||||||
|
assert_eq(instance.get_pointer_event_test(), "downleftclickupleft");
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +122,8 @@ assert_eq!(instance.get_touch1(), 1);
|
||||||
assert_eq!(instance.get_touch2(), 1);
|
assert_eq!(instance.get_touch2(), 1);
|
||||||
assert_eq!(instance.get_touch3(), 1);
|
assert_eq!(instance.get_touch3(), 1);
|
||||||
|
|
||||||
|
assert_eq!(instance.get_pointer_event_test().as_str(), "downleftclickupleft");
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
@ -123,5 +151,7 @@ instance.send_mouse_click(106., 103.);
|
||||||
assert.equal(instance.touch1, 1);
|
assert.equal(instance.touch1, 1);
|
||||||
assert.equal(instance.touch2, 1);
|
assert.equal(instance.touch2, 1);
|
||||||
assert.equal(instance.touch3, 1);
|
assert.equal(instance.touch3, 1);
|
||||||
|
|
||||||
|
assert.equal(instance.pointer_event_test, "downleftclickupleft");
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue