component.js | |
---|---|
This modules provides means of creating 2D graphical components. Usage: This module provides the basis for | define([],function(){ |
Responsibilities of Subtypes | var componentPrototype = { |
| draw: function(c){ |
| }, |
| pointDown: function(id, x, y){ |
| }
} |
Public API | return { |
| create: function(){ |
| var bounds = {
x: 0, y: 0, width: 100, height: 100
};
var setBounds = function(x, y, width, height){
bounds.x = x;
bounds.y = y;
bounds.width = width;
bounds.height = height;
};
var component = Object.create(componentPrototype, { |
| bounds: {
get: function(){
return bounds;
}
}, |
| setBounds: {
value: setBounds,
writable: false,
configurable: false
}
});
return component;
}
};
});
|