git @ Cat's Eye Technologies yoob.js / 09cd5c9
Add min/max x/y accessors, and offset to cursors. catseye 12 years ago
1 changed file(s) with 8 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
231231 /*
232232 * Draws the Playfield in a drawing context.
233233 * cellWidth and cellHeight are canvas units of measure for each cell.
234 * offsetX and offsetY are canvas units of measure for the playfield.
234235 */
235236 this.drawContext = function(ctx, offsetX, offsetY, cellWidth, cellHeight) {
236237 var me = this;
240241 });
241242 };
242243
244 this.getMinX = function() { return this.minX; }
245 this.getMaxX = function() { return this.maxX; }
246 this.getMinY = function() { return this.minY; }
247 this.getMaxY = function() { return this.maxY; }
248
243249 this.getExtentX = function() {
244250 if (this.maxX === undefined || this.minX === undefined) {
245251 return 0;
287293 for (var i = 0; i < cursors.length; i++) {
288294 cursors[i].drawContext(
289295 ctx,
290 cursors[i].x * cellWidth, cursors[i].y * cellHeight,
296 offsetX + cursors[i].x * cellWidth,
297 offsetY + cursors[i].y * cellHeight,
291298 cellWidth, cellHeight
292299 );
293300 }