diff options
Diffstat (limited to 'js/controllers/elements/canvas-controller.js')
-rw-r--r-- | js/controllers/elements/canvas-controller.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/js/controllers/elements/canvas-controller.js b/js/controllers/elements/canvas-controller.js new file mode 100644 index 00000000..7af7e824 --- /dev/null +++ b/js/controllers/elements/canvas-controller.js | |||
@@ -0,0 +1,37 @@ | |||
1 | /* <copyright> | ||
2 | This file contains proprietary software owned by Motorola Mobility, Inc.<br/> | ||
3 | No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/> | ||
4 | (c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. | ||
5 | </copyright> */ | ||
6 | |||
7 | var Montage = require("montage/core/core").Montage, | ||
8 | ElementController = require("js/controllers/elements/element-controller").ElementController; | ||
9 | |||
10 | exports.CanvasController = Montage.create(ElementController, { | ||
11 | |||
12 | getProperty: { | ||
13 | value: function(el, prop) { | ||
14 | switch(prop) { | ||
15 | case "height": | ||
16 | case "width": | ||
17 | return el.getAttribute(prop); | ||
18 | break; | ||
19 | default: | ||
20 | return ElementController.getProperty(el, prop); | ||
21 | } | ||
22 | } | ||
23 | }, | ||
24 | |||
25 | setProperty: { | ||
26 | value: function(el, p, value) { | ||
27 | switch(p) { | ||
28 | case "height": | ||
29 | case "width": | ||
30 | el.setAttribute(p, parseInt(value)); | ||
31 | break; | ||
32 | default: | ||
33 | ElementController.setProperty(el, p, value); | ||
34 | } | ||
35 | } | ||
36 | } | ||
37 | }); \ No newline at end of file | ||