Skip to content
Snippets Groups Projects
Commit 288b6297 authored by Sytze de Witte's avatar Sytze de Witte
Browse files

Merge branch 'main' of https://gitlab.utwente.nl/dp-group-14/ide-plugin into main

parents 53252675 da6a048e
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ body { ...@@ -11,7 +11,7 @@ body {
user-select: none; /* Standard */ user-select: none; /* Standard */
} }
polygon { polygon, ellipse {
fill: none; fill: none;
} }
...@@ -103,6 +103,10 @@ button { ...@@ -103,6 +103,10 @@ button {
max-width: 100px; max-width: 100px;
} }
#paramList li select {
max-width: 100px;
}
#paramList li input[type=checkbox] { #paramList li input[type=checkbox] {
outline: none; outline: none;
} }
\ No newline at end of file
...@@ -87,8 +87,11 @@ function resetParams() { ...@@ -87,8 +87,11 @@ function resetParams() {
case 'Boolean': case 'Boolean':
valueElem.checked = param.defaultValue; valueElem.checked = param.defaultValue;
break; break;
case 'Enum':
valueElem.value = param.defaultValue;
break;
default: default:
console.log("OKAY WHAT THE FUCK IS THIS TYPE??? " + param.type.valueType); console.log("OKAY I DON'T KNOW THIS TYPE??? " + param.type.valueType);
break; break;
} }
}); });
...@@ -108,14 +111,15 @@ function addParameterItem(param) { ...@@ -108,14 +111,15 @@ function addParameterItem(param) {
li.appendChild(nameBox); li.appendChild(nameBox);
const valueBox = document.createElement("input"); let valueBox;
valueBox.id = "value-" + param.id;
switch (param.type.valueType) { switch (param.type.valueType) {
case 'String': case 'String':
valueBox = document.createElement("input");
valueBox.id = "value-" + param.id;
valueBox.value = param.defaultValue; valueBox.value = param.defaultValue;
valueBox.type = 'text'; valueBox.type = 'text';
valueBox.addEventListener("input", e => { valueBox.addEventListener("input", _ => {
vscode.postMessage({ vscode.postMessage({
type: 'paramUpdate', type: 'paramUpdate',
id: param.id, id: param.id,
...@@ -124,6 +128,8 @@ function addParameterItem(param) { ...@@ -124,6 +128,8 @@ function addParameterItem(param) {
}); });
break; break;
case 'Boolean': case 'Boolean':
valueBox = document.createElement("input");
valueBox.id = "value-" + param.id;
valueBox.checked = param.defaultValue; valueBox.checked = param.defaultValue;
valueBox.type = 'checkbox'; valueBox.type = 'checkbox';
nameBox.style.cursor = 'pointer'; nameBox.style.cursor = 'pointer';
...@@ -135,7 +141,7 @@ function addParameterItem(param) { ...@@ -135,7 +141,7 @@ function addParameterItem(param) {
value: valueBox.checked value: valueBox.checked
}); });
}; };
valueBox.addEventListener("input", e => { valueBox.addEventListener("input", _ => {
vscode.postMessage({ vscode.postMessage({
type: 'paramUpdate', type: 'paramUpdate',
id: param.id, id: param.id,
...@@ -143,50 +149,33 @@ function addParameterItem(param) { ...@@ -143,50 +149,33 @@ function addParameterItem(param) {
}); });
}); });
break; break;
case 'Enum':
valueBox = document.createElement("select");
valueBox.id = "value-" + param.id;
valueBox.classList.add("value");
for (const value of param.type.possibleValues) {
const option = document.createElement("option");
option.value = value;
option.text = value;
valueBox.appendChild(option);
}
valueBox.value = param.defaultValue;
valueBox.addEventListener("input", _ => {
vscode.postMessage({
type: 'paramUpdate',
id: param.id,
value: valueBox.value
});
});
break;
default: default:
console.log("OKAY WHAT THE FUCK IS THIS TYPE??? " + param.type.valueType); console.log("OKAY I DON'T KNOW THIS TYPE??? " + param.type.valueType);
break; break;
}; };
// if (type === "Enum") {
// /**
// * @type {HTMLSelectElement}
// */
// const valueBox = document.createElement("select");
// valueBox.id = "value-" + name;
// valueBox.classList.add("value");
// for (const value of possibleValues) {
// const option = document.createElement("option");
// option.value = value;
// option.text = value;
// valueBox.appendChild(option);
// }
// valueBox.value = value;
// valueBox.addEventListener("input", _ => {
// let oldState = vscode.getState();
// for (const tool of oldState.parameters) {
// if (tool.toolName === oldState.currentTool) {
// for (const parameter of tool.parameters) {
// if (parameter.id === name) {
// parameter.value = valueBox.options[valueBox.selectedIndex].value;
// break;
// }
// }
// break;
// }
// }
// vscode.setState({ tools: oldState.tools, documentVars: oldState.documentVars, parameters: oldState.parameters, currentUri: oldState.currentUri, currentTool: oldState.currentTool });
// });
// li.appendChild(valueBox);
// } else {
li.appendChild(valueBox); li.appendChild(valueBox);
// }
paramList.appendChild(li); paramList.appendChild(li);
...@@ -210,9 +199,9 @@ document.getElementById("closeOptions").onclick = () => { ...@@ -210,9 +199,9 @@ document.getElementById("closeOptions").onclick = () => {
}); });
}; };
document.getElementById("revert").onclick = ()=>{ document.getElementById("revert").onclick = () => {
resetParams(); resetParams();
vscode.postMessage({ vscode.postMessage({
type: 'paramReset', type: 'paramReset',
}); });
...@@ -222,28 +211,6 @@ document.getElementById("revert").onclick = ()=>{ ...@@ -222,28 +211,6 @@ document.getElementById("revert").onclick = ()=>{
// FULL CREDIT TO https://stackoverflow.com/questions/52576376/how-to-zoom-in-on-a-complex-svg-structure // FULL CREDIT TO https://stackoverflow.com/questions/52576376/how-to-zoom-in-on-a-complex-svg-structure
// also https://stackoverflow.com/questions/1685326/responding-to-the-onmousemove-event-outside-of-the-browser-window-in-ie // also https://stackoverflow.com/questions/1685326/responding-to-the-onmousemove-event-outside-of-the-browser-window-in-ie
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
......
...@@ -74,10 +74,11 @@ ...@@ -74,10 +74,11 @@
* @param {HTMLElement} body * @param {HTMLElement} body
*/ */
function collapseHeight(body) { function collapseHeight(body) {
const height = body.scrollHeight;
body.style.removeProperty("height"); body.style.removeProperty("height");
body.style.removeProperty("margin"); body.style.removeProperty("margin");
if (body.parentElement.parentElement.classList.contains("pane-body")) { if (body.parentElement.parentElement.classList.contains("pane-body")) {
expandHeight(body.parentElement.parentElement, -body.scrollHeight); expandHeight(body.parentElement.parentElement, -height);
} }
} }
...@@ -103,7 +104,7 @@ ...@@ -103,7 +104,7 @@
body.style.margin = "0.2em 0 0.4em var(--container-paddding)"; body.style.margin = "0.2em 0 0.4em var(--container-paddding)";
if (body.parentElement.parentElement.classList.contains("pane-body")) { if (body.parentElement.parentElement.classList.contains("pane-body")) {
expandHeight(body.parentElement.parentElement, amount + additional); expandHeight(body.parentElement.parentElement, amount + additional + parseFloat(getComputedStyle(body).fontSize) * 0.6);
} }
} }
......
import * as vscode from 'vscode'; import * as vscode from 'vscode';
import { CancellationToken, NotificationType, TextDocumentIdentifier } from 'vscode-languageclient/node'; import { TextDocumentIdentifier } from 'vscode-languageclient/node';
import { client, clientReady, disposalQueue, extensionUri, resultHandlers } from './extension'; import { client, clientReady, disposalQueue, extensionUri, resultHandlers } from './extension';
import * as fs from "fs"; import * as fs from "fs";
import { ParameterDefinitions, getNonce, ResultNotification, ParameterDefinition } from './utils'; import { ParameterDefinitions, getNonce, ResultNotification, ParameterDefinition } from './utils';
import { CancellationTokenSource } from 'vscode';
import { ParameterInformation } from 'vscode';
export namespace DotViewer { export namespace DotViewer {
...@@ -119,25 +117,29 @@ export namespace DotViewer { ...@@ -119,25 +117,29 @@ export namespace DotViewer {
if (e.webviewPanel.active) { if (e.webviewPanel.active) {
LiveDotView.currentDotView = this; LiveDotView.currentDotView = this;
} }
this.postMessage({ if (this.lastSvgString) {
type: 'svg', this.postMessage({
svg: this.lastSvgString, type: 'svg',
}); svg: this.lastSvgString,
this.postMessage({ });
type: 'params', }
params: LiveDotView.availableParameters, if (LiveDotView.availableParameters) {
}); this.postMessage({
this.postMessage({ type: 'params',
type: 'paramValues', params: LiveDotView.availableParameters,
values: Array.from(this.dotParameters.entries()), });
}); }
if (this.dotParameters) {
this.postMessage({
type: 'paramValues',
values: Array.from(this.dotParameters.entries()),
});
}
this.postMessage({ this.postMessage({
type: 'optionsOpen', type: 'optionsOpen',
optionsOpen: this.optionsOpen, optionsOpen: this.optionsOpen,
}); });
}, },
undefined,
undefined
); );
this.webview.onDidReceiveMessage( this.webview.onDidReceiveMessage(
...@@ -156,8 +158,6 @@ export namespace DotViewer { ...@@ -156,8 +158,6 @@ export namespace DotViewer {
break; break;
} }
}, },
undefined,
undefined
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment