diff options
author | Pierre Frisch | 2011-12-22 07:25:50 -0800 |
---|---|---|
committer | Valerio Virgillito | 2012-01-27 11:18:17 -0800 |
commit | b89a7ee8b956c96a1dcee995ea840feddc5d4b27 (patch) | |
tree | 0f3136ab0ecdbbbed6a83576581af0a53124d6f1 /js/controllers/elements/canvas-controller.js | |
parent | 2401f05d1f4b94d45e4568b81fc73e67b969d980 (diff) | |
download | ninja-b89a7ee8b956c96a1dcee995ea840feddc5d4b27.tar.gz |
First commit of Ninja to ninja-internal
Signed-off-by: Valerio Virgillito <rmwh84@motorola.com>
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 | ||