mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Graphic set preview icons can now be specified
This commit is contained in:
@@ -175,7 +175,7 @@ export default class Tilorswift
|
||||
{
|
||||
this.tileset = new Tileset(tilesetIndex);
|
||||
this.level.terrain = new Terrain(this.tileset, tilesX, tilesY, GraphicSet[tilesetIndex].backgroundColor);
|
||||
|
||||
this.level.setGravity(GraphicSet[tilesetIndex].gravity);
|
||||
document.body.style.backgroundColor = this.level.getBackgroundColor();
|
||||
|
||||
if (GraphicSet[tilesetIndex].backgroundImage !== null) {
|
||||
|
||||
@@ -100,7 +100,12 @@ export default class Dialog
|
||||
|
||||
let htmlThumbnail = document.createElement('div');
|
||||
htmlThumbnail.classList.add('tileset-thumbnail');
|
||||
htmlThumbnail.style.backgroundImage = 'url("../' + Setting.TILESET_LOCATION + graphicSet.tileset + '")';
|
||||
|
||||
const image = new Image();
|
||||
image.src = '../' + Setting.TILESET_LOCATION + graphicSet.tileset;
|
||||
|
||||
htmlThumbnail.style.backgroundImage = 'url(' + image.src + ')';
|
||||
htmlThumbnail.style.backgroundPositionX = -(image.width / graphicSet.tiles) * graphicSet.tilePreview + 'px';
|
||||
htmlTilesetElement.appendChild(htmlThumbnail);
|
||||
|
||||
let htmlTitleElement = document.createElement('div');
|
||||
@@ -112,7 +117,9 @@ export default class Dialog
|
||||
'click',
|
||||
() => {
|
||||
htmlListElement.style.display = 'none';
|
||||
htmlAvatarElement.style.backgroundImage = 'url("../' + Setting.TILESET_LOCATION + GraphicSet[index].tileset + '")';
|
||||
htmlAvatarElement.style.backgroundImage = 'url(' + image.src + ')';
|
||||
htmlAvatarElement.style.backgroundPositionX = -96 * graphicSet.tilePreview + 'px';
|
||||
|
||||
window.dispatchEvent(new TilorswiftTilesetSelectedEvent(index));
|
||||
}
|
||||
);
|
||||
|
||||
@@ -294,7 +294,7 @@ input[type="file"] {
|
||||
}
|
||||
|
||||
.tileset-thumbnail {
|
||||
display: table-cell;
|
||||
display: block;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
background-size: auto 100%;
|
||||
|
||||
Reference in New Issue
Block a user