forked from barais/tpWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
38 lines (32 loc) · 1.09 KB
/
main.js
File metadata and controls
38 lines (32 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var canvas = document.getElementById('myCanvas');
var ctx = canvas.getContext('2d');
canvas.width=800;
canvas.height=600;
// Code temporaire pour tester le DnD
/*new DnD(canvas);
ctx.fillStyle = '#F0F0F0'; // set canvas' background color
ctx.fillRect(0, 0, canvas.width, canvas.height); // now fill the canvas*/
/////
// Code temporaire pour tester l'affiche de la vue
/*var rec = new Rectangle(100, 100, 50, 100, 5, '#00CCC0');
rec.paint(ctx);
var ligne = new Line(10, 20, 50, 100, 3, '#00CCC0');
ligne.paint(ctx);
// tester également Dessin.
var draw = new Drawing();
var rec1 = new Rectangle(550, 550, 50, 50, 10, '#ffff80');
var ligne1 = new Line(500, 10, 10, 500, 3, '000080');
var rec2 = new Rectangle(700, 0, 100, 300, 10, '#00cc00');
var ligne2 = new Line(10, 500, 300, 300, 3, '#7a378b');
draw.addForms(rec);
draw.addForms(ligne);
draw.addForms(rec1);
draw.addForms(rec2);
draw.addForms(ligne1);
draw.addForms(ligne2);
draw.paint(ctx);*/
////
// Code final à utiliser pour manipuler Pencil.
var drawing = new Drawing();
var pencil = new Pencil(ctx, drawing, canvas);
drawing.paint(ctx, canvas);