Skip to content

Commit ee5de9c

Browse files
committed
fix scaling and recalculation issue on placed locations
1 parent 9952845 commit ee5de9c

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

pythonProject/image_coord_picker.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,8 @@ def load_new_base_image(window_ref:Any, img_path:str=""):
399399
new_img_path = filedialog.askopenfilename()
400400
image = Image.open(fr"{new_img_path}")
401401
og_img_size = image.size
402-
og_img_width = og_img_size[0] if og_img_size[0] < 1000 else 1000
403-
og_img_height = og_img_size[1] if og_img_size[1] < 700 else 700
402+
og_img_width = og_img_size[0] # if og_img_size[0] < 1000 else 1000
403+
og_img_height = og_img_size[1] # if og_img_size[1] < 700 else 700
404404
copy_of_image = image.copy()
405405
if img_path == "":
406406
window_ref.geometry(f"{og_img_width}x{og_img_height}")
@@ -543,7 +543,7 @@ def restore_default_markings():
543543
def place_location(event):
544544
print("clicked at", event.x, event.y)
545545
print("scaling factor", scaling_factor)
546-
print("actual image coords", event.x//scaling_factor, event.y//scaling_factor)
546+
print("actual image coords", event.x //scaling_factor, event.y // scaling_factor)
547547

548548
canvas, _ = get_entity(window, tk.Canvas, "map image canvas")
549549
shape_selection, _ = get_entity(window, ttk.Combobox, "shape_selection")
@@ -593,8 +593,8 @@ def place_location(event):
593593
# )
594594
new_data[selected_location] = [
595595
build_map_dict(
596-
x=int(event.x//scaling_factor),
597-
y=int(event.y//scaling_factor),
596+
x=int(event.x // scaling_factor),
597+
y=int(event.y // scaling_factor),
598598
map_name=map_json_selected,
599599
size=int(size_selection['values'][size_selection.current()]),
600600
shape=shape_selection['values'][shape_selection.current()],

0 commit comments

Comments
 (0)