|
45 | 45 | font-size: 105%; |
46 | 46 | } |
47 | 47 | #panel-buttons, #actions { |
48 | | - padding: 0.2em 0.5em; |
| 48 | + padding: 0.4em 0.5em; |
49 | 49 | background: #f8f8f8a0; |
50 | 50 | } |
| 51 | +#search-input { |
| 52 | + font-size: 105%; |
| 53 | +} |
51 | 54 | #actions { |
52 | 55 | bottom: 1em; |
53 | 56 | } |
|
75 | 78 | flex: 0 0 auto; |
76 | 79 | } |
77 | 80 | #node-details { |
78 | | - padding: 2em 0 0 0.2em; |
| 81 | + padding: 2.5em 0 0 0.2em; |
79 | 82 | height: 100%; |
80 | 83 | overflow: auto; |
81 | 84 | background-color: #fbfbfb; |
|
129 | 132 | <div id="cy-container"> |
130 | 133 | <div id="cy"></div> |
131 | 134 | <div id="panel-buttons"> |
| 135 | + <input id="search-input" placeholder="Search pathway titles ..."/> |
132 | 136 | <button id="zoom-out" title="Zoom out" onclick="modelZoomOut()"> |
133 | 137 | <img width="16px" height="16px" src='data:image/svg+xml;charset=utf-8,<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg width="10mm" height="10mm" viewBox="0 0 12 12" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg"> <g transform="matrix(0.09090916,0,0,0.09090916,-2.2369372,-4.0168636)"> <rect style="fill:%23000000;stroke-width:0.264583" width="116.41666" height="31.75" x="31.75" y="95.25" ry="0.26052997" /> </g> </svg>'/> |
134 | 138 | </button> |
|
173 | 177 |
|
174 | 178 | const modelSummaryById = {}; |
175 | 179 |
|
| 180 | + const modelNodes = modelConnections.nodes; |
| 181 | + |
176 | 182 | const elements = { |
177 | | - nodes: modelConnections.nodes.map(node => { |
| 183 | + nodes: modelNodes.map(node => { |
178 | 184 | const summ = { title: node.title }; |
179 | 185 | modelSummaryById[node.id] = summ; |
180 | 186 | const idNoPrefix = node.id.split(':')[1]; |
|
326 | 332 | }); |
327 | 333 |
|
328 | 334 | for (const currentModel of currentModels) { |
329 | | - cy.$('#' + currentModel.id).style('border-width', 5); |
| 335 | + cy.$('#' + currentModel.id).style('border-width', 8); |
330 | 336 | } |
331 | 337 | }; |
332 | 338 |
|
|
372 | 378 | contentDiv.innerHTML = newContent; |
373 | 379 | } |
374 | 380 |
|
| 381 | + const searchModels = (searchText) => { |
| 382 | + let matchCount = 0; |
| 383 | + modelNodes.map(node => { |
| 384 | + const title = node.title.toLowerCase(); |
| 385 | + if (title.includes(searchText)) { |
| 386 | + addToCurrent([node.id]); |
| 387 | + matchCount++; |
| 388 | + } |
| 389 | + }); |
| 390 | + return matchCount; |
| 391 | + }; |
| 392 | + |
| 393 | + const searchInput = document.getElementById('search-input'); |
| 394 | + searchInput.addEventListener("input", (e) => { |
| 395 | + const searchText = e.target.value.trim().toLowerCase(); |
| 396 | + clearCurrentModels(); |
| 397 | + if (searchText.length > 1) { |
| 398 | + searchModels(searchText); |
| 399 | + } |
| 400 | + updateDetails(); |
| 401 | + }); |
| 402 | + |
375 | 403 | cy.on('box', 'node', function( e ){ |
376 | 404 | const node = e.target; |
377 | 405 | const id = node.data().id; |
|
0 commit comments