Skip to content

Commit 39e4972

Browse files
committed
Merge branch 'master' of github.com:theshock/libcanvas
2 parents 1902e12 + 3344a83 commit 39e4972

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

Source/App/Layer.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ provides: App.Layer
2222
...
2323
*/
2424

25+
2526
/** @class App.Layer */
2627
declare( 'LibCanvas.App.Layer', {
2728

@@ -31,12 +32,12 @@ declare( 'LibCanvas.App.Layer', {
3132
intersection: 'auto' // auto|manual|all
3233
}).set(settings);
3334

34-
this.intersection = this.settings.get('intersection');
35-
this.redrawAll = this.intersection === 'all' || this.intersection === 'full';
35+
this.intersection = this.settings.get('intersection');
36+
this.redrawAllMode = this.intersection === 'all' || this.intersection === 'full';
3637

3738
this.app = app;
3839
this.elements = [];
39-
this.redraw = this.redrawAll ? this.elements : [];
40+
this.redraw = this.redrawAllMode ? this.elements : [];
4041
this.clear = [];
4142
this.createDom();
4243
},
@@ -73,6 +74,11 @@ declare( 'LibCanvas.App.Layer', {
7374
return this;
7475
},
7576

77+
redrawAll: function () {
78+
this.elements.invoke('redraw');
79+
return this;
80+
},
81+
7682
/** @private */
7783
tick: function (time) {
7884
if (this.stopped) return this;
@@ -196,7 +202,7 @@ declare( 'LibCanvas.App.Layer', {
196202
if (element.layer == this && !element.redrawRequested) {
197203
this.needUpdate = true;
198204
element.redrawRequested = true;
199-
if (!this.redrawAll) {
205+
if (!this.redrawAllMode) {
200206
this.redraw.push( element );
201207
}
202208
}
@@ -235,4 +241,4 @@ declare( 'LibCanvas.App.Layer', {
235241
}
236242
}
237243

238-
});
244+
});

Source/Context/Context2D.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,16 @@ var Context2D = LibCanvas.declare( 'LibCanvas.Context2D', 'Context2D',
184184
get height() { return this.canvas.height; },
185185
set width (width) { this.canvas.width = width; },
186186
set height(height) { this.canvas.height = height;},
187+
188+
get size () {
189+
return new Size(this.width, this.height);
190+
},
191+
set size (size) {
192+
size = Size.from(size);
193+
this.width = size.width;
194+
this.height = size.height;
195+
},
196+
187197

188198
get shadow () {
189199
return [this.shadowOffsetX, this.shadowOffsetY, this.shadowBlur, this.shadowColor].join( ' ' );
@@ -537,4 +547,4 @@ if (atom.core.isFunction(HTMLCanvasElement.addContext)) {
537547

538548
return Context2D;
539549

540-
}();
550+
}();

0 commit comments

Comments
 (0)