|
33 | 33 | <button onclick="demoLC.trigger('setStrokeWidth', 10)">10px</button> |
34 | 34 | <button onclick="demoLC.trigger('setStrokeWidth', 20)">20px</button> |
35 | 35 | <button onclick="demoLC.trigger('setStrokeWidth', 30)">30px</button> |
| 36 | + <br> |
| 37 | + <button onclick="demoLC.setTool(Pencil)">Pencil</button> |
| 38 | + <button onclick="demoLC.setTool(Line)">Line</button> |
| 39 | + <button onclick="demoLC.setTool(Eraser)">Eraser</button> |
| 40 | + <button onclick="demoLC.setTool(Ellipse)">Ellipse</button> |
| 41 | + <button onclick="demoLC.setTool(Pan)">Pan</button> |
| 42 | + <button onclick="demoLC.setTool(Rectangle)">Rectangle</button> |
| 43 | + <button onclick="demoLC.setTool(SelectShape)">SelectShape</button> |
| 44 | + <button onclick="demoLC.setTool(Text)">Text</button> |
| 45 | + <button onclick="demoLC.setTool(Eyedropper)">Eyedropper</button> |
| 46 | + <button onclick="demoLC.setTool(Polygon)">Polygon</button> |
36 | 47 |
|
37 | 48 | <script src="../dist/bundle.js"></script> |
38 | 49 |
|
39 | 50 | <script type="text/javascript"> |
| 51 | + |
40 | 52 | const LiterallyCanvas = LC.LiterallyCanvas; |
| 53 | + console.log(LC, '=====LiterallyCanvas') |
41 | 54 | const mainDiv = document.querySelector('.literally'); |
42 | 55 | const lc = new LiterallyCanvas(mainDiv, { |
43 | 56 | ...LC.defaultOptions, |
44 | 57 | defaultStrokeWidth: 10, |
45 | 58 | backgroundColor: '#FFF', |
| 59 | + tools:[LC.Pencil,LC.Line,LC.Eraser] |
46 | 60 | }); |
| 61 | + console.log(lc) |
47 | 62 | window.demoLC = lc; |
| 63 | + // Tools |
| 64 | + window.Pencil = new LC.Pencil(lc); |
| 65 | + window.Line = new LC.Line(lc); |
| 66 | + window.Eraser = new LC.Eraser(lc); |
| 67 | + window.Ellipse = new LC.Ellipse(lc); |
| 68 | + window.Pan = new LC.Pan(lc); |
| 69 | + window.Rectangle = new LC.Rectangle(lc); |
| 70 | + window.SelectShape = new LC.SelectShape(lc); |
| 71 | + window.Eyedropper = new LC.Eyedropper(lc); |
| 72 | + window.Text = new LC.Text(lc); |
| 73 | + window.Polygon = new LC.Polygon(lc); |
48 | 74 | </script> |
49 | 75 | </body> |
50 | 76 | </html> |
0 commit comments