minimap position

This commit is contained in:
Pfauenauge90 2020-03-14 14:07:20 +01:00 committed by timokoesters
parent 19bcbbbd9a
commit 492db3ac5f
3 changed files with 15 additions and 18 deletions

BIN
assets/voxygen/element/frames/mmap.png (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

View File

@ -103,14 +103,15 @@ impl<'a> Widget for MiniMap<'a> {
fn update(self, args: widget::UpdateArgs<Self>) -> Self::Event {
let widget::UpdateArgs { state, ui, .. } = args;
let zoom = state.zoom;
const SCALE: f64 = 1.0;
if self.show.mini_map {
Image::new(self.imgs.mmap_frame)
.w_h(100.0 * 3.0, 100.0 * 3.0)
.w_h(174.0 * SCALE, 190.0 * SCALE)
.top_right_with_margins_on(ui.window, 5.0, 5.0)
.set(state.ids.mmap_frame, ui);
Rectangle::fill_with([92.0 * 3.0, 82.0 * 3.0], color::TRANSPARENT)
.mid_top_with_margin_on(state.ids.mmap_frame, 13.0 * 3.0 + 3.0)
Rectangle::fill_with([170.0 * SCALE, 170.0 * SCALE], color::TRANSPARENT)
.mid_top_with_margin_on(state.ids.mmap_frame, 18.0 * SCALE)
.set(state.ids.mmap_frame_bg, ui);
// Map size
@ -138,7 +139,7 @@ impl<'a> Widget for MiniMap<'a> {
let can_zoom_out = zoom > min_zoom;
if Button::image(self.imgs.mmap_minus)
.w_h(100.0 * 0.30, 100.0 * 0.30)
.w_h(16.0 * SCALE, 18.0 * SCALE)
.hover_image(self.imgs.mmap_minus_hover)
.press_image(self.imgs.mmap_minus_press)
.top_left_with_margins_on(state.ids.mmap_frame, 0.0, 0.0)
@ -153,10 +154,10 @@ impl<'a> Widget for MiniMap<'a> {
// set_image_dims(zoom);
}
if Button::image(self.imgs.mmap_plus)
.w_h(100.0 * 0.30, 100.0 * 0.30)
.w_h(18.0 * SCALE, 18.0 * SCALE)
.hover_image(self.imgs.mmap_plus_hover)
.press_image(self.imgs.mmap_plus_press)
.right_from(state.ids.mmap_minus, 6.0)
.right_from(state.ids.mmap_minus, 0.0)
.enabled(can_zoom_in)
.set(state.ids.mmap_plus, ui)
.was_clicked()
@ -195,7 +196,7 @@ impl<'a> Widget for MiniMap<'a> {
// Map Image
Image::new(world_map.source_north)
.middle_of(state.ids.mmap_frame_bg)
.w_h(92.0 * 3.0, 82.0 * 3.0)
.w_h(170.0 * SCALE, 170.0 * SCALE)
.parent(state.ids.mmap_frame_bg)
.source_rectangle(rect_src)
.set(state.ids.grid, ui);
@ -211,8 +212,8 @@ impl<'a> Widget for MiniMap<'a> {
.set(state.ids.indicator, ui);
} else {
Image::new(self.imgs.mmap_frame_closed)
.w_h(100.0 * 2.0, 11.0 * 2.0)
.top_right_with_margins_on(ui.window, 5.0, 5.0)
.w_h(174.0 * SCALE, 18.0 * SCALE)
.top_right_with_margins_on(ui.window, 0.0, 0.0)
.set(state.ids.mmap_frame, ui);
}
@ -221,11 +222,7 @@ impl<'a> Widget for MiniMap<'a> {
} else {
self.imgs.mmap_closed
})
.wh(if self.show.mini_map {
[100.0 * 0.3; 2]
} else {
[100.0 * 0.2; 2]
})
.w_h(18.0 * SCALE, 18.0 * SCALE)
.hover_image(if self.show.mini_map {
self.imgs.mmap_open_hover
} else {