simview 3.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simview/__init__.py +69 -0
- simview/__main__.py +174 -0
- simview/launcher.py +109 -0
- simview/live.py +204 -0
- simview/merge.py +593 -0
- simview/model.py +690 -0
- simview/py.typed +0 -0
- simview/scene.py +603 -0
- simview/server.py +739 -0
- simview/state.py +190 -0
- simview/static/css/controls.css +36 -0
- simview/static/js/SimView.js +601 -0
- simview/static/js/components/AnimationController.js +654 -0
- simview/static/js/components/BatchManager.js +198 -0
- simview/static/js/components/InteractionController.js +446 -0
- simview/static/js/components/InteractionControls.js +116 -0
- simview/static/js/components/Scene.js +166 -0
- simview/static/js/components/StateStore.js +188 -0
- simview/static/js/config.js +233 -0
- simview/static/js/main.js +3 -0
- simview/static/js/objects/Body.js +616 -0
- simview/static/js/objects/StaticObject.js +181 -0
- simview/static/js/objects/Terrain.js +514 -0
- simview/static/js/objects/utils.js +378 -0
- simview/static/js/ui/AnalysisPanel.js +233 -0
- simview/static/js/ui/BatchLegend.js +207 -0
- simview/static/js/ui/BodyStateWindow.js +521 -0
- simview/static/js/ui/Controls.js +586 -0
- simview/static/js/ui/ErrorMetrics.js +664 -0
- simview/static/js/ui/Legend.js +87 -0
- simview/static/js/ui/PlaybackControls.js +314 -0
- simview/static/js/ui/ScalarPlotter.js +575 -0
- simview/static/js/utils/blobCodec.js +73 -0
- simview/static/js/utils/bodyTransforms.js +151 -0
- simview/static/js/utils/csv.js +46 -0
- simview/static/js/utils/errorMath.js +69 -0
- simview/static/js/utils/injectStyles.js +16 -0
- simview/static/js/utils/interpolate.js +65 -0
- simview/static/js/utils/liveFollow.js +17 -0
- simview/static/js/utils/loadRecordingLibs.js +34 -0
- simview/static/js/utils/viewState.js +226 -0
- simview/static/lib/chroma-js-3.1.2/index.min.js +8 -0
- simview/static/lib/chroma-js-3.1.2/src/Color.js +49 -0
- simview/static/lib/chroma-js-3.1.2/src/chroma.js +10 -0
- simview/static/lib/chroma-js-3.1.2/src/colors/colorbrewer.js +81 -0
- simview/static/lib/chroma-js-3.1.2/src/colors/w3cx11.js +164 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/average.js +88 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/bezier.js +86 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/blend.js +57 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/cubehelix.js +87 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/mix.js +19 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/random.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/generator/scale.js +394 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/_hsx.js +59 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/hcg.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/hsi.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/hsl.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/hsv.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/index.js +1 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/lab.js +19 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/lch.js +13 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/lrgb.js +19 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/num.js +15 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/oklab.js +19 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/oklch.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/interpolator/rgb.js +18 -0
- simview/static/lib/chroma-js-3.1.2/src/io/cmyk/cmyk2rgb.js +16 -0
- simview/static/lib/chroma-js-3.1.2/src/io/cmyk/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/cmyk/rgb2cmyk.js +17 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/css2rgb.js +238 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/hsl2css.js +26 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/lab2css.js +24 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/lch2css.js +24 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/oklab2css.js +16 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/oklch2css.js +16 -0
- simview/static/lib/chroma-js-3.1.2/src/io/css/rgb2css.js +61 -0
- simview/static/lib/chroma-js-3.1.2/src/io/gl/index.js +22 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hcg/hcg2rgb.js +55 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hcg/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hcg/rgb2hcg.js +23 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hex/hex2rgb.js +56 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hex/index.js +29 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hex/rgb2hex.js +29 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsi/hsi2rgb.js +45 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsi/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsi/rgb2hsi.js +31 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsl/hsl2rgb.js +35 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsl/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsl/rgb2hsl.js +45 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsv/hsv2rgb.js +47 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsv/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/hsv/rgb2hsv.js +32 -0
- simview/static/lib/chroma-js-3.1.2/src/io/input.js +4 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lab/index.js +28 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lab/lab-constants.js +120 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lab/lab2rgb.js +101 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lab/rgb2lab.js +67 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lch/hcl2rgb.js +9 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lch/index.js +35 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lch/lab2lch.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lch/lch2lab.js +18 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lch/lch2rgb.js +13 -0
- simview/static/lib/chroma-js-3.1.2/src/io/lch/rgb2lch.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/io/named/index.js +30 -0
- simview/static/lib/chroma-js-3.1.2/src/io/num/index.js +32 -0
- simview/static/lib/chroma-js-3.1.2/src/io/num/num2rgb.js +13 -0
- simview/static/lib/chroma-js-3.1.2/src/io/num/rgb2num.js +8 -0
- simview/static/lib/chroma-js-3.1.2/src/io/oklab/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/oklab/oklab2rgb.js +34 -0
- simview/static/lib/chroma-js-3.1.2/src/io/oklab/rgb2oklab.js +37 -0
- simview/static/lib/chroma-js-3.1.2/src/io/oklch/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/io/oklch/oklch2rgb.js +13 -0
- simview/static/lib/chroma-js-3.1.2/src/io/oklch/rgb2oklch.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/io/rgb/index.js +44 -0
- simview/static/lib/chroma-js-3.1.2/src/io/temp/index.js +22 -0
- simview/static/lib/chroma-js-3.1.2/src/io/temp/rgb2temperature.js +30 -0
- simview/static/lib/chroma-js-3.1.2/src/io/temp/temperature2rgb.js +39 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/alpha.js +13 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/clipped.js +5 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/darken.js +17 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/get.js +13 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/luminance.js +54 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/mix.js +10 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/premultiply.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/saturate.js +15 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/set.js +43 -0
- simview/static/lib/chroma-js-3.1.2/src/ops/shade.js +11 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/analyze.js +191 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/clip_rgb.js +15 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/contrast.js +12 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/contrastAPCA.js +68 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/delta-e.js +62 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/distance.js +17 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/index.js +27 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/last.js +8 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/limit.js +5 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/multiply-matrices.js +36 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/scales.js +15 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/type.js +18 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/unpack.js +17 -0
- simview/static/lib/chroma-js-3.1.2/src/utils/valid.js +11 -0
- simview/static/lib/chroma-js-3.1.2/src/version.js +2 -0
- simview/static/lib/download.js +132 -0
- simview/static/lib/js-colormaps.js +19335 -0
- simview/static/lib/tar.js +334 -0
- simview/static/lib/three-0.174.0/addons/controls/OrbitControls.js +1556 -0
- simview/static/lib/three-0.174.0/addons/libs/lil-gui.module.min.js +8 -0
- simview/static/lib/three-0.174.0/three.core.js +48830 -0
- simview/static/lib/three-0.174.0/three.module.js +17313 -0
- simview/static/lib/uPlot.esm.js +6140 -0
- simview/static/lib/uPlot.min.css +2 -0
- simview/static/textures/contacts/red-cross0.png +0 -0
- simview/static/textures/points/ball0.png +0 -0
- simview/static/textures/points/ball1.png +0 -0
- simview/templates/index.html +81 -0
- simview/utils.py +41 -0
- simview-3.2.dist-info/METADATA +552 -0
- simview-3.2.dist-info/RECORD +163 -0
- simview-3.2.dist-info/WHEEL +5 -0
- simview-3.2.dist-info/entry_points.txt +2 -0
- simview-3.2.dist-info/licenses/LICENSE +28 -0
- simview-3.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { injectStyles } from "../utils/injectStyles.js";
|
|
2
|
+
|
|
3
|
+
// Bottom-right, toggleable panel listing every batch's color swatch and name.
|
|
4
|
+
// Doubles as a batch picker (click a row to focus it) and a renaming UI (click
|
|
5
|
+
// the name to edit it in place); renames are persisted server-side via
|
|
6
|
+
// BatchManager.setBatchName so they survive a reload.
|
|
7
|
+
export class BatchLegend {
|
|
8
|
+
static styleId = "batch-legend-styles";
|
|
9
|
+
|
|
10
|
+
constructor(app) {
|
|
11
|
+
this.app = app;
|
|
12
|
+
this.isExpanded = true;
|
|
13
|
+
this.rowElements = new Map();
|
|
14
|
+
|
|
15
|
+
this._injectStyles();
|
|
16
|
+
this._setupHTML();
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
_injectStyles() {
|
|
20
|
+
const css = `
|
|
21
|
+
.batch-legend-container {
|
|
22
|
+
width: 220px;
|
|
23
|
+
position: fixed;
|
|
24
|
+
bottom: 1rem;
|
|
25
|
+
right: 1rem;
|
|
26
|
+
background-color: rgba(0, 0, 0, 0.75);
|
|
27
|
+
color: white;
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
font-family: Arial, sans-serif;
|
|
30
|
+
font-size: 12px;
|
|
31
|
+
z-index: 1000;
|
|
32
|
+
}
|
|
33
|
+
.batch-legend-header {
|
|
34
|
+
display: flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
padding: 8px 10px;
|
|
37
|
+
cursor: pointer;
|
|
38
|
+
font-weight: bold;
|
|
39
|
+
font-size: 1.1em;
|
|
40
|
+
}
|
|
41
|
+
.batch-legend-header:hover {
|
|
42
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
43
|
+
}
|
|
44
|
+
.batch-legend-header-icon {
|
|
45
|
+
padding-right: 0.4rem;
|
|
46
|
+
color: #ccc;
|
|
47
|
+
}
|
|
48
|
+
.batch-legend-content {
|
|
49
|
+
display: none;
|
|
50
|
+
padding: 0 8px 8px 8px;
|
|
51
|
+
border-top: 1px solid rgba(255, 255, 255, 0.5);
|
|
52
|
+
max-height: 30vh;
|
|
53
|
+
overflow-y: auto;
|
|
54
|
+
}
|
|
55
|
+
.batch-legend-content.visible {
|
|
56
|
+
display: block;
|
|
57
|
+
}
|
|
58
|
+
.batch-legend-row {
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: 8px;
|
|
62
|
+
padding: 5px 4px;
|
|
63
|
+
margin-top: 4px;
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}
|
|
67
|
+
.batch-legend-row:hover {
|
|
68
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
69
|
+
}
|
|
70
|
+
.batch-legend-row.active {
|
|
71
|
+
background-color: rgba(255, 255, 255, 0.18);
|
|
72
|
+
outline: 1px solid rgba(255, 255, 255, 0.6);
|
|
73
|
+
}
|
|
74
|
+
.batch-legend-swatch {
|
|
75
|
+
width: 12px;
|
|
76
|
+
height: 12px;
|
|
77
|
+
border-radius: 50%;
|
|
78
|
+
flex: none;
|
|
79
|
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
80
|
+
}
|
|
81
|
+
.batch-legend-index {
|
|
82
|
+
color: #ccc;
|
|
83
|
+
flex: none;
|
|
84
|
+
}
|
|
85
|
+
.batch-legend-name {
|
|
86
|
+
flex: 1;
|
|
87
|
+
min-width: 0;
|
|
88
|
+
overflow: hidden;
|
|
89
|
+
text-overflow: ellipsis;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
background: transparent;
|
|
92
|
+
border: 1px solid transparent;
|
|
93
|
+
color: white;
|
|
94
|
+
font-family: Arial, sans-serif;
|
|
95
|
+
font-size: 1em;
|
|
96
|
+
padding: 1px 3px;
|
|
97
|
+
border-radius: 3px;
|
|
98
|
+
}
|
|
99
|
+
.batch-legend-name:hover {
|
|
100
|
+
border-color: rgba(255, 255, 255, 0.3);
|
|
101
|
+
}
|
|
102
|
+
.batch-legend-name:focus {
|
|
103
|
+
outline: none;
|
|
104
|
+
border-color: white;
|
|
105
|
+
background-color: rgba(255, 255, 255, 0.1);
|
|
106
|
+
cursor: text;
|
|
107
|
+
}
|
|
108
|
+
`;
|
|
109
|
+
injectStyles(BatchLegend.styleId, css);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
_setupHTML() {
|
|
113
|
+
this.container = document.createElement("div");
|
|
114
|
+
this.container.className = "batch-legend-container";
|
|
115
|
+
|
|
116
|
+
this.header = document.createElement("div");
|
|
117
|
+
this.header.className = "batch-legend-header";
|
|
118
|
+
this.icon = document.createElement("span");
|
|
119
|
+
this.icon.className = "batch-legend-header-icon";
|
|
120
|
+
const title = document.createElement("span");
|
|
121
|
+
title.textContent = "Batches";
|
|
122
|
+
this.header.appendChild(this.icon);
|
|
123
|
+
this.header.appendChild(title);
|
|
124
|
+
this.header.addEventListener("click", () => this._toggleDropdown());
|
|
125
|
+
|
|
126
|
+
this.content = document.createElement("div");
|
|
127
|
+
this.content.className = "batch-legend-content";
|
|
128
|
+
|
|
129
|
+
this._buildRows();
|
|
130
|
+
this._applyExpandedState();
|
|
131
|
+
|
|
132
|
+
this.container.appendChild(this.header);
|
|
133
|
+
this.container.appendChild(this.content);
|
|
134
|
+
document.body.appendChild(this.container);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
_buildRows() {
|
|
138
|
+
this.content.innerHTML = "";
|
|
139
|
+
this.rowElements.clear();
|
|
140
|
+
const { batchManager } = this.app;
|
|
141
|
+
for (let i = 0; i < batchManager.simBatches; i++) {
|
|
142
|
+
const row = document.createElement("div");
|
|
143
|
+
row.className = "batch-legend-row";
|
|
144
|
+
|
|
145
|
+
const swatch = document.createElement("span");
|
|
146
|
+
swatch.className = "batch-legend-swatch";
|
|
147
|
+
const color = batchManager.getColorForBatch(i);
|
|
148
|
+
swatch.style.backgroundColor =
|
|
149
|
+
typeof color === "string" ? color : `#${color.getHexString()}`;
|
|
150
|
+
|
|
151
|
+
const index = document.createElement("span");
|
|
152
|
+
index.className = "batch-legend-index";
|
|
153
|
+
index.textContent = `${i}`;
|
|
154
|
+
|
|
155
|
+
const nameInput = document.createElement("input");
|
|
156
|
+
nameInput.type = "text";
|
|
157
|
+
nameInput.className = "batch-legend-name";
|
|
158
|
+
nameInput.value = batchManager.getBatchName(i);
|
|
159
|
+
nameInput.addEventListener("click", (e) => e.stopPropagation());
|
|
160
|
+
nameInput.addEventListener("keydown", (e) => {
|
|
161
|
+
if (e.key === "Enter") nameInput.blur();
|
|
162
|
+
e.stopPropagation();
|
|
163
|
+
});
|
|
164
|
+
nameInput.addEventListener("change", () => {
|
|
165
|
+
batchManager.setBatchName(i, nameInput.value);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
row.appendChild(swatch);
|
|
169
|
+
row.appendChild(index);
|
|
170
|
+
row.appendChild(nameInput);
|
|
171
|
+
row.addEventListener("click", () => batchManager.setActiveBatch(i));
|
|
172
|
+
|
|
173
|
+
this.content.appendChild(row);
|
|
174
|
+
this.rowElements.set(i, row);
|
|
175
|
+
}
|
|
176
|
+
this.highlightActive();
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
highlightActive() {
|
|
180
|
+
const active = this.app.batchManager.currentlyActiveBatch;
|
|
181
|
+
this.rowElements.forEach((row, i) => {
|
|
182
|
+
row.classList.toggle("active", i === active);
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Re-reads names/colors from BatchManager, e.g. after a rename elsewhere.
|
|
187
|
+
refresh() {
|
|
188
|
+
this._buildRows();
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
_toggleDropdown() {
|
|
192
|
+
this.isExpanded = !this.isExpanded;
|
|
193
|
+
this._applyExpandedState();
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
_applyExpandedState() {
|
|
197
|
+
this.content.classList.toggle("visible", this.isExpanded);
|
|
198
|
+
this.icon.textContent = this.isExpanded ? "▾" : "▸";
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
dispose() {
|
|
202
|
+
if (this.container && this.container.parentElement) {
|
|
203
|
+
this.container.parentElement.removeChild(this.container);
|
|
204
|
+
}
|
|
205
|
+
this.rowElements.clear();
|
|
206
|
+
}
|
|
207
|
+
}
|