-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
190 lines (171 loc) · 7.62 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<!DOCTYPE html>
<html lang="en">
<head>
<title>Bonsai</title>
<meta charset="utf-8" />
<link href="./ui_asset/common.css" rel="stylesheet" type="text/css" />
<link href="./ui_asset/special.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="./ui_asset/uPlot.min.css">
<link rel="icon" href="./favicon.png" type="image/png" />
</head>
<body>
<div id="ui">
<div class="panel panel-h mainpanel-sim">
<section class="w-module module-size-1x">
<h1>TIME</h1>
<div><span>{{age}}</span></div>
</section>
<button v-on:click.exact="onClickPlay" v-on:click.shift="onClickStep" v-if="!playing" class="button-big" title="Start simulation (Shift+Click to simulate 1 step)">
<img src="ui_asset/play_arrow_white_48dp.svg" />
</button>
<button v-on:click="onClickPause" v-if="playing" class="button-big" title="Pause simulation">
<img src="ui_asset/pause_white_48dp.svg" />
</button>
<section class="w-module module-size-2x">
<h1>MATTER</h1>
<div><label>PLANT</label><span>{{numPlants}}</span></div>
<div><label>CELL</label><span>{{numCells}}</span></div>
</section>
<section class="w-module module-size-2x">
<h1>ENERGY</h1>
<div><label>STORED</label><span>{{(storedEnergy / 1000).toFixed(0)}}k</span></div>
</section>
<button class="button-big" v-on:click="onClickToggleChart" v-bind:class="{active: showingChart}" title="Show/hide data history">
<img src="ui_asset/show_chart_white_48dp.svg" />
</button>
<button class="button-big" v-on:click="onClickToggleEnvControl" v-bind:class="{active: showingEnvControl}" title="Show/hide environment control">
<img src="ui_asset/tune_white_48dp.svg" />
</button>
</div>
<div class="panel panel-v subpanel-simdetail" v-show="showingChart">
<div ref="chart"></div>
</div>
<div class="panel panel-h subpanel-envcontrol" v-show="showingEnvControl">
<section class="w-module module-size-2x">
<h1>LIGHT</h1>
<div><label>MULTIPLIER</label><span>{{lightMultiplier.toFixed(2)}}</span></div>
<div><label>INTENSITY</label><span>{{lightIntensity.toFixed(2)}}</span></div>
</section>
<div style="display: flex; flex-direction: row; align-items: center">
<button v-on:click="onClickDecreaseLight" class="button-small" title="Decrease light intensity">
<img src="ui_asset/remove_circle_outline_white_48dp.svg" />
</button>
<button v-on:click="onClickIncreaseLight" class="button-small" title="Increase light intensity">
<img src="ui_asset/add_circle_outline_white_48dp.svg" />
</button>
</div>
</div>
<div class="panel panel-h mainpanel-mode">
<button v-on:click="onClickInspect" class="button-big" v-bind:class="{active: isInspectMode}" title="Inspect plant: click a plant to see its details">
<img src="ui_asset/search_white_48dp.svg" />
</button>
<button v-on:click="onClickAdd" class="button-big" v-bind:class="{active: isAddMode}" title="Add plant: click to insert a plant seed">
<img src="ui_asset/add_circle_outline_white_48dp.svg" />
</button>
</div>
<div class="panel panel-v subpanel-plantdetail" v-show="isInspectMode && plantSelected">
<div class="panel-header">
<h1>PLANT#{{selectedPlant.id}}</h1>
<button class="button-small" v-on:click="onClickKillPlant" title="Remove the plant">
<img src="ui_asset/delete_forever_white_48dp.svg" />
</button>
<button class="button-small" v-on:click="onClickSave" v-if="!selectedPlantGenomeRegistered" title="Save plant genome to inventory">
<img src="ui_asset/favorite_border_white_48dp.svg" />
</button>
<button class="button-small" v-if="selectedPlantGenomeRegistered" title="Genome is already registetered to inventory">
<img src="ui_asset/favorite_white_48dp.svg" />
</button>
</div>
<div style="display:flex">
<section class="w-module module-size-2x">
<h1>STATS</h1>
<div><label>AGE</label><span>{{selectedPlant.age}}</span></div>
<div><label>CELL</label><span>{{selectedPlant.numCells}}</span></div>
</section>
<section class="w-module module-size-2x">
<h1>ENERGY</h1>
<div><label>STORED</label><span>{{selectedPlant.storedEnergy.toFixed(0)}}</span></div>
<div><label>DELTA</label><span>{{selectedPlant.deltaEnergy.toFixed(0)}}</span></div>
</section>
</div>
<div style="display:flex">
<section class="w-module module-size-2x">
<h1>GENOME</h1>
<div><label>GENE</label><span>{{selectedPlant.numGenes}}</span></div>
<div><label>SIZE</label><span>{{selectedPlant.genomeSize}}</span></div>
</section>
<div class="figure" style="overflow-y: scroll; height: 72px; flex-grow: 1">
<div v-for="gene in selectedPlantGenesStyled">
<table class="gene">
<tr><td v-for="elem in gene.when" v-bind:class="{intrinsic: elem.isIntrinsic}">{{elem.seq}}</td></tr>
</table>
<table class="gene">
<tr><td v-for="elem in gene.emit" v-bind:class="{intrinsic: elem.isIntrinsic}">{{elem.seq}}</td></tr>
</table>
</div>
</div>
</div>
<div style="padding-left: 8px">
<h1>CELL SIGNALS</h1>
<div style="overflow-y: scroll; height: 72px">
<table class="signals" >
<tr v-for="cellStat in selectedPlant.cells">
<td v-for="pair in cellStat.entries()">{{pair[0]}}:{{pair[1]}}</td>
</tr>
</table>
</div>
</div>
</div>
<div class="panel panel-v subpanel-inventory" v-show="isAddMode">
<div style="display:flex">
<section class="w-module module-size-2x">
<h1>GENOME</h1>
<div><label>GENE</label><span>{{currentGenomeDetail().geneCount}}</span></div>
<div><label>SIZE</label><span>{{currentGenomeDetail().genomeSize}}</span></div>
</section>
<section class="w-module module-size-2x">
<h1>POPULATION</h1>
<div><label>TOTAL</label><span>{{currentGenomeDetail().popTotal}}</span></div>
<div><label>CURRENT</label><span>{{currentGenomeDetail().popCurrent}}</span></div>
</section>
</div>
{{currentGenome}}
<button class="button-small" v-on:click="onClickCopy" title="Copy genome to clipboard">
<img src="ui_asset/content_copy_white_48dp.svg" />
</button>
<div style="display:flex">
<div v-for="genome in genomeDetailList()" v-on:click="onClickGenome(genome.encoded)">
<section class="w-module module-size-2x" v-bind:class="{active: genome.encoded === currentGenome}">
<div><label>GENOME-SIZE</label><span>{{genome.genomeSize}}</span></div>
<div><label>POP-TOTAL</label><span>{{genome.popTotal}}</span></div>
<div><label>POP-CURRENT</label><span>{{genome.popCurrent}}</span></div>
</section>
</div>
<div>
<section class="w-module module-size-2x">
<button class="button-small" v-on:click="onClickPaste" title="Paste genome from clipboard" style="width: 100%; height: 100%">
<img src="ui_asset/content_paste_white_48dp.svg" />
</button>
</section>
</div>
</div>
</div>
<div class="panel mainpanel-about">
<button v-on:click="onClickAbout" class="button-big">
<img style="filter: grayscale(1.0) brightness(5)" src="ui_asset/logo.svg" />
</button>
</div>
<div class="panel panel-v subpanel-about" v-show="showingAbout">
<pre>{{simInfoText}}</pre>
</div>
</div>
<div id="main"></div>
<script src="script/three.js"></script>
<script src="script/TrackballControls.js"></script>
<script src="script/genome.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.12/vue.min.js"
integrity="sha512-BKbSR+cfyxLdMAsE0naLReFSLg8/pjbgfxHh/k/kUC82Hy7r6HtR5hLhobaln2gcTvzkyyehrdREdjpsQwy2Jw==" crossorigin="anonymous"></script>
<script src="script/uPlot.iife.min.js"></script>
<script src="script/bonsai.js"></script>
</body>
</html>