From b89a7ee8b956c96a1dcee995ea840feddc5d4b27 Mon Sep 17 00:00:00 2001 From: Pierre Frisch Date: Thu, 22 Dec 2011 07:25:50 -0800 Subject: First commit of Ninja to ninja-internal Signed-off-by: Valerio Virgillito --- js/controllers/elements/canvas-controller.js | 37 ++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/controllers/elements/canvas-controller.js (limited to 'js/controllers/elements/canvas-controller.js') 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 @@ +/* +This file contains proprietary software owned by Motorola Mobility, Inc.
+No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.
+(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved. +
*/ + +var Montage = require("montage/core/core").Montage, + ElementController = require("js/controllers/elements/element-controller").ElementController; + +exports.CanvasController = Montage.create(ElementController, { + + getProperty: { + value: function(el, prop) { + switch(prop) { + case "height": + case "width": + return el.getAttribute(prop); + break; + default: + return ElementController.getProperty(el, prop); + } + } + }, + + setProperty: { + value: function(el, p, value) { + switch(p) { + case "height": + case "width": + el.setAttribute(p, parseInt(value)); + break; + default: + ElementController.setProperty(el, p, value); + } + } + } +}); \ No newline at end of file -- cgit v1.2.3