-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
150 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,56 @@ | ||
import { TimeGraphComponent, TimeGraphElementPosition } from "./time-graph-component"; | ||
import { TimeGraphComponent, TimeGraphElementPosition, TimeGraphComponentOptions } from "./time-graph-component"; | ||
|
||
export interface TimeGraphArrowCoordinates { | ||
export interface TimeGraphArrowCoordinates extends TimeGraphComponentOptions { | ||
start: TimeGraphElementPosition | ||
end: TimeGraphElementPosition | ||
} | ||
|
||
export class TimeGraphArrowComponent extends TimeGraphComponent { | ||
|
||
constructor(id: string, protected coords: TimeGraphArrowCoordinates) { | ||
protected head: PIXI.Graphics; | ||
|
||
constructor(id: string, protected _options: TimeGraphArrowCoordinates) { | ||
super(id); | ||
|
||
this.head = new PIXI.Graphics(); | ||
} | ||
|
||
render(): void { | ||
const { start, end } = this.coords; | ||
const { start, end } = this._options as TimeGraphArrowCoordinates; | ||
this._displayObject.lineStyle(1, 0x000000); | ||
this._displayObject.moveTo(start.x, start.y); | ||
this._displayObject.lineTo(end.x, end.y); | ||
} | ||
} | ||
|
||
export class TimeGraphArrowHead extends TimeGraphComponent { | ||
|
||
constructor(id: string, protected coords: TimeGraphArrowCoordinates) { | ||
super(id); | ||
} | ||
|
||
render(): void { | ||
const { end, start } = this.coords; | ||
this._displayObject.beginFill(0x000000); | ||
this._displayObject.drawPolygon([ | ||
// const edge = Math.sqrt((8*8)+(2*2)); | ||
// const cos_a = Math.cos(Math.atan2(end.y - start.y, end.x - start.x) + Math.atan2(2, 8)); | ||
// const cos_b = Math.cos(Math.atan2(end.y - start.y, end.x - start.x) - Math.atan2(2, 8)); | ||
// const xa = edge * cos_a; | ||
// const ya = Math.sqrt((edge*edge) - (xa*xa)); | ||
// const xb = edge * cos_b; | ||
// const yb = Math.sqrt((edge*edge) - (xb*xb)); | ||
|
||
// this._displayObject.beginFill(0x000000); | ||
// this._displayObject.drawPolygon([ | ||
// end.x, end.y, | ||
// end.x - xa, end.y - ya, | ||
// end.x - xb, end.y + yb, | ||
// end.x, end.y | ||
// ]); | ||
// this._displayObject.endFill(); | ||
|
||
this.head.clear(); | ||
this.head.beginFill(0x000000); | ||
this.head.drawPolygon([ | ||
end.x, end.y, | ||
end.x - 10, end.y - 4, | ||
end.x - 10, end.y + 4, | ||
end.x - 7, end.y - 3, | ||
end.x - 7, end.y + 3, | ||
end.x, end.y | ||
]); | ||
this._displayObject.endFill(); | ||
this._displayObject.position.x = end.x; | ||
this._displayObject.position.y = end.y; | ||
this._displayObject.pivot = new PIXI.Point(end.x, end.y); | ||
|
||
this._displayObject.rotation = Math.atan2(end.y - start.y, end.x - start.x); | ||
this.head.endFill(); | ||
this.head.position.x = end.x; | ||
this.head.position.y = end.y; | ||
this.head.pivot = new PIXI.Point(end.x, end.y); | ||
this.head.rotation = Math.atan2(end.y - start.y, end.x - start.x); | ||
this._displayObject.addChild(this.head); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
timeline-chart/src/layer/time-graph-chart-element-selection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { TimeGraphChartLayer } from "./time-graph-chart-layer"; | ||
|
||
export class TimeGraphChartElementSelection extends TimeGraphChartLayer { | ||
|
||
setSelection(){ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters