Skip to content

Commit 56c3f05

Browse files
committed
update
1 parent 1130f37 commit 56c3f05

6 files changed

Lines changed: 100 additions & 26 deletions

File tree

assets/css/main.css

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,4 +1019,18 @@ p, h3, h4, h5, img {
10191019

10201020
background-color: #FFF;
10211021
border: solid 1px #424242;
1022-
}
1022+
}
1023+
1024+
1025+
.dragOver {
1026+
border: 3px dashed red !important;
1027+
background-color: rgba(50,50,50,0.6) !important;
1028+
}
1029+
1030+
1031+
.dropArea {
1032+
border: 3px dashed #000 !important;
1033+
1034+
}
1035+
1036+

assets/js/AllPalettes.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
let allPalettes = []
22

33
let palSources = [
4+
5+
"week15_squares",
6+
"week15_RightSymbol",
7+
"week15_InnerCircle",
8+
"week26_circle",
49
"sudoku_time",
510
"sudoku_level",
611
"sudoku_hint",
712
"sudoku_mistake",
8-
"week26_circle",
9-
"week15_squares",
10-
"week15_RightSymbol",
11-
"week15_InnerCircle",
13+
1214
]
1315

1416
const prevW = 160
@@ -62,7 +64,7 @@ async function initAllPalette() {
6264
for (let j = n - 1; j > -1; j--) {
6365
let b64 = allMarks[MarkNames[j]].source
6466
if (allMarks[MarkNames[j]].source === undefined) {
65-
b64 = allMarks[MarkNames[j]].proto.canvas
67+
b64 = allMarks[MarkNames[j]].proto.canvas
6668
allMarks[MarkNames[j]].source = allMarks[MarkNames[j]].proto.canvas
6769
}
6870

@@ -178,7 +180,7 @@ function openNav() {
178180
}
179181

180182

181-
function appendSingle(palette,name) {
183+
function appendSingle(palette, name) {
182184
const container = document.getElementById("AllPaletteCont");
183185

184186

@@ -188,7 +190,7 @@ function appendSingle(palette,name) {
188190

189191
let tdiv = document.createElement("div");
190192
tdiv.className = "allPaletteRow";
191-
tdiv.setAttribute("number", palSources.length-1)
193+
tdiv.setAttribute("number", palSources.length - 1)
192194
tdiv.setAttribute("name", name)
193195

194196
let canContainer = document.createElement("div");

assets/js/datasetStuff.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,39 @@
1-
let dataList = ["week26.csv", "pinguins.csv"]
1+
let dataList = ["week15.csv", "week26.csv", "pinguins.csv"]
2+
3+
4+
Array.prototype.sample = function(){
5+
return this[Math.floor(Math.random()*this.length)];
6+
}
7+
8+
9+
10+
function fakeWeek15() {
11+
12+
let dataProfile = {
13+
"topics": ["work", "dear-data", "looks", "personality", "specific"],
14+
"who": ["boyfriend", "stefanie", "friend", "acquaintance", "coworker","family","stranger"],
15+
"medium": ["twitter", "email", "text", "real-life", "phone"],
16+
"compliment": ["gave", "received"]
17+
}
18+
19+
let n = 87
20+
21+
let tkeys = Object.keys(dataProfile)
22+
23+
const dataset = []
24+
25+
for (let i = 0; i < n; i++) {
26+
27+
let t = {}
28+
for (let j = 0; j < tkeys.length; j++) {
29+
t[tkeys[j]] = dataProfile[tkeys[j]].sample()
30+
31+
}
32+
dataset.push(t)
33+
}
34+
35+
return dataset
36+
}
237

338
function fillSidePanel() {
439

assets/js/dragStuff.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function dragElement(elmnt) {
1111
var pos1 = 0, pos2 = 0, pos3 = 0, pos4 = 0;
1212

1313
elmnt.onmousedown = dragMouseDown;
14-
14+
let tsvg = document.getElementById("composition");
1515
function dragMouseDown(e) {
1616
e = e || window.event;
1717
e.preventDefault();
@@ -23,6 +23,8 @@ function dragElement(elmnt) {
2323
}
2424

2525

26+
27+
2628
const rect = elmnt.getBoundingClientRect();
2729

2830
offsetX = e.clientX - rect.left;
@@ -34,6 +36,7 @@ function dragElement(elmnt) {
3436
document.onmouseup = closeDragElement;
3537
// call a function whenever the cursor moves:
3638
document.onmousemove = elementDrag;
39+
tsvg.classList.add("dropArea")
3740
}
3841

3942
function elementDrag(e) {
@@ -48,15 +51,21 @@ function dragElement(elmnt) {
4851
// set the element's new position:
4952
elmnt.style.position = "absolute";
5053

54+
document.body.style.cursor = "grabbing";
5155

5256
elmnt.style.left =
5357
(e.pageX - offsetX) + "px";
5458

5559
elmnt.style.top =
5660
(e.pageY - offsetY + 50) + "px";
5761

58-
// elmnt.style.top = (elmnt.offsetTop - pos2) + "px";
59-
// elmnt.style.left = (elmnt.offsetLeft - pos1) + "px";
62+
if (e.target === tsvg) {
63+
tsvg.classList.add("dragOver")
64+
tsvg.classList.remove("dropArea")
65+
} else {
66+
tsvg.classList.remove("dragOver")
67+
tsvg.classList.add("dropArea")
68+
}
6069

6170
}
6271

@@ -69,6 +78,12 @@ function dragElement(elmnt) {
6978
document.onmousemove = null;
7079
dragging = false
7180

81+
document.body.style.cursor = "";
82+
83+
84+
tsvg.classList.remove("dragOver")
85+
tsvg.classList.remove("dropArea")
86+
7287
if (dragMode === "canvas") {
7388
dropCanvas(e, elmnt)
7489
} else {

assets/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async function init() {
168168
// await loadDataset("assets/tempData/datasets/penguins.csv")
169169
// await loadDataset("assets/tempData/datasets/week26.csv")
170170

171-
chartDataset.data = fakeWeek26()
171+
chartDataset.data = fakeWeek15()
172172
// drawSvg()
173173
// tdrawRefactor()
174174
fillSidePanel()

index.html

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,8 @@ <h3 style="display: inline;font-weight:700;margin-left:10px;color: #eeeeee">Desc
185185
<div id="selFlat"></div>
186186

187187
<div style="display: flex;">
188-
<div id="inVisHolder" style="width: calc(100% - 35px);position: relative;background-color:#fff;">
188+
<div id="inVisHolder"
189+
style="width: calc(100% - 35px);position: relative;background-color:#fff;max-height: 80vh;">
189190

190191
<canvas id="inVis"
191192
style="width: 100%;height: 100%;border-radius: 5px;border: solid 1px #555;"></canvas>
@@ -236,11 +237,11 @@ <h3 style="display: inline;font-weight:700;margin-left:10px;color: #eeeeee">Desc
236237
<div style="" class="sideContent">
237238
<div>
238239
<p style="margin: 0;font-size:16pt;font-weight: 600;"> Dataset</p>
239-
<select id="availableData"> </select>
240-
<button onclick="">Import CSV</button>
240+
<!-- <select id="availableData"> </select>-->
241+
<!-- <button onclick="">Import CSV</button>-->
241242
<h5>Data Columns</h5>
242243

243-
<div id="datasetInfo" style="border-top: solid 1px #424242"> </div>
244+
<div id="datasetInfo" style="border-top: solid 1px #424242;"></div>
244245
</div>
245246

246247

@@ -253,20 +254,27 @@ <h5>Data Columns</h5>
253254
</div>
254255

255256
<!-- <div id="fakePreview">-->
256-
<!-- <div>
257-
<button style="border: darkred solid 1px" onclick="switchForce()"> Force Layout</button>
258-
<button onclick="switchGrid()"> Grid Layout</button>
257+
<!-- <div>
258+
<button style="border: darkred solid 1px" onclick="switchForce()"> Force Layout</button>
259+
<button onclick="switchGrid()"> Grid Layout</button>
259260
260-
</div>-->
261+
</div>-->
261262
<svg style="background-color:#fff;" id="fakePreviewSvg"></svg>
262263

263-
<div id="datasetContainer" style="width: 100%">
264-
<div id="sandboxControls" style="width: 100%"><h4>Dataset </h4></div>
264+
<div id="datasetContainer"
265+
style="width: 98%; padding: 20px;display: flex;justify-content: space-around;flex-direction: column;">
266+
<div id="sandboxControls" style="width: 100%;display: flex;justify-content: center;">
267+
<h4 style="margin-right: 15px">Dataset </h4>
268+
<select id="availableData" style="margin-right: 15px"> </select>
269+
<button onclick="">Import CSV</button>
265270

266-
<table id="newDataTable">
267-
<!-- <tr> <th>Id</th><th>Category</th><th>x</th><th>y</th></tr>-->
268-
</table>
271+
</div>
269272

273+
<div style="width: 100%;height: 320px;overflow-y: scroll;">
274+
<table id="newDataTable" style="height: 250px;display: table;width: 100%">
275+
<!-- <tr> <th>Id</th><th>Category</th><th>x</th><th>y</th></tr>-->
276+
</table>
277+
</div>
270278
</div>
271279

272280
<!-- </div>-->

0 commit comments

Comments
 (0)