diff --git a/python/naja_schematic/__init__.py b/python/naja_schematic/__init__.py index ca32f56..23f7619 100644 --- a/python/naja_schematic/__init__.py +++ b/python/naja_schematic/__init__.py @@ -5,7 +5,7 @@ - From a shell: ``naja-schematic --verilog design.v --open`` serves the viewer page and opens it in a browser. """ -__version__ = "0.1.0" +__version__ = "0.1.1" from .protocol import diagnosis_response, handle_request diff --git a/python/naja_schematic/static/widget.js b/python/naja_schematic/static/widget.js index 3330f96..ec0c759 100644 --- a/python/naja_schematic/static/widget.js +++ b/python/naja_schematic/static/widget.js @@ -25,11 +25,17 @@ function render({ model, el }) { injectStyle(); const wrap = document.createElement("div"); wrap.className = "naja-schematic-wrap"; + // Right-click belongs to the viewer (its tree and schematic context menus + // hold Show Equipotential, Trace to Driver, ...). JupyterLab opens its own + // cell menu on top unless the target is inside this attribute. + wrap.setAttribute("data-jp-suppress-context-menu", ""); wrap.style.height = `${model.get("height")}px`; const canvas = document.createElement("canvas"); canvas.className = "naja-schematic-canvas"; canvas.tabIndex = -1; - canvas.addEventListener("contextmenu", (e) => e.preventDefault()); + // Also keep the event from reaching other hosts' menu handlers (classic + // Notebook, VSCode, Colab) and suppress the browser's own menu. + canvas.addEventListener("contextmenu", (e) => { e.preventDefault(); e.stopPropagation(); }); // Keyboard input only goes to the viewer while it has focus. canvas.addEventListener("mousedown", () => canvas.focus()); const status = document.createElement("div"); diff --git a/src/EquipotentialView.cpp b/src/EquipotentialView.cpp index 11364db..0678177 100644 --- a/src/EquipotentialView.cpp +++ b/src/EquipotentialView.cpp @@ -1445,6 +1445,15 @@ void EquipotentialView::renderSchematic(const std::vector& equip } g_schematic.render(dl, cpos, inner); + if (equipotentials.empty()) { + // Nothing drawn yet: the schematic is only ever filled from a pin's + // context menu, which a first-time user has no way to guess. + const char* hint = "Right-click a pin in the Netlist Hierarchy (e.g. top > Terms > a port)\n" + "and choose Show Equipotential or Trace to Driver."; + ImVec2 ts = ImGui::CalcTextSize(hint); + dl->AddText(ImVec2(cpos.x + (inner.x - ts.x) * 0.5f, cpos.y + (inner.y - ts.y) * 0.5f), + IM_COL32(120, 120, 120, 255), hint); + } ImGui::EndChild(); // Scrollbars