Skip to content

Commit

Permalink
FIXED: zoom in and out in GUI
Browse files Browse the repository at this point in the history
Now room in and out can automatically adjust the size of the canvas
  • Loading branch information
qindapao committed Jul 20, 2023
1 parent 7f6f85e commit f54568f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions lib/App/Asciio/Actions/Unsorted.pm
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ $size = $font_min if $size < $font_min ;

$self->set_font($family, $size);

# resize canvas
if($self->{UI} eq 'GUI')
{
my ($character_width, $character_height) = $self->get_character_size() ;
$self->{widget}->set_size_request($self->{CANVAS_WIDTH} * $character_width, $self->{CANVAS_HEIGHT} * $character_height);
}

$self->invalidate_rendering_cache() ;
$self->update_display() ;
}
Expand Down
2 changes: 1 addition & 1 deletion script/asciio
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ if(defined $asciio_config->{TARGETS}[0])

$window->show_all();

$asciio->{widget}->set_size_request($asciio->{CANVAS_WIDTH}, $asciio->{CANVAS_HEIGHT});
$asciio->{widget}->set_size_request($asciio->{CANVAS_WIDTH} * $character_width, $asciio->{CANVAS_HEIGHT} * $character_height);
$asciio->set_modified_state(0) ;
$asciio->run_script($asciio_config->{SCRIPT}) ;

Expand Down
4 changes: 2 additions & 2 deletions setup/asciio_object/basic.pl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
FONT_MIN => 3,

ZOOM_STEP => 3,
CANVAS_WIDTH => 3000,
CANVAS_HEIGHT => 4000,
CANVAS_WIDTH => 200,
CANVAS_HEIGHT => 150,

USE_MARKUP_MODE => 0,

Expand Down

0 comments on commit f54568f

Please sign in to comment.