Make image pos editable
This commit is contained in:
parent
fb1ecf17c5
commit
b4c6cb70b6
|
@ -43,7 +43,7 @@ impl MainTab {
|
||||||
|
|
||||||
add_new_image(file_name, image, if image_palette.is_some() {1} else {0}, false);
|
add_new_image(file_name, image, if image_palette.is_some() {1} else {0}, false);
|
||||||
if let Some(image_palette) = image_palette {
|
if let Some(image_palette) = image_palette {
|
||||||
let file_name = file_name.clone() + " (Palette)";
|
let file_name = " => ".to_owned() + file_name.as_str() + " (Palette)";
|
||||||
add_new_image(&file_name, image_palette, 0, true);
|
add_new_image(&file_name, image_palette, 0, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { VRAMArea } from "../vram-components.slint";
|
import { VRAMArea } from "../vram-components.slint";
|
||||||
import { Button, ComboBox, GroupBox, StandardListView } from "std-widgets.slint";
|
import { Button, ComboBox, GroupBox, StandardListView, LineEdit } from "std-widgets.slint";
|
||||||
|
|
||||||
struct VRAMImage {
|
struct VRAMImage {
|
||||||
img: image,
|
img: image,
|
||||||
|
@ -56,8 +56,8 @@ export component MainTab inherits Rectangle {
|
||||||
moved => {
|
moved => {
|
||||||
self.mouse-cursor = MouseCursor.grabbing;
|
self.mouse-cursor = MouseCursor.grabbing;
|
||||||
root.move_vram_image(i, (self.mouse-x - self.pressed-x)/1px, (self.mouse-y - self.pressed-y)/1px);
|
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_x.text = parent.img_x;
|
||||||
cur_sel_y.display_value = parent.img_y;
|
cur_sel_y.text = parent.img_y;
|
||||||
}
|
}
|
||||||
pointer-event(event) => {
|
pointer-event(event) => {
|
||||||
if event.kind == PointerEventKind.up {
|
if event.kind == PointerEventKind.up {
|
||||||
|
@ -65,8 +65,8 @@ export component MainTab inherits Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
if event.kind == PointerEventKind.down {
|
if event.kind == PointerEventKind.down {
|
||||||
cur_sel_x.display_value = parent.img_x;
|
cur_sel_x.text = parent.img_x;
|
||||||
cur_sel_y.display_value = parent.img_y;
|
cur_sel_y.text = parent.img_y;
|
||||||
cur_sel_img.source = parent.img;
|
cur_sel_img.source = parent.img;
|
||||||
cur_sel_img.visible = true;
|
cur_sel_img.visible = true;
|
||||||
vram_files_list.current-item = i;
|
vram_files_list.current-item = i;
|
||||||
|
@ -105,8 +105,8 @@ export component MainTab inherits Rectangle {
|
||||||
model: root.vram_files;
|
model: root.vram_files;
|
||||||
|
|
||||||
current-item-changed(current-item) => {
|
current-item-changed(current-item) => {
|
||||||
cur_sel_x.display_value = root.vram_images[current-item].x;
|
cur_sel_x.text = root.vram_images[current-item].x;
|
||||||
cur_sel_y.display_value = root.vram_images[current-item].y;
|
cur_sel_y.text = root.vram_images[current-item].y;
|
||||||
cur_sel_img.source = root.vram_images[current-item].img;
|
cur_sel_img.source = root.vram_images[current-item].img;
|
||||||
cur_sel_img.visible = true;
|
cur_sel_img.visible = true;
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,8 @@ export component MainTab inherits Rectangle {
|
||||||
clicked => {
|
clicked => {
|
||||||
root.remove_file_clicked(vram_files_list.current_item);
|
root.remove_file_clicked(vram_files_list.current_item);
|
||||||
vram_files_list.current-item = -1;
|
vram_files_list.current-item = -1;
|
||||||
cur_sel_x.display_value = 0;
|
cur_sel_x.text = 0;
|
||||||
cur_sel_y.display_value = 0;
|
cur_sel_y.text = 0;
|
||||||
cur_sel_img.visible = false;
|
cur_sel_img.visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,13 +144,47 @@ export component MainTab inherits Rectangle {
|
||||||
image-fit: contain;
|
image-fit: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cur_sel_x := Text {
|
HorizontalLayout {
|
||||||
in-out property <int> display_value;
|
alignment: start;
|
||||||
text: "X: " + display_value;
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Text {
|
||||||
|
text: "X: ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cur_sel_x := LineEdit {
|
||||||
|
input-type: number;
|
||||||
|
text: 0;
|
||||||
|
width: 64pt;
|
||||||
|
|
||||||
|
accepted(text) => {
|
||||||
|
if(vram_files_list.current-item != -1) {
|
||||||
|
root.move_vram_image(vram_files_list.current-item, text.to-float() - vram_images[vram_files_list.current-item].x, 0);
|
||||||
|
self.text = vram_images[vram_files_list.current-item].x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
HorizontalLayout {
|
||||||
|
alignment: start;
|
||||||
|
VerticalLayout {
|
||||||
|
alignment: center;
|
||||||
|
Text {
|
||||||
|
text: "Y: ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cur_sel_y := LineEdit {
|
||||||
|
input-type: number;
|
||||||
|
text: 0;
|
||||||
|
width: 64pt;
|
||||||
|
|
||||||
|
accepted(text) => {
|
||||||
|
if(vram_files_list.current-item != -1) {
|
||||||
|
root.move_vram_image(vram_files_list.current-item, 0, text.to-float() - vram_images[vram_files_list.current-item].y);
|
||||||
|
self.text = vram_images[vram_files_list.current-item].y;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cur_sel_y :=Text {
|
|
||||||
in-out property <int> display_value;
|
|
||||||
text: "Y: " + display_value;
|
|
||||||
}
|
}
|
||||||
ComboBox {
|
ComboBox {
|
||||||
model: ["4-bit", "16-bit", "24-bit"];
|
model: ["4-bit", "16-bit", "24-bit"];
|
||||||
|
|
Loading…
Reference in New Issue