Commit 359a809d authored by Remi  PLANEL's avatar Remi PLANEL
Browse files

Remove the drag behaviour

parent 7edde2d5
...@@ -4,18 +4,17 @@ import { arrowShape } from "./gene-shapes"; ...@@ -4,18 +4,17 @@ import { arrowShape } from "./gene-shapes";
import linearGene from "../../layout/linear-gene"; import linearGene from "../../layout/linear-gene";
import { of } from "rxjs"; import { of } from "rxjs";
import { mergeMap } from "rxjs/operators"; import { mergeMap } from "rxjs/operators";
import { drag } from "d3-drag";
type Strand = "+" | "-"; type Strand = "+" | "-";
export interface GeneData { export interface GeneData {
eventHandler?: {
click: ([begin, end]: [number, number]) => void
},
name: string, name: string,
strand: Strand, strand: Strand,
begin: number, begin: number,
end: number, end: number,
gene: string gene: string
eventHandler: {
click: ([begin, end]: [number, number]) => void
}
} }
export interface PositionedGeneData extends GeneData { export interface PositionedGeneData extends GeneData {
position: { position: {
...@@ -28,7 +27,7 @@ export interface PositionedGeneData extends GeneData { ...@@ -28,7 +27,7 @@ export interface PositionedGeneData extends GeneData {
export default function () { export default function () {
function gene( function gene(
_selection: Selection<SVGElement, Array<GeneData>, HTMLElement, any>, _selection: Selection<SVGElement, Array<GeneData>, SVGElement, any>,
xScale: ScaleLinear<number, number>, xScale: ScaleLinear<number, number>,
geneHeight: number = 30, geneHeight: number = 30,
yPosition: number = 60 yPosition: number = 60
...@@ -65,16 +64,13 @@ export default function () { ...@@ -65,16 +64,13 @@ export default function () {
: null : null
) )
.attr("d", d => arrowShape(d, geneHeight)) .attr("d", d => arrowShape(d, geneHeight))
.on("click", d => of(d) .on("click", d => {
.pipe(mergeMap(d => of<[number, number]>([d.begin, d.end]))) if (d.eventHandler) {
.subscribe(d.eventHandler.click) return of(d)
) .pipe(mergeMap(d => of<[number, number]>([d.begin, d.end])))
.call( .subscribe(d.eventHandler.click);
drag().on("start", d => console.log(event)) }
.on("drag", d => console.log(event)) });
.on("end", d => console.log(event))
);
;
}) })
} }
return gene; return gene;
......
Supports Markdown
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