Skip to content

Commit

Permalink
Revert "Add navigation history to subcircuit click event"
Browse files Browse the repository at this point in the history
This reverts commit 001b43c.
  • Loading branch information
malmeloo committed Oct 14, 2023
1 parent 001b43c commit 4ca2d8e
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class Circuit extends HeadlessCircuit {
});
}
displayOn(elem) {
return this._makePaper(elem, this._graph, []);
return this._makePaper(elem, this._graph);
}
scaleAndRefreshPaper(paper, scale) {
paper.scale(Math.pow(1.1, scale));
Expand All @@ -156,9 +156,7 @@ export class Circuit extends HeadlessCircuit {
graph.resetCells(graph.getCells());
paper.unfreeze();
}
_makePaper(elem, graph, navHistory) {
navHistory = navHistory || [];

_makePaper(elem, graph) {
this._engine.observeGraph(graph);
const opts = _.merge({ el: elem, model: graph }, paperOptions);
const paper = new joint.dia.Paper(opts);
Expand Down Expand Up @@ -207,16 +205,14 @@ export class Circuit extends HeadlessCircuit {
// subcircuit display
const circuit = this;
this.listenTo(paper, 'open:subcircuit', (model) => {
const newNavHistory = navHistory.concat(model);

const subcircuitModal = $('<div>', {
title: model.get('celltype') + ' ' + model.get('label')
}).appendTo('html > body');

// Create and set up paper
const pdiv = $('<div>').appendTo(subcircuitModal);
const graph = model.get('graph');
const paper = this._makePaper(pdiv, graph, newNavHistory);
const paper = this._makePaper(pdiv, graph);
paper.once('render:done', () => {
this._windowCallback('Subcircuit', subcircuitModal, () => {
this._engine.unobserveGraph(graph);
Expand All @@ -231,7 +227,7 @@ export class Circuit extends HeadlessCircuit {
for (const button of this._subcircuitButtons) {
$('<button class="btn btn-secondary"></button>')
.append($('<strong></strong>').text(button.buttonText))
.on('click', {circuit, model, paper, navHistory: newNavHistory}, (event) => button.callback(event.data))
.on('click', {circuit, model, paper}, (event) => button.callback(event.data))
.appendTo(buttonGroup);
}
buttonGroup.prependTo(subcircuitModal);
Expand Down

0 comments on commit 4ca2d8e

Please sign in to comment.