From 5432f7ee00e1f139856a5f2ae68bdf10ce93c07e Mon Sep 17 00:00:00 2001 From: Evgeny Metelkin Date: Tue, 21 Nov 2023 10:22:45 +0200 Subject: [PATCH] layout selection --- TODO.md | 1 - package.json | 2 +- src/dropping.css | 4 ++++ src/viz-page.js | 47 ++++++++++++++++++++++++++++++++++++++++++----- 4 files changed, 47 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index 95e5a40..85cd153 100644 --- a/TODO.md +++ b/TODO.md @@ -1,6 +1,5 @@ # TODO list -- dot: select layout, save as png, save as file - hot keys for InfoPage - switch monaco themes - nice css styles diff --git a/package.json b/package.json index 251e1d1..53c8b97 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "build": "webpack --mode=production --node-env=production", "serve": "NODE_OPTIONS=--max-old-space-size=8192 webpack serve --node-env=production", "build:dev": "webpack --node-env=development", - "serve:dev": "webpack serve --node-env=development", + "serve:dev": "set NODE_OPTIONS=--max-old-space-size=4000&& webpack serve --node-env=development", "compile": "nunjucks-precompile --include [\"\\.hjk$\"] node_modules/heta-compiler/src/templates > src/compiled-templates.js" }, "author": "Evgeny Metelkin (https://github.com/metelkin)", diff --git a/src/dropping.css b/src/dropping.css index f79dbc1..dd6841f 100644 --- a/src/dropping.css +++ b/src/dropping.css @@ -2,6 +2,10 @@ /*border: 10px dotted red;*/ } +.hetaModuleContainer svg { + max-width: 100%; +} + svg { margin: 0.1em; overflow: visible; diff --git a/src/viz-page.js b/src/viz-page.js index 0bcda6f..070b41f 100644 --- a/src/viz-page.js +++ b/src/viz-page.js @@ -6,29 +6,66 @@ import { instance } from "@viz-js/viz"; import Page from './abstract-page'; +import path from 'path'; + +const LAYOUTS = [ // viz.engines + 'circo', 'dot', 'fdp', 'neato', + //'nop', 'nop1', 'nop2', + 'osage', 'patchwork', 'sfdp', 'twopi' +]; export default class VizPage extends Page { constructor(id, deleteBtn=true, rightSide=false, mimeType='application/octet-stream') { super(id, deleteBtn, rightSide, mimeType); + this.layout = 'dot'; } async fromArrayBuffer(ab){ let text = new TextDecoder('utf-8').decode(ab); this.text = text; + let blob = new Blob([text]) + let url = window.URL.createObjectURL(blob); + let filename = path.parse(this.id).base; + + let rightPanel = $('

') + .appendTo(this.editorContainer) + .append(`

Download file

`) + .append(`

`); + let select = $('