Skip to content

Commit

Permalink
added box for pdf printing
Browse files Browse the repository at this point in the history
  • Loading branch information
limefrogyank committed Oct 2, 2024
1 parent 530bbe9 commit c68c809
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions Macros/parserLewisStructureTool.pl
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,17 @@ sub ans_rule {
my $out = main::NAMED_HIDDEN_ANS_RULE( $self->ANS_NAME );
my $inputs = $self->getPG('$inputs_ref');
my $ans_name = $self->ANS_NAME;
my $answer_value = $main::envir{inputs_ref}{ $self->ANS_NAME } // '';

#warn %$inputs;
# warn %$inputs;

if ( $main::displayMode eq 'TeX' ) {
return &{ $self->{printGraph} }
if defined( $self->{printGraph} )
&& ref( $self->{printGraph} ) eq 'CODE';

# ADD CODE HERE TO PRODUCE A BOX FOR DRAWING ON PAPER.
# TO-DO !!!!
# PRODUCE A BOX FOR DRAWING ON PAPER.
return "\\framebox(200,200){}";

}
elsif ( $main::displayMode ne 'PTX' ) {
Expand All @@ -123,6 +124,7 @@ sub ans_rule {
my $showFormalCharges =
$self->{cmpOptions}{showFormalCharges} ? "show-formal-charges" : "";


$out .= <<END_SCRIPT;
<lewis-structure-canvas id='$drawingToolName' $showFormalCharges></lewis-structure-canvas>
<script>
Expand Down Expand Up @@ -159,14 +161,16 @@ sub ans_rule {
flag=true;
}
});
if ('$kekuleOutput'.length > 0){
//console.log(JSON.parse(atob('$kekuleOutput')));
drawingTool.loadKekuleCompressed(JSON.parse(atob('$kekuleOutput')).kekuleMimeCompressed);
if ('$answer_value'.length > 0){
//if (kekuleOutput.value > 0){
//console.log(JSON.parse(atob('$answer_value')));
drawingTool.loadKekuleCompressed(JSON.parse(atob('$answer_value')).kekuleMimeCompressed);
//drawingTool.loadKekuleCompressed(JSON.parse(atob(kekuleOutput.value)).kekuleMimeCompressed);
//console.log('LOADING');
}
};
//window.addEventListener('DOMContentLoaded', initialize${ans_name} );
if (document.readyState === 'loading') {window.addEventListener('DOMContentLoaded', initialize${ans_name} );}
else {initialize${ans_name}();}
</script>
Expand Down

0 comments on commit c68c809

Please sign in to comment.