Skip to content

Commit 683eea4

Browse files
committed
further changes to ui
1 parent 02996da commit 683eea4

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

src/ui.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
163163
.with_child(Flex::row()
164164
.with_child(Label::new("Pattern Zoom: ").with_text_size(14.0))
165165
.with_flex_child(Slider::new()
166-
.with_range(-1.0,4.0).expand_width()
166+
.with_range(0.0,4.0).expand_width()
167167
.lens(FractalData::root_zoom_factor.map(
168168
|val| (1.0 / (1.0 - val)).log2(),
169169
|val, new| *val = 1.0 - (1.0 / 2.0_f64.powf(new.round())))), 1.0)
@@ -217,12 +217,12 @@ pub fn window_main(renderer: Arc<Mutex<FractalRenderer>>) -> impl Widget<Fractal
217217
};
218218
}).lens(FractalData::mouse_mode).expand_width().fix_height(24.0), 1.0)
219219
.with_spacer(4.0)
220-
.with_flex_child(Button::new("CENTRAL OUT").on_click(|ctx, _data: &mut FractalData, _env| {
221-
ctx.submit_command(MULTIPLY_PATTERN.with(-1.0));
220+
.with_flex_child(Button::new("CENTRAL OUT").on_click(|ctx, data: &mut FractalData, _env| {
221+
ctx.submit_command(MULTIPLY_PATTERN.with(1.0 - 1.0 / (1.0 - data.root_zoom_factor)));
222222
}).expand_width().fix_height(24.0), 1.0)
223223
.with_spacer(4.0)
224-
.with_flex_child(Button::new("CENTRAL IN").on_click(|ctx, _data: &mut FractalData, _env| {
225-
ctx.submit_command(MULTIPLY_PATTERN.with(0.5));
224+
.with_flex_child(Button::new("CENTRAL IN").on_click(|ctx, data: &mut FractalData, _env| {
225+
ctx.submit_command(MULTIPLY_PATTERN.with(data.root_zoom_factor));
226226
}).expand_width().fix_height(24.0), 1.0));
227227

228228
let group_palette = Flex::column()

src/widgets/fractal.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,7 @@ impl<'a> Widget<FractalData> for FractalWidget<'a> {
383383

384384
if let Some(root_zoom) = command.get(ROOT_FINDING_COMPLETE) {
385385
self.mouse_mode = MouseMode::None;
386+
self.pos1 = self.pos2;
386387

387388
data.root_progress = 1.0;
388389
data.root_iteration = 64;
@@ -756,16 +757,18 @@ impl<'a> Widget<FractalData> for FractalWidget<'a> {
756757
if let Some(factor) = command.get(MULTIPLY_PATTERN) {
757758
let new_zoom = linear_interpolation_between_zoom(renderer.zoom, string_to_extended(&data.root_zoom), *factor);
758759

759-
renderer.zoom = new_zoom;
760+
if new_zoom.exponent > -1 {
761+
renderer.zoom = new_zoom;
760762

761-
data.zoom = extended_to_string_long(renderer.zoom);
762-
settings.set("zoom", data.zoom.clone()).unwrap();
763-
764-
if string_to_extended(&data.zoom) > string_to_extended(&data.center_reference_zoom) {
765-
data.need_full_rerender = true;
766-
};
763+
data.zoom = extended_to_string_long(renderer.zoom);
764+
settings.set("zoom", data.zoom.clone()).unwrap();
767765

768-
ctx.submit_command(RESET_RENDERER_FAST);
766+
if string_to_extended(&data.zoom) > string_to_extended(&data.center_reference_zoom) {
767+
data.need_full_rerender = true;
768+
};
769+
770+
ctx.submit_command(RESET_RENDERER_FAST);
771+
}
769772

770773
return;
771774
}

0 commit comments

Comments
 (0)