HTML and CSS Reference
In-Depth Information
this.domTiles[y].push(domTile);
}
}
},
_addTile: function(frame) {
var p = this.p;
var div = document.createElement('div');
div.style.width = p.tilew + "px";
div.style.height = p.tileh + "px";
div.style.styleFloat = div.style.cssFloat = 'left';
this._setTile(div,frame);
this.dom.appendChild(div);
return div;
},
_setTile: function(dom,frame) {
var asset = Q.asset(this.sheet().asset);
dom.style.backgroundImage = "url(" + asset.src + ")";
dom.style.backgroundPosition = (-this.sheet().fx(frame)) +"px "
+ (-this.sheet().fy(frame)) + "px";
},
validTile: function(x,y) {
return (y >= 0 && y < this.p.rows) &&
(x >= 0 && x < this.p.cols);
},
get: function(x,y) { return this.validTile(x,y) ?
this.tiles[y][x] : null; },
getDom: function(x,y) { return this.validTile(x,y) ?
this.domTiles[y][x] : null; },
set: function(x,y,frame) {
if(!this.validTile(x,y)) return;
this.tiles[y][x] = frame;
var domTile = this.getDom(x,y);
this._setFile(domTile,frame);
},
show: function(x,y) {
if(!this.validTile(x,y)) return;
if(this.shown[y][x]) return;
this.getDom(x,y).style.visibility = 'visible';
this.shown[y][x] = true;
},
Search WWH ::




Custom Search