瀏覽代碼

Respect z-order when rendering to the canvas

tags/v0.1.0
Fen Dweller 5 年之前
父節點
當前提交
fe160efc19
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. +5
    -1
      macrovision.js

+ 5
- 1
macrovision.js 查看文件

@@ -2278,7 +2278,11 @@ function importScene(data) {

function renderToCanvas() {
const ctx = document.querySelector("#display").getContext("2d");
Object.entries(entities).forEach(([id, entity]) => {
Object.entries(entities).sort((ent1, ent2) => {
z1 = document.querySelector("#entity-" + ent1[0]).style.zIndex;
z2 = document.querySelector("#entity-" + ent2[0]).style.zIndex;
return z1 - z2;
}).forEach(([id, entity]) => {
element = document.querySelector("#entity-" + id);
img = element.querySelector("img");



Loading…
取消
儲存