Skip to content
Snippets Groups Projects
Commit b31e90f3 authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Merge branch 'operon-struct-type' into operon-struct-type-article

parents d12c3dd7 6b07cb1a
No related branches found
No related tags found
No related merge requests found
Pipeline #129756 waiting for manual action with stages
in 6 minutes and 8 seconds
...@@ -283,21 +283,21 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -283,21 +283,21 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
.join( .join(
enter => { enter => {
const gStructure = enter.append("g") const gStructure = enter.append("g")
.classed("structure", true); .classed("structure", true)
// img group .on("click", function (event) {
gStructure const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data()
.append("image") structureBasket.set(data.map(s => s?.structPath ?? ''))
.on("mouseover", function (event) { }).on("mouseover", function (event) {
const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement) const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement)
const node = srcSelection.data() const node = srcSelection.data()
geneToHighlight.value = node[0].gene geneToHighlight.value = node[0].gene
}) })
.on("mouseout", function (event) { .on("mouseout", function (event) {
geneToHighlight.value = null geneToHighlight.value = null
}) })
// img group
gStructure
.append("image")
return gStructure return gStructure
}, },
update => update, update => update,
...@@ -315,11 +315,7 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -315,11 +315,7 @@ function drawStructure(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
.attr("width", d => d.width) .attr("width", d => d.width)
.attr("height", d => d.height) .attr("height", d => d.height)
.attr("preserveAspectRatio", "xMidYMid meet") .attr("preserveAspectRatio", "xMidYMid meet")
.on("click", function (event) {
const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data()
structureBasket.set(data.map(s => s?.structPath ?? ''))
})
} }
...@@ -369,7 +365,10 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null ...@@ -369,7 +365,10 @@ function drawGenes(operonGroup: d3.Selection<SVGGElement, any, SVGElement | null
update => update, update => update,
exit => exit.remove() exit => exit.remove()
) )
genesSelection.select("g.gene-grp").attr("transform", d => `translate(${d.x}, 0)`) genesSelection
.select("g.gene-grp")
.attr("cursor", d => d.highlight ? "pointer" : null)
.attr("transform", d => `translate(${d.x}, 0)`)
...@@ -408,6 +407,10 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -408,6 +407,10 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
const labelSelection = enter const labelSelection = enter
.append("g") .append("g")
.classed("gene-label", true) .classed("gene-label", true)
.on("click", function (event) {
const data = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(this).data()
structureBasket.set(data.map(s => s?.structPath ?? ''))
})
.on("mouseover", function (event) { .on("mouseover", function (event) {
const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement) const srcSelection = d3.select<SVGElement, StructureOperonGeneWithCoordinate>(event.srcElement)
const node = srcSelection.data() const node = srcSelection.data()
...@@ -429,7 +432,9 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement | ...@@ -429,7 +432,9 @@ function drawGenesLabel(operonGroup: d3.Selection<SVGGElement, any, SVGElement |
exit => exit.remove() exit => exit.remove()
) )
updateSelection.select("text") updateSelection
.attr("cursor", d => d.highlight ? "pointer" : null)
.select("text")
.attr("transform", d => `translate(${d.x + d.width / 2},${d.y}) rotate(40) `) .attr("transform", d => `translate(${d.x + d.width / 2},${d.y}) rotate(40) `)
.attr("style", d => d.highlight ? "font-weight: 700" : null) .attr("style", d => d.highlight ? "font-weight: 700" : null)
.text(d => d.gene) .text(d => d.gene)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment