提交 869d5fdc 编写于 作者: J Jason Park

Minor changes

上级 36031b77
...@@ -4,7 +4,7 @@ import path from 'path'; ...@@ -4,7 +4,7 @@ import path from 'path';
const router = express.Router(); const router = express.Router();
const getJsWorker = (req, res, next) => { const getJsWorker = (req, res, next) => {
res.sendFile(path.resolve(__dirname, '..', 'tracers', 'js', 'built', 'index.js')); res.sendFile(path.resolve(__dirname, '..', 'tracers', 'languages', 'js', 'built', 'index.js'));
}; };
const compileJava = (req, res, next) => { const compileJava = (req, res, next) => {
......
Subproject commit 3503c7aaefd8940262cc66db16a20d73a3bc5229 Subproject commit 0a6c45206fae3150ea588dd8b92dfe246a29b194
Subproject commit d3a19f1bc766d54db2398467539f9245f6d3c6e5 Subproject commit bb36f233ba74c31c7506f5d3df74a6ec6716f8a8
...@@ -5,7 +5,7 @@ $color-font: #bbbbbb; ...@@ -5,7 +5,7 @@ $color-font: #bbbbbb;
$color-shadow: rgba(#000000, .2); $color-shadow: rgba(#000000, .2);
$color-overlay: rgba(#ffffff, .1); $color-overlay: rgba(#ffffff, .1);
$color-selected: #2962ff; $color-selected: #2962ff;
$color-notified: #c51162; $color-patched: #c51162;
$color-highlight: #29d; $color-highlight: #29d;
:export { :export {
...@@ -16,6 +16,6 @@ $color-highlight: #29d; ...@@ -16,6 +16,6 @@ $color-highlight: #29d;
colorShadow: $color-shadow; colorShadow: $color-shadow;
colorOverlay: $color-overlay; colorOverlay: $color-overlay;
colorSelected: $color-selected; colorSelected: $color-selected;
colorNotified: $color-notified; colorNotified: $color-patched;
colorHighlight: $color-highlight; colorHighlight: $color-highlight;
} }
\ No newline at end of file
...@@ -21,12 +21,12 @@ class Array1DData extends Array2DData { ...@@ -21,12 +21,12 @@ class Array1DData extends Array2DData {
super.depatch(0, x); super.depatch(0, x);
} }
select(s, e = s) { select(sx, ex = sx) {
super.select(0, s, 0, e); super.select(0, sx, 0, ex);
} }
deselect(s, e = s) { deselect(sx, ex = sx) {
super.deselect(0, s, 0, e); super.deselect(0, sx, 0, ex);
} }
chart(tracerKey) { chart(tracerKey) {
......
...@@ -8,7 +8,7 @@ class Array2DData extends Data { ...@@ -8,7 +8,7 @@ class Array2DData extends Data {
for (const value of array1d) { for (const value of array1d) {
const col = { const col = {
value, value,
notified: false, patched: false,
selected: false, selected: false,
}; };
row.push(col); row.push(col);
...@@ -20,11 +20,11 @@ class Array2DData extends Data { ...@@ -20,11 +20,11 @@ class Array2DData extends Data {
patch(x, y, v = this.data[x][y].value) { patch(x, y, v = this.data[x][y].value) {
this.data[x][y].value = v; this.data[x][y].value = v;
this.data[x][y].notified = true; this.data[x][y].patched = true;
} }
depatch(x, y) { depatch(x, y) {
this.data[x][y].notified = false; this.data[x][y].patched = false;
} }
select(sx, sy, ex = sx, ey = sy) { select(sx, sy, ex = sx, ey = sy) {
......
...@@ -16,11 +16,11 @@ class Data { ...@@ -16,11 +16,11 @@ class Data {
if (this.onRender) this.onRender(); if (this.onRender) this.onRender();
} }
reset() { set() {
this.set();
} }
set() { reset() {
this.set();
} }
delay() { delay() {
......
...@@ -20,14 +20,6 @@ class GraphData extends Data { ...@@ -20,14 +20,6 @@ class GraphData extends Data {
this.logData = null; this.logData = null;
} }
directed(isDirected = true) {
this.isDirected = isDirected;
}
weighted(isWeighted = true) {
this.isWeighted = isWeighted;
}
set(array2d = []) { set(array2d = []) {
this.nodes = []; this.nodes = [];
this.edges = []; this.edges = [];
...@@ -44,6 +36,14 @@ class GraphData extends Data { ...@@ -44,6 +36,14 @@ class GraphData extends Data {
super.set(); super.set();
} }
directed(isDirected = true) {
this.isDirected = isDirected;
}
weighted(isWeighted = true) {
this.isWeighted = isWeighted;
}
addNode(id, weight = null, visitedCount = 0, selectedCount = 0, x = 0, y = 0) { addNode(id, weight = null, visitedCount = 0, selectedCount = 0, x = 0, y = 0) {
if (this.findNode(id)) return; if (this.findNode(id)) return;
this.nodes.push({ id, weight, visitedCount, selectedCount, x, y }); this.nodes.push({ id, weight, visitedCount, selectedCount, x, y });
...@@ -184,14 +184,14 @@ class GraphData extends Data { ...@@ -184,14 +184,14 @@ class GraphData extends Data {
} }
visit(target, source, weight) { visit(target, source, weight) {
this.visitOrLeave(target, source, weight, true); this.visitOrLeave(true, target, source, weight);
} }
leave(target, source, weight) { leave(target, source, weight) {
this.visitOrLeave(target, source, weight, false); this.visitOrLeave(false, target, source, weight);
} }
visitOrLeave(target, source, weight, visit) { visitOrLeave(visit, target, source = null, weight = null) {
const edge = this.findEdge(source, target); const edge = this.findEdge(source, target);
if (edge) edge.visitedCount += visit ? 1 : -1; if (edge) edge.visitedCount += visit ? 1 : -1;
const node = this.findNode(target); const node = this.findNode(target);
...@@ -203,14 +203,14 @@ class GraphData extends Data { ...@@ -203,14 +203,14 @@ class GraphData extends Data {
} }
select(target, source) { select(target, source) {
this.selectOrDeselect(target, source, true); this.selectOrDeselect(true, target, source);
} }
deselect(target, source) { deselect(target, source) {
this.selectOrDeselect(target, source, false); this.selectOrDeselect(false, target, source);
} }
selectOrDeselect(target, source, select) { selectOrDeselect(select, target, source = null) {
const edge = this.findEdge(source, target); const edge = this.findEdge(source, target);
if (edge) edge.selectedCount += select ? 1 : -1; if (edge) edge.selectedCount += select ? 1 : -1;
const node = this.findNode(target); const node = this.findNode(target);
......
...@@ -16,7 +16,7 @@ class Array2DRenderer extends Renderer { ...@@ -16,7 +16,7 @@ class Array2DRenderer extends Renderer {
<tr className={styles.row} key={i}> <tr className={styles.row} key={i}>
{ {
row.map((col, j) => ( row.map((col, j) => (
<td className={classes(styles.col, col.selected && styles.selected, col.notified && styles.notified)} <td className={classes(styles.col, col.selected && styles.selected, col.patched && styles.patched)}
key={j}> key={j}>
<span className={styles.value}>{this.toString(col.value)}</span> <span className={styles.value}>{this.toString(col.value)}</span>
</td> </td>
......
...@@ -28,8 +28,8 @@ ...@@ -28,8 +28,8 @@
background-color: $color-selected; background-color: $color-selected;
} }
&.notified { &.patched {
background-color: $color-notified; background-color: $color-patched;
} }
} }
} }
......
...@@ -10,7 +10,7 @@ class ChartRenderer extends Array1DRenderer { ...@@ -10,7 +10,7 @@ class ChartRenderer extends Array1DRenderer {
const chartData = { const chartData = {
labels: row.map(col => `${col.value}`), labels: row.map(col => `${col.value}`),
datasets: [{ datasets: [{
backgroundColor: row.map(col => col.notified ? styles.colorNotified : col.selected ? styles.colorSelected : styles.colorFont), backgroundColor: row.map(col => col.patched ? styles.colorNotified : col.selected ? styles.colorSelected : styles.colorFont),
data: row.map(col => col.value), data: row.map(col => col.value),
}], }],
}; };
......
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
&.visited { &.visited {
.circle { .circle {
fill: $color-notified; fill: $color-patched;
stroke: $color-notified; stroke: $color-patched;
} }
} }
} }
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
&.visited { &.visited {
.line { .line {
stroke: $color-notified; stroke: $color-patched;
&.directed { &.directed {
marker-end: url(#markerArrowVisited); marker-end: url(#markerArrowVisited);
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
} }
.weight { .weight {
fill: $color-notified; fill: $color-patched;
} }
} }
} }
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
} }
&.visited { &.visited {
fill: $color-notified; fill: $color-patched;
} }
} }
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册