Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed-up view.FindSidebar #1357

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions source/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@
.sidebar-find-content li { color: #666; height: 22px; padding: 0 12px 0 12px; outline: 0; white-space: nowrap; border-radius: 3px; user-select: none; -webkit-user-select: none; -moz-user-select: none; }
.sidebar-find-content li:hover { background: #e5e5e5; color: #000; }
.sidebar-find-content li>span { font-size: 13px; line-height: 22px; padding-left: 2px; pointer-events: none; }
.sidebar-find-content-icon { stroke: #555; fill: #555; float: left; width: 16px; height: 16px; margin: 3px; }
.sidebar-find-content-icon { font-family: "Netron"; font-size: 16px; color: #555; float: left; margin: 3px; padding: 0px; width:16px; height:16px; }
.sidebar-documentation { flex-grow: 1; padding: 0px 20px 20px 20px; overflow-y: auto; font-size: 13px; line-height: 1.5; margin: 0; }
.sidebar-documentation h1 { font-weight: bold; font-size: 13px; line-height: 1.25; border-bottom: 1px solid #e8e8e8; padding-bottom: 0.3em; margin-top: 0; margin-bottom: 16px; }
.sidebar-documentation h2 { font-weight: bold; font-size: 13px; line-height: 1.25; margin-top: 20px; margin-bottom: 16px; text-transform: uppercase; border: 0; }
Expand Down Expand Up @@ -277,7 +277,7 @@
.sidebar-find-toggle input[type="checkbox"]:checked + svg { fill: #aaa; stroke: #aaa; }
.sidebar-find-content li { color: #aaaaaa; }
.sidebar-find-content li:hover { background: #383838; color: #dfdfdf; }
.sidebar-find-content-icon { stroke: #888888; fill: #888888; }
.sidebar-find-content-icon { color: #888888; }
.sidebar-item-value-expander { color: #888; }
.sidebar-item-value-expander:hover { color: #e5e5e5; }
.sidebar-item-value-button { color: #888; }
Expand All @@ -288,6 +288,10 @@
.menu { transition: none; }
.sidebar { transition: none; }
}
@font-face {
font-family: 'Netron';
src: url('netron.woff') format('woff');
}
</style>
</head>
<body class="welcome spinner">
Expand Down
Binary file added source/netron.woff
Binary file not shown.
7 changes: 7 additions & 0 deletions source/sidebar-icon-connection.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions source/sidebar-icon-node.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions source/sidebar-icon-weight.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 19 additions & 6 deletions source/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -3686,6 +3686,20 @@ view.FindSidebar = class extends view.Control {
connection: { hide: 'Hide Connections', show: 'Show Connections' },
weight: { hide: 'Hide Weights', show: 'Show Weights' }
};
this._lis = [];
const letters = {
weight: "&#xe900",
connection: "&#xe901",
node: "&#xe902"
};
for (const icon of ['weight', 'connection', 'node']) {
const element = this.createElement('li');
const letter = letters[icon];
element.innerHTML = `<label class='sidebar-find-content-icon'>${letter}</label>`;
const text = this.createElement('span');
element.appendChild(text);
this._lis[icon] = element;
}
}

on(event, callback) {
Expand Down Expand Up @@ -3840,13 +3854,10 @@ view.FindSidebar = class extends view.Control {
}

_add(value, content, icon) {
const element = this.createElement('li');
element.innerHTML = `<svg class='sidebar-find-content-icon'><use href="#sidebar-icon-${icon}"></use></svg>`;
const text = this.createElement('span');
text.innerText = content;
element.appendChild(text);
const element = this._lis[icon].cloneNode(true);
element.lastChild.innerText = content;
this._table.set(element, value);
this._content.appendChild(element);
this._df.appendChild(element);
}

_focus(element) {
Expand All @@ -3866,6 +3877,7 @@ view.FindSidebar = class extends view.Control {
_update() {
this._content.innerHTML = '';
try {
this._df = this._host.document.createDocumentFragment();
this._clear();
const inputs = this._signature ? this._signature.inputs : this._graph.inputs;
if (this._state.connection) {
Expand All @@ -3888,6 +3900,7 @@ view.FindSidebar = class extends view.Control {
}
}
}
this._content.appendChild(this._df);
} catch (error) {
this.error(error, false);
}
Expand Down