Skip to content

Commit

Permalink
Working on linker and new spec integration.
Browse files Browse the repository at this point in the history
  • Loading branch information
staubibr committed Jun 18, 2021
1 parent 47d56e6 commit e5b3b82
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
17 changes: 10 additions & 7 deletions application.css
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,19 @@ body.Simple button:disabled {
border-color: #7e7e7e;
}

body.Simple button:not(:disabled):hover {
background: #0051A3;
body.Simple :not(.popup) button:not(:disabled):hover {
background: #0a54a2;
transition: all .2s ease;
}

body.Simple button.clear:not(:disabled):hover {
background: #980000;
}

body.Simple .popup button.close:hover {
background:none;
}

body.Simple select,
body.Simple input[type=text],
body.Simple input[type=number] {
Expand Down Expand Up @@ -180,11 +188,6 @@ body.Simple input[type=number] {
width: 29%;
}

.body .clear:hover {
background:#980000;
}


.body .parse {
width: 69%;
margin-top : 10px;
Expand Down
33 changes: 8 additions & 25 deletions application.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import Zip from '../api-web-devs/tools/zip.js';

export default Core.Templatable("Application", class Application extends Templated {

get Settings() { return this.Widget("settings").Settings; }

constructor(node) {
super(node);

Expand All @@ -28,8 +26,6 @@ export default Core.Templatable("Application", class Application extends Templat
this.simulation = null;
this.files = null;

this.popup = new Popup();

this.AddWidget("rise", new Rise());
this.AddWidget("settings", new Settings());

Expand All @@ -45,11 +41,10 @@ export default Core.Templatable("Application", class Application extends Templat
this.Widget("rise").On("error", this.OnWidget_Error.bind(this));
}

OnUpload_Ready(ev) {
OnUpload_Ready(ev) {
this.simulation = ev.simulation;
this.files = ev.files;

this.Configure(ev.configuration, ev.style);
this.settings = ev.configuration;

this.Elem("btnViz").disabled = false;
this.Elem("btnSettings").disabled = false;
Expand All @@ -60,7 +55,7 @@ export default Core.Templatable("Application", class Application extends Templat
this.ShowDropzone(false);
this.ShowView(this.Elem("view"));

this.Widget("playback").Recorder = new Recorder(this.view.Widget.Canvas);
this.Widget("playback").recorder = new Recorder(this.view.widget.canvas);
this.Widget("playback").Initialize(this.simulation, this.settings.playback);
this.Widget('settings').Initialize(this.simulation, this.settings);
}
Expand All @@ -82,15 +77,11 @@ export default Core.Templatable("Application", class Application extends Templat
this.Widget("settings").Show();
}

OnButtonDownload_Click(ev) {
var structure = this.files.find(f => f.name == "structure.json");
var messages = this.files.find(f => f.name == "messages.log");
var diagram = this.files.find(f => f.name == "diagram.svg");
OnButtonDownload_Click(ev) {
var files = [this.files.structure, this.files.messages, this.settings.ToFile()];

var files = [structure, messages, this.settings.ToFile()];
if (this.files.diagram) files.push(this.files.diagram);

if (diagram) files.push(diagram);

Zip.SaveZipStream(this.simulation.name, files);
}

Expand All @@ -105,14 +96,6 @@ export default Core.Templatable("Application", class Application extends Templat
alert (ev.error);
}

Configure(config, style) {
if (config) this.settings = Configuration.FromJson(config);

else this.settings = Configuration.FromSimulation(this.simulation);

if (this.simulation.Type == "Cell-DEVS" && style) this.settings.grid.styles = style;
}

ShowDropzone(visible) {
Dom.ToggleCss(this.Elem("dropzone"), "hidden", !visible);
Dom.ToggleCss(this.Elem("views"), "hidden", visible);
Expand All @@ -121,10 +104,10 @@ export default Core.Templatable("Application", class Application extends Templat
ShowView(container) {
this.Clear();

if (this.simulation.Type == "DEVS") {
if (this.simulation.type == "DEVS") {
this.view = new DiagramAuto(container, this.simulation, this.settings.diagram);
}
else if (this.simulation.Type === "Cell-DEVS") {
else if (this.simulation.type === "Cell-DEVS") {
this.view = new GridAuto(container, this.simulation, this.settings.grid);
}

Expand Down
3 changes: 1 addition & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link rel="stylesheet" href="../api-web-devs/api-web-devs.css">
<link rel="stylesheet" href="application.css">

<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-eOJMYsd53ii+scO/bJGFsiCZc+5NDVN2yr8+0RDqr0Ql0h+rP48ckxlpbzKgwra6" crossorigin="anonymous">
<script src="../api-web-devs/references//zip/zip.js"></script>
<script src="../api-web-devs/references/StreamSaver/StreamSaver.js"></script>
<script src="../api-web-devs/references/StreamSaver/zip-stream.js"></script>
<script src="../api-web-devs/references/iro/[email protected]"></script>
<script src="../api-web-devs/polyfill/promise.min.js"></script>
<script src='main.js' type='module'></script>

<!-- Hotjar Tracking Code for https://staubibr.github.io/web-devs-simple-viewer/ -->
Expand Down

0 comments on commit e5b3b82

Please sign in to comment.