1 /** |
1 /** |
2 * js/generalView |
2 * js/annotsTimeline |
3 * |
3 * |
4 * generalView basic component |
4 * annotsTimeline basic component |
5 * |
5 * |
6 */ |
6 */ |
7 |
7 |
8 'use strict'; |
8 'use strict'; |
9 |
9 |
10 var PIXI = require('pixi'); |
10 var PIXI = require('pixi'); |
11 var randomColor = require('randomColor'); |
|
12 |
11 |
13 function GeneralView(parentContainer, xInit, yInit, width, height, timeBegin, timeEnd, intervalSize){ |
12 function AnnotsTimeline(parentContainer, xInit, yInit, width, height, timeBegin, timeEnd, intervalSize){ |
14 console.log(width); |
13 |
15 var _this = this; |
14 // var _this = this; |
16 this.container = new PIXI.DisplayObjectContainer(); |
15 this.container = new PIXI.DisplayObjectContainer(); |
17 this.container.position.x = xInit; |
16 this.container.position.x = xInit; |
18 this.container.position.y = yInit; |
17 this.container.position.y = yInit; |
19 this.container.width = width; |
18 this.container.width = width; |
20 this.container.height = height; |
19 this.container.height = height; |
21 parentContainer.addChild(this.container); |
20 parentContainer.addChild(this.container); |
22 |
21 |
23 this.timeBegin = timeBegin; |
22 this.timeBegin = timeBegin; |
24 this.timeEnd = timeEnd; |
23 this.timeEnd = timeEnd; |
25 this.duration = (timeEnd - timeBegin)/1000 |
24 this.duration = (timeEnd - timeBegin)/1000; |
26 this.width = width; |
25 this.width = width; |
27 this.height = height; |
26 this.height = height; |
28 //define interval corresponding to the time of one step |
27 //define interval corresponding to the time of one step |
29 //e.g: 60 for a step of 60 seconds |
28 //e.g: 60 for a step of 60 seconds |
30 this.intervalSize = intervalSize; |
29 this.intervalSize = intervalSize; |
31 // define the step depending the interval we passed and the duration |
30 // define the step depending the interval we passed and the duration |
32 this.intervalDuration = (intervalSize*this.duration/width); |
31 this.intervalDuration = (intervalSize*this.duration/width); |
33 |
32 |
34 //Initialise the list of step |
33 //Initialise the list of step |
35 //each cell will contain the list categories and the number of annotations per categories |
34 //each cell will contain the list categories and the number of annotations per categories |
36 this.cells = [] |
35 this.cells = []; |
37 |
36 |
38 |
37 |
39 // draw temp line to locate the middle of the container |
38 // draw temp line to locate the middle of the container |
40 var graphics = new PIXI.Graphics(); |
39 var graphics = new PIXI.Graphics(); |
41 graphics.beginFill(0x000000); |
40 graphics.beginFill(0x000000); |
60 // }); |
59 // }); |
61 // } else { |
60 // } else { |
62 // if (c) |
61 // if (c) |
63 // } |
62 // } |
64 |
63 |
65 console.log("x : " + x + " | y : " + y); |
64 console.log('x : ' + x + ' | y : ' + y); |
66 |
65 |
67 // We draw the rectangle |
66 // We draw the rectangle |
68 var graphics = new PIXI.Graphics(); |
67 var graphics = new PIXI.Graphics(); |
69 graphics.beginFill(0x536991); |
68 graphics.beginFill(0x536991); |
70 graphics.drawRect(x, y, this.intervalSize, -10); |
69 graphics.drawRect(x, y, this.intervalSize, -10); |