source: main/trunk/model-sites-dev/von-sparql/js/paper/examples/Scripts/Resize.html@ 28914

Last change on this file since 28914 was 28914, checked in by ak19, 10 years ago

Supporting javascript libraries and bespoke code written by Steffan to support the von-sparql user interface

File size: 981 bytes
Line 
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="UTF-8">
5 <title>Resize</title>
6 <link rel="stylesheet" href="../css/style.css">
7 <script type="text/javascript" src="../../dist/paper.js"></script>
8 <script type="text/paperscript" canvas="canvas">
9 var redPath = new Path.Circle({
10 center: view.center,
11 radius: 5,
12 fillColor: 'red'
13 });
14
15 var whitePath = new Path.Circle({
16 center: view.center,
17 radius: 5,
18 fillColor: 'white'
19 });
20
21 var text = new PointText({
22 content: 'Resize your window',
23 justification: 'center',
24 point: view.center
25 });
26
27 function onResize(event) {
28 // Resize the red circle to fill the bounds of the view:
29 redPath.fitBounds(view.bounds, true);
30
31 // Resize the white circle to fit within the bounds of the view:
32 whitePath.fitBounds(view.bounds, false);
33
34 // Move the text to the center of the view:
35 text.position = view.bounds.center;
36 }
37 </script>
38</head>
39<body>
40 <canvas id="canvas" resize></canvas>
41</body>
42</html>
Note: See TracBrowser for help on using the repository browser.