Support proper background and coordinates now

This commit is contained in:
2025-02-09 17:00:24 +01:00
parent 2993fa661a
commit 3e0fb8396d
5 changed files with 68 additions and 15 deletions

View File

@@ -8,6 +8,7 @@ struct VRAMImage {
}
export component MainTab inherits Rectangle {
in-out property <image> vram_bg;
in-out property <[StandardListViewItem]> vram_files: [];
in-out property <[VRAMImage]> vram_images: [];
@@ -31,16 +32,16 @@ export component MainTab inherits Rectangle {
border-color: #404040;
background: #A0A0A0;
background_image := VRAMArea {
x: root.get_border_width()*1px;
y: root.get_border_width()*1px;
img: @image-url("../../../../../examples/PoolBox/assets/AllTheJaby.png");
x: root.get_border_width()*1px;
y: root.get_border_width()*1px;
img: vram_bg;
img_x: 0;
img_y: 0;
}
for vram_image[i] in root.vram_images: VRAMArea {
x: root.get_border_width()*1px;
y: root.get_border_width()*1px;
x: root.get_border_width()*1px;
y: root.get_border_width()*1px;
img: vram-image.img;
img_x: vram-image.x;
img_y: vram-image.y;
@@ -53,12 +54,18 @@ export component MainTab inherits Rectangle {
moved => {
self.mouse-cursor = MouseCursor.grabbing;
root.move_vram_image(i, (self.mouse-x - self.pressed-x)/1px, (self.mouse-y - self.pressed-y)/1px);
cur_sel_x.display_value = parent.img_x;
cur_sel_y.display_value = parent.img_y;
}
pointer-event(event) => {
if event.kind == PointerEventKind.up {
self.mouse-cursor = MouseCursor.grab;
}
if event.kind == PointerEventKind.down {
cur_sel_x.display_value = parent.img_x;
cur_sel_y.display_value = parent.img_y;
}
}
// Thanks to Cody the white tiger
@@ -117,6 +124,14 @@ export component MainTab inherits Rectangle {
height: 128px;
background: #A0A0A0;
}
cur_sel_x := Text {
in-out property <int> display_value;
text: "X: " + display_value;
}
cur_sel_y :=Text {
in-out property <int> display_value;
text: "Y: " + display_value;
}
ComboBox {
model: ["4-bit", "16-bit", "24-bit"];
current-value: "4-bit";