123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- function widget_base (instance, widget) {
- "use strict";
- widget.Base = instance.Widget.extend({
- size: {
- width: 0,
- height: 0
- },
- position: {
- x: 0,
- y: 0
- },
- init: function (parent, size, position) {
- this._super(parent);
- this.size = size || this.size;
- this.position = position || this.position;
- },
- start: function () {
- console.log('Widget started');
- },
- getSize: function () {
- return this.size;
- },
- getWidth: function () {
- return this.getSize().width;
- },
- getHeight: function () {
- return this.getSize().height;
- },
- getPosition: function () {
- return this.position;
- },
- getPositionX: function () {
- return this.getPosition().x;
- },
- getPositionY: function () {
- return this.getPosition().y;
- },
- setSize: function (width, height) {
- this.size.width = width;
- this.size.height = height;
- },
- setWidth: function (width) {
- this.size.width = width;
- },
- setHeight: function (height) {
- this.size.height = height;
- },
- setPosition: function (x, y) {
- this.position.x = x;
- this.position.y = y;
- },
- setPositionX: function (x) {
- this.position.x = x;
- },
- setPositionY: function (y) {
- this.position.y = y;
- }
- });
- }
|