Skip to content

Commit

Permalink
add hide_pane to fix timing issues when navigating panes; minor refac…
Browse files Browse the repository at this point in the history
…toring in creating and showing panes.
  • Loading branch information
Jeansen committed May 26, 2017
1 parent 6af5555 commit 8dc544a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
alpha-0.5-27
alpha-0.5-29
19 changes: 16 additions & 3 deletions cdmn
Original file line number Diff line number Diff line change
Expand Up @@ -704,12 +704,19 @@ package cdmn::sidebar {
sub show_pane{
my ($s, $title) = (@_);
return if !$s->{visible};
1;
my $data = $s->{panes}{$title};
for (my $j = 1; $j < @$data; $j++) {
$$data[$j]->create("show");
$$data[$j]->show;
}
}

sub hide_pane{
my ($s, $title) = (@_);
return if !$s->{visible};
my $data = $s->{panes}{$title};
for (my $j = 1; $j < @$data; $j++) {
$$data[$j]->hide;
}
$$data[0]->create("show");
}

sub set_pane {
Expand All @@ -723,6 +730,7 @@ package cdmn::sidebar {
sub next_pane {
my $s = shift;
state $i = $s->{active_pane};
$s->hide_pane($s->{order}[$i]);
$i++;
$i = 0 if $i ge scalar @{$s->{order}};
$s->{active_pane} = $i;
Expand All @@ -732,6 +740,7 @@ package cdmn::sidebar {
sub prev_pane {
my $s = shift;
state $i = $s->{active_pane};
$s->hide_pane($s->{order}[$i]);
$i--;
$i = scalar @{$s->{order}} - 1 if $i lt 0;
$s->{active_pane} = $i;
Expand Down Expand Up @@ -805,6 +814,10 @@ package cdmn::sidebar {
caption => "" x $c."" x $f." ".ceil($args->{$_})."%"
);
}
for (my $j = 1; $j < @data; $j++) {
$data[$j]->create();
}
$data[0]->create();
return \@data;
}
}
Expand Down

0 comments on commit 8dc544a

Please sign in to comment.