Merge remote-tracking branch 'origin/master' into wip/rename

Conflicts:
	api/cpp/cbindgen.rs
	api/cpp/include/slint.h
	examples/CMakeLists.txt
	examples/imagefilter/Cargo.toml
	examples/plotter/main.rs
	internal/backends/mcu/lib.rs
This commit is contained in:
Simon Hausmann 2022-02-04 16:47:20 +01:00
commit 125b90a64b
44 changed files with 1476 additions and 144 deletions

View file

@ -8,7 +8,10 @@ export MainWindow := Window {
preferred-width: 800px;
preferred-height: 600px;
callback render_plot(float) -> image;
callback render_plot(float /* pitch */, float /* yaw */, float /* amplitude */) -> image;
property <float> pitch: 0.15;
property <float> yaw: 0.5;
VerticalBox {
Text {
@ -17,18 +20,35 @@ export MainWindow := Window {
horizontal-alignment: center;
}
Image {
source: root.render_plot(pitch-slider.value);
source: root.render_plot(pitch, yaw, amplitude-slider.value / 10);
touch := TouchArea {
property <float> pressed-pitch;
property <float> pressed-yaw;
pointer-event(event) => {
if (event.button == PointerEventButton.left && event.kind == PointerEventKind.down) {
pressed-pitch = root.pitch;
pressed-yaw = root.yaw;
}
}
moved => {
if (enabled && pressed) {
pitch = pressed-pitch + (touch.mouse-y - touch.pressed-y) / height * 3.14;
yaw = pressed-yaw - (touch.mouse-x - touch.pressed-x) / width * 3.14;
}
}
mouse-cursor: pressed ? MouseCursor.grabbing : MouseCursor.grab;
}
}
HorizontalBox {
Text {
text: "Pitch:";
text: "Amplitude:";
font-weight: 600;
vertical-alignment: center;
}
pitch-slider := Slider {
amplitude-slider := Slider {
minimum: 0;
maximum: 180;
value: 42;
maximum: 100;
value: 50;
}
}
}