Browse Source

UI will now disable Nametable or Bank export if the other surface is selected.

dev
Bryan Miller 5 years ago
parent
commit
86ba5dbf90
3 changed files with 27 additions and 4 deletions
  1. +19
    -0
      app/js/ctrls/CTRLIO.js
  2. +4
    -0
      sass/core.scss
  3. +4
    -4
      views/header_menu.html

+ 19
- 0
app/js/ctrls/CTRLIO.js View File

@@ -3,6 +3,7 @@ import Utils from "/app/js/common/Utils.js";
import JSONSchema from "/app/js/common/JSONSchema.js";
import NESBank from "/app/js/models/NESBank.js";
import NESPalette from "/app/js/models/NESPalette.js";
import NESNameTable from "/app/js/models/NESNameTable.js";
import CTRLPalettesStore from "/app/js/ctrls/CTRLPalettesStore.js";
import CTRLBanksStore from "/app/js/ctrls/CTRLBanksStore.js";
import CTRLNameTablesStore from "/app/js/ctrls/CTRLNameTablesStore.js";
@@ -174,10 +175,28 @@ function HANDLE_LoadProject(e){
}

function HANDLE_SurfChange(surf){
var enableclass = "";
if (surf instanceof NESBank){
SURF = surf;
enableclass = "surf-bank";
} else {
SURF = null;
if (surf instanceof NESNameTable)
enableclass="surf-nametable";
}

var e = document.querySelectorAll(".surf-export");
for (let i=0; i < e.length; i++){
var ea = e[i].querySelector("a");
if (ea){
if (e[i].classList.contains(enableclass)){
e[i].classList.remove("disable-links");
ea.classList.remove("pure-menu-disabled");
} else {
e[i].classList.add("disable-links");
ea.classList.add("pure-menu-disabled");
}
}
}
}


+ 4
- 0
sass/core.scss View File

@@ -33,6 +33,10 @@ body{
display: flex;
}

.disable-links {
pointer-events: none;
}

canvas.canvas-item-selected{
border: 3px solid #FF0000;
}

+ 4
- 4
views/header_menu.html View File

@@ -28,13 +28,13 @@
<li class="pure-menu-item pure-menu-has-children pure-menu-allow-hover">
<a href="#" id="exportchr" class="pure-menu-link">Export</a>
<ul class="pure-menu-children">
<li class="pure-menu-item" emit="modal-open" emit-args='{"cls":".export-chr"}'>
<a href="#" class="pure-menu-link">Bank to CHR</a>
</li>
<li class="pure-menu-item" emit="export-pal-asm">
<a href="#" class="pure-menu-link">Palette to ASM</a>
</li>
<li class="pure-menu-item" emit="modal-open" emit-args='{"cls":".export-nametable"}'>
<li class="surf-export surf-bank pure-menu-item" emit="modal-open" emit-args='{"cls":".export-chr"}'>
<a href="#" class="pure-menu-link">Bank to CHR</a>
</li>
<li class="surf-export surf-nametable pure-menu-item" emit="modal-open" emit-args='{"cls":".export-nametable"}'>
<a href="#" class="pure-menu-link">Nametable to ASM</a>
</li>
</ul>

Loading…
Cancel
Save