mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 14:46:05 +08:00
Improving Zoom by keyboardShortcut
This commit is contained in:
parent
4961b74c3e
commit
75291772ce
@ -332,7 +332,6 @@ sub set_viewport_from_scene {
|
|||||||
|
|
||||||
sub zoom{
|
sub zoom{
|
||||||
my ($self, $direction) = @_;
|
my ($self, $direction) = @_;
|
||||||
print ($direction);
|
|
||||||
if( $direction eq 'in'){
|
if( $direction eq 'in'){
|
||||||
$self->_zoom($self->_zoom / (1-0.3));
|
$self->_zoom($self->_zoom / (1-0.3));
|
||||||
}
|
}
|
||||||
|
@ -183,6 +183,8 @@ sub _init_menubar {
|
|||||||
$self->_append_menu_item($self->{plater_menu}, "Select Prev Object\tCtrl+Left", 'Select Previous Object in the plater', sub {
|
$self->_append_menu_item($self->{plater_menu}, "Select Prev Object\tCtrl+Left", 'Select Previous Object in the plater', sub {
|
||||||
$plater->select_prev;
|
$plater->select_prev;
|
||||||
}, undef, 'arrow_left.png');
|
}, undef, 'arrow_left.png');
|
||||||
|
$self->_append_menu_item($self->{plater_menu}, "Zoom In\tCtrl+up" , 'Zoom In' , sub { $self->{plater}->zoom('in' ); });
|
||||||
|
$self->_append_menu_item($self->{plater_menu}, "Zoom Out\tCtrl+down" , 'Zoom Out' , sub { $self->{plater}->zoom('out' ); });
|
||||||
$self->{plater_menu}->AppendSeparator();
|
$self->{plater_menu}->AppendSeparator();
|
||||||
$self->_append_menu_item($self->{plater_menu}, "Export G-code...", 'Export current plate as G-code', sub {
|
$self->_append_menu_item($self->{plater_menu}, "Export G-code...", 'Export current plate as G-code', sub {
|
||||||
$plater->export_gcode;
|
$plater->export_gcode;
|
||||||
@ -193,8 +195,6 @@ sub _init_menubar {
|
|||||||
$self->_append_menu_item($self->{plater_menu}, "Export plate with modifiers as AMF...", 'Export current plate as AMF, including all modifier meshes', sub {
|
$self->_append_menu_item($self->{plater_menu}, "Export plate with modifiers as AMF...", 'Export current plate as AMF, including all modifier meshes', sub {
|
||||||
$plater->export_amf;
|
$plater->export_amf;
|
||||||
}, undef, 'brick_go.png');
|
}, undef, 'brick_go.png');
|
||||||
$self->_append_menu_item($self->{plater_menu}, "Zoom In\tCtrl+up" , 'Zoom In' , sub { $self->zoom('in' ); });
|
|
||||||
$self->_append_menu_item($self->{plater_menu}, "Zoom Out\tCtrl+down" , 'Zoom Out' , sub { $self->zoom('out' ); });
|
|
||||||
$self->{object_menu} = $self->{plater}->object_menu;
|
$self->{object_menu} = $self->{plater}->object_menu;
|
||||||
$self->on_plater_selection_changed(0);
|
$self->on_plater_selection_changed(0);
|
||||||
}
|
}
|
||||||
@ -632,11 +632,6 @@ sub select_view {
|
|||||||
$self->{plater}->select_view($direction);
|
$self->{plater}->select_view($direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub zoom{
|
|
||||||
my($self, $direction) = @_;
|
|
||||||
$self->{plater}->zoom($direction);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub _append_menu_item {
|
sub _append_menu_item {
|
||||||
my ($self, $menu, $string, $description, $cb, $id, $icon, $kind) = @_;
|
my ($self, $menu, $string, $description, $cb, $id, $icon, $kind) = @_;
|
||||||
|
|
||||||
|
@ -2434,7 +2434,21 @@ sub select_view {
|
|||||||
|
|
||||||
sub zoom{
|
sub zoom{
|
||||||
my ($self, $direction) = @_;
|
my ($self, $direction) = @_;
|
||||||
$self->{canvas3D}->zoom($direction);
|
#Apply Zoom to the current active tab
|
||||||
|
my ($currentSelection) = $self->{preview_notebook}->GetSelection;
|
||||||
|
if($currentSelection == 0){
|
||||||
|
$self->{canvas3D}->zoom($direction) if($self->{canvas3D});
|
||||||
|
}
|
||||||
|
# elsif($currentSelection == 1) { #2D platter should zomobe applied here or not ?
|
||||||
|
# }
|
||||||
|
elsif($currentSelection == 2){ #3d Preview tab
|
||||||
|
$self->{preview3D}->canvas->zoom($direction) if($self->{preview3D});
|
||||||
|
}
|
||||||
|
elsif($currentSelection == 3) { #2D toolpaths tab
|
||||||
|
$self->{toolpaths2D}->{canvas}->zoom($direction) if($self->{toolpaths2D});
|
||||||
|
}
|
||||||
|
else {#Do Nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
package Slic3r::GUI::Plater::DropTarget;
|
package Slic3r::GUI::Plater::DropTarget;
|
||||||
|
@ -217,6 +217,20 @@ sub new {
|
|||||||
return $self;
|
return $self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub zoom{
|
||||||
|
my($self, $direction) = @_;
|
||||||
|
if( $direction eq 'in'){
|
||||||
|
$self->_zoom($self->_zoom / (1+0.3));
|
||||||
|
}
|
||||||
|
elsif($direction eq 'out'){
|
||||||
|
$self->_zoom($self->_zoom / (1-0.3));
|
||||||
|
$self->_zoom(1) if $self->_zoom > 1; # prevent from zooming out too much
|
||||||
|
}
|
||||||
|
#apply changes
|
||||||
|
$self->_dirty(1);
|
||||||
|
$self->Refresh;
|
||||||
|
}
|
||||||
|
|
||||||
sub mouse_event {
|
sub mouse_event {
|
||||||
my ($self, $e) = @_;
|
my ($self, $e) = @_;
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ use warnings;
|
|||||||
BEGIN {
|
BEGIN {
|
||||||
use FindBin;
|
use FindBin;
|
||||||
use lib "$FindBin::Bin/lib";
|
use lib "$FindBin::Bin/lib";
|
||||||
use local::lib '--no-create', "$FindBin::Bin/local-lib";
|
use local::lib "$FindBin::Bin/local-lib";
|
||||||
}
|
}
|
||||||
|
|
||||||
use File::Basename qw(basename);
|
use File::Basename qw(basename);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user