#  Copyright (c) 1997-2018
#  Ewgenij Gawrilow, Michael Joswig (Technische Universitaet Berlin, Germany)
#  http://www.polymake.org
#
#  This program is free software; you can redistribute it and/or modify it
#  under the terms of the GNU General Public License as published by the
#  Free Software Foundation; either version 2, or (at your option) any
#  later version: http://www.gnu.org/licenses/gpl.txt.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#-------------------------------------------------------------------------------

# This file is not included via main.rules but loaded on demand by the jupyter interface.

use feature 'state';

prefer threejs

prefer svg.lattice

$ThreeJS::is_used_in_jupyter=1;

sub ThreeJS::Viewer::new {
   new ThreeJS::File::Writer("-");
}

sub ThreeJS::File::Writer::run : method {
   my ($self)=@_;
   my $html = $self->toString;
   state $id = 0;
   $html =~ s/OUTPUTID/$id/gm;
   $id++;
   print STDOUT '.@@HTML@@', $html, '.@@ENDHTML@@';
}

sub PmSvg::Viewer::new {
   new PmSvg::File::Writer("-");
}

sub PmSvg::File::Writer::run : method {
   my ($self)=@_;
   print STDOUT '.@@HTML@@', $self->toString, '.@@ENDHTML@@';
}

# Local Variables:
# mode: perl
# cperl-indent-level:3
# End:
