Skip to content

Commit fe3c1ad

Browse files
committed
New colors + marker on links + svg overlay on samples
1 parent 42eee7b commit fe3c1ad

8 files changed

Lines changed: 156 additions & 49 deletions

File tree

assets/css/main.css

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ body {
109109

110110
#selFlat {
111111
height: 100%;
112-
width: 81%;
112+
width: calc(100% - 32px);
113113
display: block;
114114
/*overflow-x: scroll;*/
115115
overflow-y: hidden;
@@ -795,6 +795,7 @@ li .fakeGrammarRow {
795795
border-radius: 5px;
796796
cursor: grab;
797797
margin-left:42px ;
798+
background-color:#fff;
798799

799800
}
800801

@@ -828,25 +829,25 @@ p, h3, h4, h5, img {
828829
position: absolute;
829830
width: 15px;
830831
background-color: #fff;
831-
left: -2.7vw;
832+
right: -2vw;
832833
/*height: 99.5vh;*/
833834
/*top: 0;*/
834835
height: 34vh;
835836
top: 30%;
836837
z-index: 99;
837838
text-align: center;
838839
padding: 3px;
839-
border-top-right-radius: 25px 25px;
840-
border-bottom-right-radius: 25px 25px;;
841-
border-right: solid 1px #717171;
840+
border-top-left-radius: 25px 25px;
841+
border-bottom-left-radius: 25px 25px;;
842+
border-left: solid 1px #717171;
842843
}
843844

844845

845846
#sideArrow img {
846847
width: 20px;
847848
cursor: pointer;
848849
height: 20px;
849-
margin-top: 7.5px;
850+
margin-top: 7px;
850851
margin-left: -10px;
851852
transition: 1.15s;
852853

@@ -858,10 +859,9 @@ p, h3, h4, h5, img {
858859
width: 32px;
859860
height: 35px;
860861
background-color: inherit;
861-
right: -22px;
862+
left: -22px;
862863
border-radius: 5px;
863864
transition: .5s;
864-
865865
}
866866

867867

@@ -915,4 +915,8 @@ p, h3, h4, h5, img {
915915
border-radius: 10px;
916916
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
917917
padding: 20px;
918+
}
919+
920+
#svgDisplay image{
921+
pointer-events: all;
918922
}

assets/js/AllPalettes.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ function openNav() {
142142
let img = document.getElementById("sideImg");
143143

144144
if (flipSide) {
145-
img.style.transform = "";
145+
img.style.transform = "scaleX(-1)";
146146
container.style.width = `${containerWidth}px`
147147

148148
// containerImg.style.right = `${sideOffset}px`
@@ -155,7 +155,8 @@ function openNav() {
155155
el.style.display = "inline-block";
156156
})
157157
} else {
158-
img.style.transform = "scaleX(-1)";
158+
159+
img.style.transform = "";
159160
container.style.width = `${offsetWidth}px`
160161
containerImg.style.right = "-22px";
161162

assets/js/dragStuff.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ function dropPalette(e, elmnt) {
104104
addPaletteInfoToCollage(allPalettes[num],name)
105105

106106

107+
108+
107109
megaGlyph[name] = {
108110
dataColumn: "",
109111
size: {
@@ -117,6 +119,8 @@ function dropPalette(e, elmnt) {
117119
}
118120
megaGlyph[name].color = makeColorScale(name, "")
119121
makeMarkTree()
122+
123+
displayPalette(name)
120124
}
121125
}
122126

assets/js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ docReady(init)
4646

4747

4848
const dataRef = {
49-
giorgia_36: "assets/images/tempLoad/full.json"
49+
// giorgia_36: "assets/images/tempLoad/full.json"
5050
}
5151

5252

assets/js/newCollage.js

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,45 @@ function placeMark() {
2828

2929
}
3030

31+
function setMarker() {
32+
let svg = d3.select("#composition")
33+
34+
svg.selectAll("defs").remove("*");
35+
36+
let def = svg.append("defs")
37+
38+
let marker = def.append("marker")
39+
.attr("id", "arrow")
40+
.attr("refX", "-0")
41+
.attr("refY", "3.5")
42+
.attr("markerWidth", "7")
43+
.attr("markerHeight", "7")
44+
.attr("orient", "mid")
45+
46+
47+
// marker.append("path")
48+
// .attr("d", "M 0 5 L 8 0 L 8 9 z")
49+
// .attr("stroke-width", 3)
50+
// .attr("stroke", "red")
51+
// .attr("fill", "none")
52+
53+
marker.append("image")
54+
.attr("xlink:href", "assets/images/buttons/side.png")
55+
.attr("x", "0")
56+
.attr("y", "0")
57+
.attr("width", "7")
58+
.attr("height", "7")
59+
}
60+
61+
3162
function addPaletteInfoToCollage(palette, name) {
3263

3364
let svg = d3.select("#composition")
3465

3566
let show = palette.encodings.range.marks["mark0"].proto.canvas
3667

3768
drawnMarks[name] = placeMark()
38-
69+
setMarker()
3970

4071
svg.append("image")
4172
.attr("class", "collageElement")
@@ -96,12 +127,17 @@ function addPaletteInfoToCollage(palette, name) {
96127
const cx = (tFrom.x + tTo.x) / 2;
97128
const curve = 2;
98129

130+
console.log("?????????????????????????????????????????");
131+
99132
svg.append("path")
100133
// .attr("d", `M ${tFrom.x} ${tFrom.y} Q ${cx} ${curve} ${tTo.x} ${tTo.y}`)
101134
.attr("d", makeLink(tFrom.x, tFrom.y, tTo.x, tTo.y))
135+
.attr("marker-end", "url(#arrow)")
102136
.attr("stroke-width", 3)
103137
.attr("stroke", "red")
104138
.attr("fill", "none")
139+
140+
105141
// .attr("stroke", drawnMarks[name].x)
106142

107143
megaPalettes[name].apply = tFrom.name
@@ -159,6 +195,7 @@ function addPaletteInfoToCollage(palette, name) {
159195
.attr("stroke-width", 3)
160196
.attr("stroke", "red")
161197
.attr("fill", "none")
198+
.attr("marker-end", "url(#arrow)")
162199
// .attr("stroke", drawnMarks[name].x)
163200

164201

@@ -189,7 +226,7 @@ function displayPalette(name) {
189226

190227
const val = parseInt(document.getElementById("strokewidth").value);
191228
stWidth = val
192-
console.log("dsdsadas");
229+
193230
}
194231

195232
document.getElementById('strokecolor').onchange = function () {

assets/js/sandbox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ let chartAxis = {
99
const defaultMinColor = "#a50026"
1010
const defaultMaxColor = "#313695"
1111

12-
let useForce = false
12+
let useForce = true
1313
let gridMod = false
1414

1515
const datasetList = ["pinguin"]

assets/js/svgHandler.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,41 @@ function fillSampleBar(marks) {
3636

3737

3838
function fillSvg(marks) {
39-
fillSampleBar(marks)
39+
// fillSampleBar(marks)
40+
41+
let svg = d3.select("#sampleDisplay")
42+
43+
if(marks.length > 0) {
44+
svg.style("background-color","rgba(75,75,75,0.5)")
45+
svg.style("display","block")
46+
}else {
47+
svg.style("display","none")
48+
}
49+
50+
const rect = svg.node().getBoundingClientRect()
51+
52+
const w = rect.width
53+
const h = rect.height
54+
bounds = [w, h]
55+
56+
svg.selectAll("image").remove();
57+
58+
svg.selectAll("dot")
59+
.data(marks)
60+
.enter()
61+
.append("svg:image")
62+
.attr("xlink:href", (d) => d.canvas.toDataURL())
63+
.attr('num', (d, i) => i)
64+
.attr("x", (d) => d.rx * w)
65+
.attr("y", (d) => d.ry * h)
66+
.attr("width", (d) => d.rWidth * w)
67+
.attr("height", (d) => d.rHeight * h)
68+
.on("click", (e) => {
69+
70+
d3.selectAll("image").style("opacity", 1)
71+
const el = e.target
72+
loadModal(sampleData.find((d) => d === el.__data__))
73+
})
4074

4175
/*const tsvg = document.getElementById("inVis")
4276
@@ -49,7 +83,7 @@ function fillSvg(marks) {
4983
svg.style("height", rect.height + "px")
5084
5185
52-
svg.selectAll("image").remove();
86+
5387
5488
const w = rect.width
5589
const h = rect.height

0 commit comments

Comments
 (0)