change to css grid

master
JFH 2021-08-07 00:06:58 +02:00
parent b048afb72e
commit cfb47fa952
16 changed files with 422 additions and 490 deletions

View File

@ -457,23 +457,23 @@ class Editor extends EditorStartup {
*/
updateCanvas(center, newCtr) {
const zoom = this.svgCanvas.getZoom();
const wArea = this.workarea;
const { workarea } = this;
const cnvs = $id("svgcanvas");
let w = parseFloat(getComputedStyle(this.workarea, null).width.replace("px", "")); let h = parseFloat(getComputedStyle(this.workarea, null).height.replace("px", ""));
let w = parseFloat(getComputedStyle(workarea, null).width.replace("px", "")); let h = parseFloat(getComputedStyle(workarea, null).height.replace("px", ""));
const wOrig = w; const hOrig = h;
const oldCtr = {
x: wArea.scrollLeft + wOrig / 2,
y: wArea.scrollTop + hOrig / 2
x: workarea.scrollLeft + wOrig / 2,
y: workarea.scrollTop + hOrig / 2
};
const multi = this.configObj.curConfig.canvas_expansion;
w = Math.max(wOrig, this.svgCanvas.contentW * zoom * multi);
h = Math.max(hOrig, this.svgCanvas.contentH * zoom * multi);
if (w === wOrig && h === hOrig) {
this.workarea.style.overflow = 'hidden';
workarea.style.overflow = 'hidden';
} else {
this.workarea.style.overflow = 'scroll';
workarea.style.overflow = 'scroll';
}
const oldCanY = parseFloat(getComputedStyle(cnvs, null).height.replace("px", "")) / 2;
@ -508,22 +508,22 @@ class Editor extends EditorStartup {
if (center) {
// Go to top-left for larger documents
if (this.svgCanvas.contentW > parseFloat(getComputedStyle(wArea, null).width.replace("px", ""))) {
if (this.svgCanvas.contentW > parseFloat(getComputedStyle(workarea, null).width.replace("px", ""))) {
// Top-left
this.workarea.scrollLeft = offset.x - 10;
this.workarea.scrollTop = offset.y - 10;
workarea.scrollLeft = offset.x - 10;
workarea.scrollTop = offset.y - 10;
} else {
// Center
wArea.scrollLeft = scrollX;
wArea.scrollTop = scrollY;
workarea.scrollLeft = scrollX;
workarea.scrollTop = scrollY;
}
} else {
wArea.scrollLeft = newCtr.x - wOrig / 2;
wArea.scrollTop = newCtr.y - hOrig / 2;
workarea.scrollLeft = newCtr.x - wOrig / 2;
workarea.scrollTop = newCtr.y - hOrig / 2;
}
if (this.configObj.curConfig.showRulers) {
this.rulers.updateRulers(cnvs, zoom);
this.workarea.scroll();
workarea.scroll();
}
if (this.configObj.urldata.storagePrompt !== true && this.storagePromptState === 'ignore') {
@ -706,8 +706,7 @@ class Editor extends EditorStartup {
*/
zoomChanged(win, bbox, autoCenter) {
const scrbar = 15;
const wArea = this.workarea;
const zInfo = this.svgCanvas.setBBoxZoom(bbox, parseFloat(getComputedStyle(wArea, null).width.replace("px", "")) - scrbar, parseFloat(getComputedStyle(wArea, null).height.replace("px", "")) - scrbar);
const zInfo = this.svgCanvas.setBBoxZoom(bbox, parseFloat(getComputedStyle(this.workarea, null).width.replace("px", "")) - scrbar, parseFloat(getComputedStyle(this.workarea, null).height.replace("px", "")) - scrbar);
if (!zInfo) { return; }
const zoomlevel = zInfo.zoom;
const bb = zInfo.bbox;
@ -857,9 +856,10 @@ class Editor extends EditorStartup {
* @returns {void}
*/
pasteInCenter() {
const { workarea } = this;
const zoom = this.svgCanvas.getZoom();
const x = (this.workarea.scrollLeft + parseFloat(getComputedStyle(this.workarea, null).width.replace("px", "")) / 2) / zoom - this.svgCanvas.contentW;
const y = (this.workarea.scrollTop + parseFloat(getComputedStyle(this.workarea, null).height.replace("px", "")) / 2) / zoom - this.svgCanvas.contentH;
const x = (workarea.scrollLeft + parseFloat(getComputedStyle(workarea, null).width.replace("px", "")) / 2) / zoom - this.svgCanvas.contentW;
const y = (workarea.scrollTop + parseFloat(getComputedStyle(workarea, null).height.replace("px", "")) / 2) / zoom - this.svgCanvas.contentH;
this.svgCanvas.pasteElements('point', x, y);
}

View File

@ -41,7 +41,7 @@ const readySignal = () => {
}
};
const { $id } = SvgCanvas;
const { $id, $qq } = SvgCanvas;
/**
*
@ -53,7 +53,7 @@ class EditorStartup {
constructor (div) {
this.extensionsAdded = false;
this.messageQueue = [];
this.$svgEditor = div??$id('svg_editor');
this.$container = div??$id('svg_editor');
}
/**
* Auto-run after a Promise microtask.
@ -65,43 +65,44 @@ class EditorStartup {
this.storage = window.localStorage;
}
this.configObj.load();
const self = this;
const { i18next } = await putLocale(this.configObj.pref('lang'), this.goodLangs);
this.i18next = i18next;
await import(`./components/index.js`);
await import(`./dialogs/index.js`);
// allow to prepare the dom without display
this.$svgEditor.style.visibility = 'hidden';
try {
// add editor components to the DOM
this.$svgEditor.append(editorTemplate.content.cloneNode(true));
this.$container.append(editorTemplate.content.cloneNode(true));
this.$svgEditor = $qq('.svg_editor');
// allow to prepare the dom without display
// JFH this.$svgEditor.style.visibility = 'hidden';
this.workarea = $id('workarea');
// Image props dialog added to DOM
const newSeImgPropDialog = document.createElement('se-img-prop-dialog');
newSeImgPropDialog.setAttribute('id', 'se-img-prop');
this.$svgEditor.append(newSeImgPropDialog);
this.$container.append(newSeImgPropDialog);
newSeImgPropDialog.init(this.i18next);
// editor prefences dialoag added to DOM
const newSeEditPrefsDialog = document.createElement('se-edit-prefs-dialog');
newSeEditPrefsDialog.setAttribute('id', 'se-edit-prefs');
this.$svgEditor.append(newSeEditPrefsDialog);
this.$container.append(newSeEditPrefsDialog);
newSeEditPrefsDialog.init(this.i18next);
// canvas menu added to DOM
const dialogBox = document.createElement('se-cmenu_canvas-dialog');
dialogBox.setAttribute('id', 'se-cmenu_canvas');
this.$svgEditor.append(dialogBox);
this.$container.append(dialogBox);
dialogBox.init(this.i18next);
// alertDialog added to DOM
const alertBox = document.createElement('se-alert-dialog');
alertBox.setAttribute('id', 'se-alert-dialog');
this.$svgEditor.append(alertBox);
this.$container.append(alertBox);
// promptDialog added to DOM
const promptBox = document.createElement('se-prompt-dialog');
promptBox.setAttribute('id', 'se-prompt-dialog');
this.$svgEditor.append(promptBox);
this.$container.append(promptBox);
// Export dialog added to DOM
const exportDialog = document.createElement('se-export-dialog');
exportDialog.setAttribute('id', 'se-export-dialog');
this.$svgEditor.append(exportDialog);
this.$container.append(exportDialog);
exportDialog.init(this.i18next);
} catch (err) {
console.error(err);
@ -123,8 +124,7 @@ class EditorStartup {
this.mainMenu.init();
const { undoMgr } = this.svgCanvas;
this.workarea = document.getElementById('workarea');
this.canvMenu = document.getElementById('se-cmenu_canvas');
this.canvMenu = $id('se-cmenu_canvas');
this.exportWindow = null;
this.defaultImageURL = this.configObj.curConfig.imgPath + 'logo.svg';
const zoomInIcon = 'crosshair';
@ -218,9 +218,9 @@ class EditorStartup {
// fired when user wants to move elements to another layer
let promptMoveLayerOnce = false;
$id('selLayerNames').addEventListener('change', function(evt) {
$id('selLayerNames').addEventListener('change', (evt) => {
const destLayer = evt.currentTarget.options[evt.currentTarget.selectedIndex].value;
const confirmStr = self.i18next.t('notification.QmoveElemsToLayer').replace('%s', destLayer);
const confirmStr = this.i18next.t('notification.QmoveElemsToLayer').replace('%s', destLayer);
/**
* @param {boolean} ok
* @returns {void}
@ -228,9 +228,9 @@ class EditorStartup {
const moveToLayer = (ok) => {
if (!ok) { return; }
promptMoveLayerOnce = true;
self.svgCanvas.moveSelectedToLayer(destLayer);
self.svgCanvas.clearSelection();
self.layersPanel.populateLayers();
this.svgCanvas.moveSelectedToLayer(destLayer);
this.svgCanvas.clearSelection();
this.layersPanel.populateLayers();
};
if (destLayer) {
if (promptMoveLayerOnce) {
@ -244,12 +244,12 @@ class EditorStartup {
}
}
});
$id('tool_font_family').addEventListener('change', function(evt) {
self.svgCanvas.setFontFamily(evt.detail.value);
$id('tool_font_family').addEventListener('change', (evt) => {
this.svgCanvas.setFontFamily(evt.detail.value);
});
$id('seg_type').addEventListener('change', function(evt) {
self.svgCanvas.setSegType(evt.currentTarget.value);
$id('seg_type').addEventListener('change', (evt) => {
this.svgCanvas.setSegType(evt.currentTarget.value);
});
function addListenerMulti(element, eventNames, listener) {
@ -259,35 +259,33 @@ class EditorStartup {
}
}
addListenerMulti($id('text'), 'keyup input', function(evt){
self.svgCanvas.setTextContent(evt.currentTarget.value);
addListenerMulti($id('text'), 'keyup input', (evt) => {
this.svgCanvas.setTextContent(evt.currentTarget.value);
});
$id('image_url').addEventListener('change', function(evt) {
self.setImageURL(evt.currentTarget.value);
$id('image_url').addEventListener('change', (evt) => {
this.setImageURL(evt.currentTarget.value);
});
$id('link_url').addEventListener('change', function(evt) {
$id('link_url').addEventListener('change', (evt) => {
if (evt.currentTarget.value.length) {
self.svgCanvas.setLinkURL(evt.currentTarget.value);
this.svgCanvas.setLinkURL(evt.currentTarget.value);
} else {
self.svgCanvas.removeHyperlink();
this.svgCanvas.removeHyperlink();
}
});
$id('g_title').addEventListener('change', function(evt) {
self.svgCanvas.setGroupTitle(evt.currentTarget.value);
$id('g_title').addEventListener('change', (evt) => {
this.svgCanvas.setGroupTitle(evt.currentTarget.value);
});
const wArea = this.workarea;
let lastX = null; let lastY = null;
let panning = false; let keypan = false;
$id('svgcanvas').addEventListener('mouseup', function(evt) {
$id('svgcanvas').addEventListener('mouseup', (evt) => {
if (panning === false) { return true; }
wArea.scrollLeft -= (evt.clientX - lastX);
wArea.scrollTop -= (evt.clientY - lastY);
this.workarea.scrollLeft -= (evt.clientX - lastX);
this.workarea.scrollTop -= (evt.clientY - lastY);
lastX = evt.clientX;
lastY = evt.clientY;
@ -298,8 +296,8 @@ class EditorStartup {
$id('svgcanvas').addEventListener('mousemove', function(evt) {
if (panning === false) { return true; }
wArea.scrollLeft -= (evt.clientX - lastX);
wArea.scrollTop -= (evt.clientY - lastY);
this.workarea.scrollLeft -= (evt.clientX - lastX);
this.workarea.scrollTop -= (evt.clientY - lastY);
lastX = evt.clientX;
lastY = evt.clientY;
@ -535,7 +533,11 @@ class EditorStartup {
$id('tool_wireframe').click();
}
$id('rulers').style.display = (this.configObj.curConfig.showRulers) ? 'block' : 'none';
if (this.configObj.curConfig.showRulers) {
$id('rulers').style.removeProperty('display');
} else {
$id('rulers').style.display = 'none';
}
if (this.configObj.curConfig.showRulers) {
$editDialog.setAttribute('showrulers', true);

View File

@ -306,7 +306,6 @@ class MainMenu {
// eslint-disable-next-line no-unsanitized/property
template.innerHTML = `
<se-menu id="main_button" label="SVG-Edit" src="./images/logo.svg" alt="logo">
<!-- File-like buttons: New, Save, Source -->
<se-menu-item id="tool_clear" label="${i18next.t('tools.new_doc')}" shortcut="N" src="./images/new.svg">
</se-menu-item>
<se-menu-item id="tool_open" label="${i18next.t('tools.open_doc')}" src="./images/open.svg">

View File

@ -18,7 +18,7 @@ class Rulers {
this.svgCanvas = editor.svgCanvas;
this.editor = editor;
// add rulers component to the DOM
this.editor.$svgEditor.append(rulersTemplate.content.cloneNode(true));
this.editor.workarea.append(rulersTemplate.content.cloneNode(true));
}
/**
* @type {Module}

View File

@ -3,6 +3,11 @@ import 'elix/define/Input.js';
const template = document.createElement('template');
template.innerHTML = `
<style>
div {
height: 24px;
margin: 5px 1px;
padding: 3px;
}
img {
top: 2px;
left: 4px;
@ -20,9 +25,11 @@ template.innerHTML = `
border-radius: 3px;
}
</style>
<div>
<img src="./images/logo.svg" alt="icon" width="12" height="12" />
<span id="label">label</span>
<elix-input></elix-input>
</div>
`;
/**

View File

@ -3,6 +3,11 @@ import '../dialogs/se-elix/define/NumberSpinBox.js';
const template = document.createElement('template');
template.innerHTML = `
<style>
div {
height: 24px;
margin: 5px 1px;
padding: 3px;
}
img {
position: relative;
right: -4px;
@ -34,9 +39,11 @@ template.innerHTML = `
height: 24px;
}
</style>
<div>
<img src="./images/logo.svg" alt="icon" width="24" height="24" aria-labelledby="label" />
<span id="label">label</span>
<elix-number-spin-box min="1" step="1"></elix-number-spin-box>
</div>
`;
/**

View File

@ -51,11 +51,11 @@ export default {
// Define dynamic animation of the view box.
const updateViewBox = function () {
const warea = document.getElementById('workarea');
const portHeight = parseFloat(getComputedStyle(warea, null).height.replace("px", ""));
const portWidth = parseFloat(getComputedStyle(warea, null).width.replace("px", ""));
const portX = warea.scrollLeft;
const portY = warea.scrollTop;
const { workarea } = svgEditor;
const portHeight = parseFloat(getComputedStyle(workarea, null).height.replace("px", ""));
const portWidth = parseFloat(getComputedStyle(workarea, null).width.replace("px", ""));
const portX = workarea.scrollLeft;
const portY = workarea.scrollTop;
const windowWidth = parseFloat(getComputedStyle($id("svgcanvas"), null).width.replace("px", ""));
const windowHeight = parseFloat(getComputedStyle($id("svgcanvas"), null).height.replace("px", ""));
const overviewWidth = parseFloat(getComputedStyle($id("overviewMiniView"), null).width.replace("px", ""));

View File

@ -82,7 +82,7 @@ export default {
// storageDialog added to DOM
const storageBox = document.createElement('se-storage-dialog');
storageBox.setAttribute('id', 'se-storage-dialog');
svgEditor.$svgEditor.append(storageBox);
svgEditor.$container.append(storageBox);
storageBox.init(svgEditor.i18next);
// manage the change in the storageDialog

View File

@ -25,7 +25,7 @@
<script type="module">
/* for available options see the file `docs/tutorials/ConfigOptions.md */
import Editor from './Editor.js';
const svgEditor = new Editor(document.getElementsByClassName('svg_editor')[0]);
const svgEditor = new Editor(document.getElementById('container'));
svgEditor.init();
svgEditor.setConfig({
allowInitialUserOverride: true,
@ -51,7 +51,9 @@
</head>
<body>
<div class="svg_editor" role="main"></div>
<h1>SVGEdit</h1>
<div id="container" style="width:100%;height:550px"></div>
<h1>End</h1>
</body>
</html>

View File

@ -57,13 +57,13 @@ class BottomPanel {
return;
}
const zoom = this.editor.svgCanvas.getZoom();
const wArea = this.editor.workarea;
const { workarea } = this.editor;
this.editor.zoomChanged(window, {
width: 0,
height: 0,
// center pt of scroll position
x: (wArea.scrollLeft + parseFloat(getComputedStyle(wArea, null).width.replace("px", "")) / 2) / zoom,
y: (wArea.scrollTop + parseFloat(getComputedStyle(wArea, null).height.replace("px", "")) / 2) / zoom,
x: (workarea.scrollLeft + parseFloat(getComputedStyle(workarea, null).width.replace("px", "")) / 2) / zoom,
y: (workarea.scrollTop + parseFloat(getComputedStyle(workarea, null).height.replace("px", "")) / 2) / zoom,
zoom: zoomlevel
}, true);
}
@ -210,7 +210,7 @@ class BottomPanel {
<se-spin-input size="3" id="opacity" min=0 max=100 step=5 title="${i18next.t('properties.opacity')}"
src="./images/opacity.svg"></se-spin-input>
<se-palette id="palette"></se-palette>
</div> <!-- tools_bottom -->
</div>
`;
this.editor.$svgEditor.append(template.content.cloneNode(true));
$id('palette').addEventListener('change', this.handlePalette.bind(this));

View File

@ -149,13 +149,13 @@ class LayersPanel {
menuMore.setAttribute("id", "se-cmenu-layers-more");
menuMore.value = "layer_moreopts";
menuMore.setAttribute("leftclick", true);
this.editor.$svgEditor.append(menuMore);
this.editor.$container.append(menuMore);
menuMore.init(i18next);
const menuLayerBox = document.createElement("se-cmenu-layers");
menuLayerBox.setAttribute("id", "se-cmenu-layers-list");
menuLayerBox.value = "layerlist";
menuLayerBox.setAttribute("leftclick", false);
this.editor.$svgEditor.append(menuLayerBox);
this.editor.$container.append(menuLayerBox);
menuLayerBox.init(i18next);
document
.getElementById("layer_new")

View File

@ -244,7 +244,7 @@ class LeftPanel {
}
];
const template = document.createElement("template");
template.innerHTML = `<div id="tools_left"></div> <!-- tools_left -->`;
template.innerHTML = `<div id="tools_left"></div>`;
this.editor.$svgEditor.append(template.content.cloneNode(true));
const leftMenuSort = leftMenu.sort((a, b) => (a.position > b.position) ? 1 : ((b.position > a.position) ? -1 : 0));
const parent = $id("tools_left");

View File

@ -203,7 +203,7 @@ class TopPanel {
}
if (!isNode && currentMode !== "pathedit") {
$id("selected_panel").style.display = 'block';
$id("selected_panel").style.removeProperty('display');
// Elements in this array already have coord fields
if ([ "line", "circle", "ellipse" ].includes(elname)) {
$id("xy_panel").style.display = 'none';
@ -228,7 +228,7 @@ class TopPanel {
$id("selected_x").value = (x || 0);
$id("selected_y").value = (y || 0);
$id("xy_panel").style.display = 'block';
$id("xy_panel").style.removeProperty('display');
}
// Elements in this array cannot be converted to a path
@ -324,7 +324,7 @@ class TopPanel {
});
if (tagName === "text") {
$id("text_panel").style.display = 'block';
$id("text_panel").style.removeProperty('display');
$id("tool_italic").pressed = this.editor.svgCanvas.getItalic();
$id("tool_bold").pressed = this.editor.svgCanvas.getBold();
$id("tool_font_family").value = elem.getAttribute("font-family");
@ -749,246 +749,246 @@ class TopPanel {
const { i18next } = this.editor;
// eslint-disable-next-line no-unsanitized/property
template.innerHTML = `
<div id="tools_top">
<div id="editor_panel">
<div class="tool_sep"></div>
<se-button
id="tool_source"
title="${i18next.t('tools.tool_source')}"
shortcut="U"
src="./images/source.svg"
></se-button>
<se-button
id="tool_wireframe"
title="${i18next.t('tools.wireframe_mode')}"
shortcut="F"
src="./images/wireframe.svg"
></se-button>
</div> <!-- editor_panel -->
<div id="history_panel">
<div class="tool_sep"></div>
<se-button id="tool_undo" title="${i18next.t('tools.undo')}" shortcut="Z" src="./images/undo.svg" disabled></se-button>
<se-button id="tool_redo" title="${i18next.t('tools.redo')}" shortcut="Y" src="./images/redo.svg" disabled></se-button>
</div> <!-- history_panel -->
<!-- Buttons when a single element is selected -->
<div id="selected_panel">
<div class="toolset">
<div class="tool_sep"></div>
<se-button id="tool_clone" title="${i18next.t('tools.clone')}" shortcut="D" src="./images/clone.svg"></se-button>
<se-button id="tool_delete" title="${i18next.t('tools.del')}" shortcut="Delete/Backspace" src="./images/delete.svg">
</se-button>
</div>
<div class="toolset">
<div class="tool_sep"></div>
<se-button id="tool_move_top" title="${i18next.t('tools.move_top')}" shortcut="Ctrl+Shift+]" src="./images/move_top.svg">
</se-button>
<se-button id="tool_move_bottom" title="${i18next.t('tools.move_bottom')}" shortcut="Ctrl+Shift+[" src="./images/move_bottom.svg">
</se-button>
</div>
<div class="toolset">
<se-button id="tool_topath" title="${i18next.t('tools.to_path')}" src="./images/to_path.svg"></se-button>
<se-button id="tool_reorient" title="${i18next.t('tools.reorient_path')}" src="./images/reorient.svg"></se-button>
<se-button id="tool_make_link" title="${i18next.t('tools.make_link')}" src="./images/globe_link.svg"></se-button>
</div>
<div class="toolset">
<div class="tool_sep"></div>
<se-input id="elem_id" data-attr="id" size="10" label="id" title="${i18next.t('properties.id')}"></se-input>
</div>
<div class="toolset">
<se-input id="elem_class" data-attr="class" size="10" label="class" title="${i18next.t('properties.class')}"></se-input>
</div>
<se-spin-input size="3" id="angle" min=-180 max=180 step=5 src="./images/angle.svg"
title="${i18next.t('properties.angle')}"></se-spin-input>
<se-spin-input size="2" id="blur" min=0 max=100 step=5 src="./images/blur.svg"
title="${i18next.t('properties.blur')}"></se-spin-input>
<se-list id="tool_position" title="${i18next.t('tools.align_to_page')}" label="" width="22px" height="24px">
<se-list-item id="tool_posleft" value="l">
<img title="${i18next.t('tools.align_left')}" src="./images/align_left.svg" height="22px">
</se-list-item>
<se-list-item id="tool_poscenter" value="c">
<img title="${i18next.t('tools.align_center')}" src="./images/align_center.svg" height="22px">
</se-list-item>
<se-list-item id="tool_posright" value="r">
<img title="${i18next.t('tools.align_right')}" src="./images/align_right.svg" height="22px">
</se-list-item>
<se-list-item id="tool_postop" value="t">
<img title="${i18next.t('tools.align_top')}" src="./images/align_top.svg" height="22px">
</se-list-item>
<se-list-item id="tool_posmiddle" value="m">
<img title="${i18next.t('tools.align_middle')}" src="./images/align_middle.svg" height="22px">
</se-list-item>
<se-list-item id="tool_posbottom" value="b">
<img title="${i18next.t('tools.align_bottom')}" src="./images/align_bottom.svg" height="22px">
</se-list-item>
</se-list>
<div id="xy_panel" class="toolset">
<se-spin-input id="selected_x" data-attr="x" size="4" type="text" label="x" title="${i18next.t('properties.pos_x')}">
</se-spin-input>
<se-spin-input id="selected_y" data-attr="y" size="4" type="text" label="y" title="${i18next.t('properties.pos_y')}">
</se-spin-input>
</div>
</div> <!-- selected_panel -->
<!-- Buttons when multiple elements are selected -->
<div id="multiselected_panel">
<div class="tool_sep"></div>
<se-button id="tool_clone_multi" title="${i18next.t('tools.clone')}" shortcut="C" src="./images/clone.svg"></se-button>
<se-button id="tool_delete_multi" title="${i18next.t('tools.del')}" shortcut="Delete/Backspace"
src="./images/delete.svg"></se-button>
<div class="tool_sep"></div>
<se-button id="tool_group_elements" title="${i18next.t('tools.group_elements')}" shortcut="G" src="./images/group_elements.svg">
</se-button>
<se-button id="tool_make_link_multi" title="${i18next.t('tools.make_link')}" src="./images/globe_link.svg"></se-button>
<se-button id="tool_align_left" title="${i18next.t('tools.align_left')}" src="./images/align_left.svg"></se-button>
<se-button id="tool_align_center" title="${i18next.t('tools.align_center')}" src="./images/align_center.svg"></se-button>
<se-button id="tool_align_right" title="${i18next.t('tools.align_right')}" src="./images/align_right.svg"></se-button>
<se-button id="tool_align_top" title="${i18next.t('tools.align_top')}" src="./images/align_top.svg"></se-button>
<se-button id="tool_align_middle" title="${i18next.t('tools.align_middle')}" src="./images/align_middle.svg"></se-button>
<se-button id="tool_align_bottom" title="${i18next.t('tools.align_bottom')}" src="./images/align_bottom.svg"></se-button>
<se-list id="tool_align_relative" label="relative to:">
<se-list-item id="selected_objects" value="selected">${i18next.t('tools.selected_objects')}</se-list-item>
<se-list-item id="largest_object" value="largest">${i18next.t('tools.largest_object')}</se-list-item>
<se-list-item id="smallest_object" value="smallest">${i18next.t('tools.smallest_object')}</se-list-item>
<se-list-item id="page" value="page">${i18next.t('tools.page')}</se-list-item>
</se-list>
<div class="tool_sep"></div>
</div> <!-- multiselected_panel -->
<div id="rect_panel">
<div class="toolset">
<se-spin-input id="rect_width" data-attr="width" size="4" label="w" title="${i18next.t('properties.rect_width')}">
</se-spin-input>
<se-spin-input id="rect_height" data-attr="height" size="4" label="h" title="${i18next.t('properties.rect_height')}">
</se-spin-input>
</div>
<se-spin-input id="rect_rx" min=0 max=1000 step=1 size="3" title="${i18next.t('properties.corner_radius')}"
data-attr="Corner Radius" src="./images/c_radius.svg"></se-spin-input>
</div> <!-- rect_panel -->
<div id="image_panel">
<div class="toolset">
<se-spin-input id="image_width" data-attr="width" size="4" type="text" label="w" title="${i18next.t('properties.image_width')}">
</se-spin-input>
<se-spin-input id="image_height" data-attr="height" size="4" type="text" label="h"
title="${i18next.t('properties.image_height')}"></se-spin-input>
</div>
<div class="toolset">
<label id="tool_image_url">url:
<input id="image_url" type="text" title="${i18next.t('properties.image_url')}" size="35" />
</label>
<label id="tool_change_image">
<button id="change_image_url" style="display: none;">Change Image</button>
<span id="url_notice"
title="${i18next.t('tools.no_embed')}"></span>
</label>
</div>
</div> <!-- image_panel -->
<div id="circle_panel">
<div class="toolset">
<se-spin-input id="circle_cx" data-attr="cx" size="4" label="cx"></se-spin-input>
<se-spin-input id="circle_cy" data-attr="cy" size="4" label="cy"></se-spin-input>
</div>
<div class="toolset">
<se-spin-input id="circle_r" data-attr="r" size="4" label="r"></se-spin-input>
</div>
</div> <!-- circle_panel -->
<div id="ellipse_panel">
<div class="toolset">
<se-spin-input id="ellipse_cx" data-attr="cx" size="4" title="${i18next.t('properties.ellipse_cx')}" label="cx">
</se-spin-input>
<se-spin-input id="ellipse_cy" data-attr="cy" size="4" title="${i18next.t('properties.ellipse_cy')}" label="cy">
</se-spin-input>
</div>
<div class="toolset">
<se-spin-input id="ellipse_rx" data-attr="rx" size="4" title="${i18next.t('properties.ellipse_rx')}" label="rx">
</se-spin-input>
<se-spin-input id="ellipse_ry" data-attr="ry" size="4" title="${i18next.t('properties.ellipse_ry')}" label="ry">
</se-spin-input>
</div>
</div> <!-- ellipse_panel -->
<div id="line_panel">
<div class="toolset">
<se-spin-input id="line_x1" data-attr="x1" size="4" title="${i18next.t('properties.line_x1')}" label="x1">
</se-spin-input>
<se-spin-input id="line_y1" data-attr="y1" size="4" title="${i18next.t('properties.line_y1')}" label="y1">
</se-spin-input>
<se-spin-input id="line_x2" data-attr="x2" size="4" title="${i18next.t('properties.line_x2')}" label="x2">
</se-spin-input>
<se-spin-input id="line_y2" data-attr="y2" size="4" title="${i18next.t('properties.line_y2')}" label="y2">
</se-spin-input>
</div>
</div> <!-- line_panel -->
<div id="text_panel">
<div id="tools_top">
<div id="editor_panel">
<div class="tool_sep"></div>
<se-button
id="tool_source"
title="${i18next.t('tools.tool_source')}"
shortcut="U"
src="./images/source.svg"
></se-button>
<se-button
id="tool_wireframe"
title="${i18next.t('tools.wireframe_mode')}"
shortcut="F"
src="./images/wireframe.svg"
></se-button>
</div> <!-- editor_panel -->
<div id="history_panel">
<div class="tool_sep"></div>
<se-button id="tool_undo" title="${i18next.t('tools.undo')}" shortcut="Z" src="./images/undo.svg" disabled></se-button>
<se-button id="tool_redo" title="${i18next.t('tools.redo')}" shortcut="Y" src="./images/redo.svg" disabled></se-button>
</div> <!-- history_panel -->
<!-- Buttons when a single element is selected -->
<div id="selected_panel">
<div class="toolset">
<se-button id="tool_bold" title="${i18next.t('properties.bold')}" src="./images/bold.svg" shortcut="B"></se-button>
<se-button id="tool_italic" title="${i18next.t('properties.italic')}" src="./images/italic.svg" shortcut="I"></se-button>
<div class="tool_sep"></div>
<se-button id="tool_clone" title="${i18next.t('tools.clone')}" shortcut="D" src="./images/clone.svg"></se-button>
<se-button id="tool_delete" title="${i18next.t('tools.del')}" shortcut="Delete/Backspace" src="./images/delete.svg">
</se-button>
</div>
<div class="toolset">
<se-button id="tool_text_anchor_start" title="${i18next.t('properties.text_anchor_start')}" src="./images/anchor_start.svg">
</se-button>
<se-button id="tool_text_anchor_middle" title="${i18next.t('properties.text_anchor_middle')}" src="./images/anchor_middle.svg">
</se-button>
<se-button id="tool_text_anchor_end" title="${i18next.t('properties.text_anchor_end')}" src="./images/anchor_end.svg">
</se-button>
<div class="tool_sep"></div>
<se-button id="tool_move_top" title="${i18next.t('tools.move_top')}" shortcut="Ctrl+Shift+]" src="./images/move_top.svg">
</se-button>
<se-button id="tool_move_bottom" title="${i18next.t('tools.move_bottom')}" shortcut="Ctrl+Shift+[" src="./images/move_bottom.svg">
</se-button>
</div>
<div class="toolset">
<se-button id="tool_topath" title="${i18next.t('tools.to_path')}" src="./images/to_path.svg"></se-button>
<se-button id="tool_reorient" title="${i18next.t('tools.reorient_path')}" src="./images/reorient.svg"></se-button>
<se-button id="tool_make_link" title="${i18next.t('tools.make_link')}" src="./images/globe_link.svg"></se-button>
</div>
<div class="toolset">
<div class="tool_sep"></div>
<se-input id="elem_id" data-attr="id" size="10" label="id" title="${i18next.t('properties.id')}"></se-input>
</div>
<div class="toolset">
<se-input id="elem_class" data-attr="class" size="10" label="class" title="${i18next.t('properties.class')}"></se-input>
</div>
<se-spin-input size="3" id="angle" min=-180 max=180 step=5 src="./images/angle.svg"
title="${i18next.t('properties.angle')}"></se-spin-input>
<se-spin-input size="2" id="blur" min=0 max=100 step=5 src="./images/blur.svg"
title="${i18next.t('properties.blur')}"></se-spin-input>
<se-list id="tool_position" title="${i18next.t('tools.align_to_page')}" label="" width="22px" height="24px">
<se-list-item id="tool_posleft" value="l">
<img title="${i18next.t('tools.align_left')}" src="./images/align_left.svg" height="22px">
</se-list-item>
<se-list-item id="tool_poscenter" value="c">
<img title="${i18next.t('tools.align_center')}" src="./images/align_center.svg" height="22px">
</se-list-item>
<se-list-item id="tool_posright" value="r">
<img title="${i18next.t('tools.align_right')}" src="./images/align_right.svg" height="22px">
</se-list-item>
<se-list-item id="tool_postop" value="t">
<img title="${i18next.t('tools.align_top')}" src="./images/align_top.svg" height="22px">
</se-list-item>
<se-list-item id="tool_posmiddle" value="m">
<img title="${i18next.t('tools.align_middle')}" src="./images/align_middle.svg" height="22px">
</se-list-item>
<se-list-item id="tool_posbottom" value="b">
<img title="${i18next.t('tools.align_bottom')}" src="./images/align_bottom.svg" height="22px">
</se-list-item>
</se-list>
<div id="xy_panel" class="toolset">
<se-spin-input id="selected_x" data-attr="x" size="4" type="text" label="x" title="${i18next.t('properties.pos_x')}">
</se-spin-input>
<se-spin-input id="selected_y" data-attr="y" size="4" type="text" label="y" title="${i18next.t('properties.pos_y')}">
</se-spin-input>
</div>
</div> <!-- selected_panel -->
<!-- Buttons when multiple elements are selected -->
<div id="multiselected_panel">
<div class="tool_sep"></div>
<se-button id="tool_clone_multi" title="${i18next.t('tools.clone')}" shortcut="C" src="./images/clone.svg"></se-button>
<se-button id="tool_delete_multi" title="${i18next.t('tools.del')}" shortcut="Delete/Backspace"
src="./images/delete.svg"></se-button>
<div class="tool_sep"></div>
<se-button id="tool_group_elements" title="${i18next.t('tools.group_elements')}" shortcut="G" src="./images/group_elements.svg">
</se-button>
<se-button id="tool_make_link_multi" title="${i18next.t('tools.make_link')}" src="./images/globe_link.svg"></se-button>
<se-button id="tool_align_left" title="${i18next.t('tools.align_left')}" src="./images/align_left.svg"></se-button>
<se-button id="tool_align_center" title="${i18next.t('tools.align_center')}" src="./images/align_center.svg"></se-button>
<se-button id="tool_align_right" title="${i18next.t('tools.align_right')}" src="./images/align_right.svg"></se-button>
<se-button id="tool_align_top" title="${i18next.t('tools.align_top')}" src="./images/align_top.svg"></se-button>
<se-button id="tool_align_middle" title="${i18next.t('tools.align_middle')}" src="./images/align_middle.svg"></se-button>
<se-button id="tool_align_bottom" title="${i18next.t('tools.align_bottom')}" src="./images/align_bottom.svg"></se-button>
<se-list id="tool_align_relative" label="relative to:">
<se-list-item id="selected_objects" value="selected">${i18next.t('tools.selected_objects')}</se-list-item>
<se-list-item id="largest_object" value="largest">${i18next.t('tools.largest_object')}</se-list-item>
<se-list-item id="smallest_object" value="smallest">${i18next.t('tools.smallest_object')}</se-list-item>
<se-list-item id="page" value="page">${i18next.t('tools.page')}</se-list-item>
</se-list>
<div class="tool_sep"></div>
</div> <!-- multiselected_panel -->
<div id="rect_panel">
<div class="toolset">
<se-spin-input id="rect_width" data-attr="width" size="4" label="w" title="${i18next.t('properties.rect_width')}">
</se-spin-input>
<se-spin-input id="rect_height" data-attr="height" size="4" label="h" title="${i18next.t('properties.rect_height')}">
</se-spin-input>
</div>
<se-spin-input id="rect_rx" min=0 max=1000 step=1 size="3" title="${i18next.t('properties.corner_radius')}"
data-attr="Corner Radius" src="./images/c_radius.svg"></se-spin-input>
</div> <!-- rect_panel -->
<div id="image_panel">
<div class="toolset">
<se-spin-input id="image_width" data-attr="width" size="4" type="text" label="w" title="${i18next.t('properties.image_width')}">
</se-spin-input>
<se-spin-input id="image_height" data-attr="height" size="4" type="text" label="h"
title="${i18next.t('properties.image_height')}"></se-spin-input>
</div>
<div class="toolset">
<label id="tool_image_url">url:
<input id="image_url" type="text" title="${i18next.t('properties.image_url')}" size="35" />
</label>
<label id="tool_change_image">
<button id="change_image_url" style="display: none;">Change Image</button>
<span id="url_notice"
title="${i18next.t('tools.no_embed')}"></span>
</label>
</div>
</div> <!-- image_panel -->
<div id="circle_panel">
<div class="toolset">
<se-spin-input id="circle_cx" data-attr="cx" size="4" label="cx"></se-spin-input>
<se-spin-input id="circle_cy" data-attr="cy" size="4" label="cy"></se-spin-input>
</div>
<div class="toolset">
<se-spin-input id="circle_r" data-attr="r" size="4" label="r"></se-spin-input>
</div>
</div> <!-- circle_panel -->
<div id="ellipse_panel">
<div class="toolset">
<se-spin-input id="ellipse_cx" data-attr="cx" size="4" title="${i18next.t('properties.ellipse_cx')}" label="cx">
</se-spin-input>
<se-spin-input id="ellipse_cy" data-attr="cy" size="4" title="${i18next.t('properties.ellipse_cy')}" label="cy">
</se-spin-input>
</div>
<div class="toolset">
<se-spin-input id="ellipse_rx" data-attr="rx" size="4" title="${i18next.t('properties.ellipse_rx')}" label="rx">
</se-spin-input>
<se-spin-input id="ellipse_ry" data-attr="ry" size="4" title="${i18next.t('properties.ellipse_ry')}" label="ry">
</se-spin-input>
</div>
</div> <!-- ellipse_panel -->
<div id="line_panel">
<div class="toolset">
<se-spin-input id="line_x1" data-attr="x1" size="4" title="${i18next.t('properties.line_x1')}" label="x1">
</se-spin-input>
<se-spin-input id="line_y1" data-attr="y1" size="4" title="${i18next.t('properties.line_y1')}" label="y1">
</se-spin-input>
<se-spin-input id="line_x2" data-attr="x2" size="4" title="${i18next.t('properties.line_x2')}" label="x2">
</se-spin-input>
<se-spin-input id="line_y2" data-attr="y2" size="4" title="${i18next.t('properties.line_y2')}" label="y2">
</se-spin-input>
</div>
</div> <!-- line_panel -->
<div id="text_panel">
<div class="toolset">
<se-button id="tool_bold" title="${i18next.t('properties.bold')}" src="./images/bold.svg" shortcut="B"></se-button>
<se-button id="tool_italic" title="${i18next.t('properties.italic')}" src="./images/italic.svg" shortcut="I"></se-button>
</div>
<div class="toolset">
<se-button id="tool_text_anchor_start" title="${i18next.t('properties.text_anchor_start')}" src="./images/anchor_start.svg">
</se-button>
<se-button id="tool_text_anchor_middle" title="${i18next.t('properties.text_anchor_middle')}" src="./images/anchor_middle.svg">
</se-button>
<se-button id="tool_text_anchor_end" title="${i18next.t('properties.text_anchor_end')}" src="./images/anchor_end.svg">
</se-button>
</div>
<se-list id="tool_font_family" label="Font:">
<se-list-item value="Serif" style="font-family:serif;">${i18next.t('properties.serif')}</se-list-item>
<se-list-item value="Sans-serif" style="font-family:sans-serif;">${i18next.t('properties.sans_serif')}</se-list-item>
<se-list-item value="Cursive" style="font-family:cursive;">${i18next.t('properties.cursive')}</se-list-item>
<se-list-item value="Fantasy" style="font-family:fantasy;">${i18next.t('properties.fantasy')}</se-list-item>
<se-list-item value="Monospace" style="font-family:monospace;">${i18next.t('properties.monospace')}</se-list-item>
<se-list-item value="Courier" style="font-family:courier;">${i18next.t('properties.courier')} </se-list-item>
<se-list-item value="Helvetica" style="font-family:helvetica;">${i18next.t('properties.helvetica')}</se-list-item>
<se-list-item value="Times" style="font-family:times;">${i18next.t('properties.times')}</se-list-item>
<se-list-item value="Serif" style="font-family:serif;">${i18next.t('properties.serif')}</se-list-item>
<se-list-item value="Sans-serif" style="font-family:sans-serif;">${i18next.t('properties.sans_serif')}</se-list-item>
<se-list-item value="Cursive" style="font-family:cursive;">${i18next.t('properties.cursive')}</se-list-item>
<se-list-item value="Fantasy" style="font-family:fantasy;">${i18next.t('properties.fantasy')}</se-list-item>
<se-list-item value="Monospace" style="font-family:monospace;">${i18next.t('properties.monospace')}</se-list-item>
<se-list-item value="Courier" style="font-family:courier;">${i18next.t('properties.courier')} </se-list-item>
<se-list-item value="Helvetica" style="font-family:helvetica;">${i18next.t('properties.helvetica')}</se-list-item>
<se-list-item value="Times" style="font-family:times;">${i18next.t('properties.times')}</se-list-item>
</se-list>
<se-spin-input size="2" id="font_size" min=1 max=1000 step=1 title="${i18next.t('properties.font_size')}"
src="./images/fontsize.svg"></se-spin-input>
src="./images/fontsize.svg"></se-spin-input>
<!-- Not visible, but still used -->
<input id="text" type="text" size="35" />
</div> <!-- text_panel -->
<!-- formerly gsvg_panel -->
<div id="container_panel">
<div class="tool_sep"></div>
<!-- Add viewBox field here? -->
<label id="group_title" title="${i18next.t('ui.group_identify_label')}">
<span>label</span>
<input id="g_title" data-attr="title" size="10" type="text" />
</label>
</div> <!-- container_panel -->
<div id="use_panel">
<se-button id="tool_unlink_use" title="${i18next.t('tools.tool_unlink_use')}"
src="./images/unlink_use.svg">
</se-button>
</div> <!-- use_panel -->
<div id="g_panel">
<se-button id="tool_ungroup" title="${i18next.t('tools.ungroup')}" src="./images/ungroup.svg">
</se-button>
</div> <!-- g_panel -->
<!-- For anchor elements -->
<div id="a_panel">
<label id="tool_link_url" title="${i18next.t('tools.set_link_url')}">
<span id="linkLabel" class="icon_label"></span>
<input id="link_url" type="text" size="35" />
</label>
</div> <!-- a_panel -->
<div id="path_node_panel">
<div class="tool_sep"></div>
<se-button id="tool_node_link" title="${i18next.t('tools.node_link')}" src="./images/tool_node_link.svg" pressed>
</se-button>
<div class="tool_sep"></div>
<se-spin-input id="path_node_x" data-attr="x" size="4" title="${i18next.t('properties.node_x')}" label="x:">
</se-spin-input>
<se-spin-input id="path_node_y" data-attr="y" size="4" title="${i18next.t('properties.node_y')}" label="y:">
</se-spin-input>
<select id="seg_type" title="${i18next.t('tools.seg_type')}">
<option id="straight_segments" selected="selected" value="4">${i18next.t('properties.straight_segments')}</option>
<option id="curve_segments" value="6">${i18next.t('properties.curve_segments')}</option>
</select>
<se-button id="tool_node_clone" title="${i18next.t('tools.node_clone')}" src="./images/tool_node_clone.svg"></se-button>
<se-button id="tool_node_delete" title="${i18next.t('tools.node_delete')}" src="./images/tool_node_delete.svg"></se-button>
<se-button id="tool_openclose_path" title="${i18next.t('tools.openclose_path')}" src="./images/tool_openclose_path.svg">
</se-button>
<se-button id="tool_add_subpath" title="${i18next.t('tools.add_subpath')}" src="./images/tool_add_subpath.svg"></se-button>
</div> <!-- path_node_panel -->
<div id="cur_context_panel"></div>
</div> <!-- tools_top -->
<!-- formerly gsvg_panel -->
<div id="container_panel">
<div class="tool_sep"></div>
<!-- Add viewBox field here? -->
<label id="group_title" title="${i18next.t('ui.group_identify_label')}">
<span>label</span>
<input id="g_title" data-attr="title" size="10" type="text" />
</label>
</div> <!-- container_panel -->
<div id="use_panel">
<se-button id="tool_unlink_use" title="${i18next.t('tools.tool_unlink_use')}"
src="./images/unlink_use.svg">
</se-button>
</div> <!-- use_panel -->
<div id="g_panel">
<se-button id="tool_ungroup" title="${i18next.t('tools.ungroup')}" src="./images/ungroup.svg">
</se-button>
</div> <!-- g_panel -->
<!-- For anchor elements -->
<div id="a_panel">
<label id="tool_link_url" title="${i18next.t('tools.set_link_url')}">
<span id="linkLabel" class="icon_label"></span>
<input id="link_url" type="text" size="35" />
</label>
</div> <!-- a_panel -->
<div id="path_node_panel">
<div class="tool_sep"></div>
<se-button id="tool_node_link" title="${i18next.t('tools.node_link')}" src="./images/tool_node_link.svg" pressed>
</se-button>
<div class="tool_sep"></div>
<se-spin-input id="path_node_x" data-attr="x" size="4" title="${i18next.t('properties.node_x')}" label="x:">
</se-spin-input>
<se-spin-input id="path_node_y" data-attr="y" size="4" title="${i18next.t('properties.node_y')}" label="y:">
</se-spin-input>
<select id="seg_type" title="${i18next.t('tools.seg_type')}">
<option id="straight_segments" selected="selected" value="4">${i18next.t('properties.straight_segments')}</option>
<option id="curve_segments" value="6">${i18next.t('properties.curve_segments')}</option>
</select>
<se-button id="tool_node_clone" title="${i18next.t('tools.node_clone')}" src="./images/tool_node_clone.svg"></se-button>
<se-button id="tool_node_delete" title="${i18next.t('tools.node_delete')}" src="./images/tool_node_delete.svg"></se-button>
<se-button id="tool_openclose_path" title="${i18next.t('tools.openclose_path')}" src="./images/tool_openclose_path.svg">
</se-button>
<se-button id="tool_add_subpath" title="${i18next.t('tools.add_subpath')}" src="./images/tool_add_subpath.svg"></se-button>
</div> <!-- path_node_panel -->
<div id="cur_context_panel"></div>
</div>
`;
this.editor.$svgEditor.append(template.content.cloneNode(true));
// svg editor source dialoag added to DOM
@ -996,7 +996,7 @@ class TopPanel {
"se-svg-source-editor-dialog"
);
newSeEditorDialog.setAttribute("id", "se-svg-editor-dialog");
this.editor.$svgEditor.append(newSeEditorDialog);
this.editor.$container.append(newSeEditorDialog);
newSeEditorDialog.init(i18next);
// register action to top panel buttons
$id("tool_source").addEventListener(

View File

@ -1,4 +1,4 @@
:root{
:root {
--main-bg-color: #72797A;
--text-color: #000000;
--border-color: #808080;
@ -10,26 +10,50 @@
--input-color: #B2B2B2;
}
body {
background: var(--main-bg-color);
}
html, body, div{
user-select: text;
}
.svg_editor * {
transform-origin: 0 0;
}
.svg_editor {
display: grid;
grid-template-rows: 40px 1fr 40px;
grid-template-columns: 34px 1fr 10px;
grid-template-areas: "top top top" "left workarea side" "left bottom bottom";
font-size: 8pt;
background: var(--main-bg-color);
font-family: Verdana, Helvetica, Arial;
color: var(--text-color);
user-select: text;
width: 100%;
height: 100%;
}
#svgroot {
user-select: none;
position: absolute;
top: 0;
left: 0;
}
#workarea {
grid-area: workarea;
background-color: #A0A0A0;
border: 1px solid var(--border-color);
overflow: auto;
text-align: center;
}
#svgcanvas {
line-height: normal;
display: inline-block;
background: var(--canvas-bg-color);
text-align: center;
vertical-align: middle;
position:relative;
}
a {
color:var(--link-color);
color: var(--link-color);
}
hr {
@ -37,14 +61,14 @@ hr {
border-bottom: 1px solid var(--border-color);
}
#linkLabel > svg {
#linkLabel>svg {
height: 20px;
padding-top: 4px;
}
#sidepanels {
display: inline-block;
position:absolute;
position: absolute;
top: 40px;
bottom: 40px;
right: 0;
@ -54,13 +78,13 @@ hr {
border-style: solid;
border-width: 1px;
border-left: none;
overflow-x:hidden;
overflow-y:visible;
overflow-x: hidden;
overflow-y: visible;
}
#layerpanel {
display: inline-block;
position:relative;
position: relative;
top: 0px;
bottom: 0;
left: 12px;
@ -70,11 +94,6 @@ hr {
user-select: none;
}
/*
border-style: solid;
border-color: #666;
border-width: 0px 0px 0px 1px;
*/
#sidepanel_handle {
display: inline-block;
position: absolute;
@ -95,6 +114,7 @@ hr {
cursor: pointer;
user-select: none;
}
#layerbuttons {
margin: 0;
padding: 0;
@ -175,12 +195,11 @@ hr {
*/
#main_button {
position: absolute;
top: 4px;
left: 5px;
z-index: 5;
grid-area: top;
color: #fff;
border-radius: 3px;
padding-block: 2px;
padding-left: 3px;
}
#main_button:hover {
@ -218,7 +237,7 @@ hr {
height: 28px;
}
#main_icon > div {
#main_icon>div {
float: left;
}
@ -258,15 +277,14 @@ hr {
top: -9px;
}
#main_menu ul,
#main_menu li {
#main_menu ul, #main_menu li {
list-style: none;
margin: 0;
padding: 0;
}
#main_menu li {
/* height: 35px;*/
/* height: 35px;*/
line-height: 22px;
padding-top: 7px;
padding-left: 7px;
@ -279,7 +297,7 @@ hr {
background: #FFC;
}
#main_menu li > div {
#main_menu li>div {
float: left;
padding-right: 5px;
}
@ -291,46 +309,21 @@ hr {
/*—————————————————————————————*/
#tools_top {
position: absolute;
left: 96px;
top: 2px;
min-height: 40px;
border-bottom: none;
overflow: visible;
right:1px;
}
#tools_top .tool_sep {
margin-top: 5px;
}
#tools_top > div > * {
float: left;
}
#tools_top se-input {
margin-top: 5px;
height: 34px;
}
#tools_top se-spin-input, #tools_top se-list {
margin-top: 0;
height: 34px;
grid-area: top;
display: flex;
flex-direction: row;
/* leave space for the main menu */
position: relative;
top: 5px;
left: 95px;
}
#tools_top se-dropdown-list {
margin-top: 5px;
height: 34px;
#tools_top > *{
display:flex;
flex-direction: row;
}
/*—————————————————————————————*/
#tools_bottom {
position: absolute;
left: 40px;
right: 0;
bottom: 0;
height: 33px;
grid-area: bottom;
overflow: visible;
}
@ -342,25 +335,19 @@ hr {
#tools_bottom se-spin-input {
float: left;
vertical-align: middle;
display:flex;
display: flex;
align-items: center;
}
#tools_bottom elix-dropdown-list{
width:22px;
#tools_bottom elix-dropdown-list {
width: 22px;
}
/*—————————————————————————————*/
#tools_left {
position: absolute;
grid-area: left;
border-right: none;
width: 32px;
top: 40px;
left: 1px;
margin-top: -2px;
padding-left: 2px;
background: --main-bg-color;
z-index: 4;
}
/*—————————————————————————————*/
@ -381,7 +368,7 @@ hr {
stroke: none;
}
#workarea.wireframe #canvasBackground > rect {
#workarea.wireframe #canvasBackground>rect {
fill: #FFF !important;
}
@ -395,6 +382,7 @@ hr {
}
/*TODO: Adjust position of rulers are not visible*/
#cur_context_panel {
position: absolute;
top: 57px;
@ -418,22 +406,11 @@ hr {
text-decoration: underline;
}
div.toolset, div.toolset > * {
float: left;
.toolset {
display: flex;
flex-direction: row;
}
div.toolset {
height: 34px;
}
div.toolset label span {
/* outline: 1px solid red;*/
padding-top: 3px;
display: inline-block;
}
input[type=text] {
padding: 2px;
}
@ -509,7 +486,7 @@ input[type=text] {
margin-right: 0;
}
#main_menu li#tool_open, #main_menu li#tool_import {
#main_menu li#tool_open, #main_menu li#tool_import {
position: relative;
overflow: hidden;
}
@ -518,16 +495,15 @@ input[type=text] {
overflow: hidden;
}
#tool_open input,
#tool_import input,
#tool_image input {
#tool_open input, #tool_import input, #tool_image input {
position: absolute;
opacity: 0;
font-size: 10em;
top: -5px;
right: -5px;
margin: 0;
cursor: pointer; /* Sadly doesn't appear to have an effect */
cursor: pointer;
/* Sadly doesn't appear to have an effect */
}
.disabled {
@ -536,12 +512,8 @@ input[type=text] {
}
.tool_sep {
width: 1px;
background: #888;
border-left: 1px outset #EEE;
margin: 2px 3px;
padding: 0;
height: 24px;
margin: 6px 2px;
}
.width_label {
@ -562,7 +534,6 @@ input[type=text] {
width: 22px;
}
#palette {
float: right;
}
@ -598,7 +569,9 @@ input[type=text] {
background: white;
}
#tool_opacity { right: 0;}
#tool_opacity {
right: 0;
}
#tool_opacity {
overflow: visible;
@ -608,7 +581,7 @@ ul li.current {
background-color: #F4E284;
}
#copyright {
#copyright {
text-align: right;
padding-right: .3em;
}
@ -660,22 +633,9 @@ ul li.current {
#workarea, #sidepanels {
top: 70px !important;
}
#rulers #ruler_corner,
#rulers #ruler_x, #tools_left {
top: 71px;
}
#rulers #ruler_y {
top: 86px;
}
#cur_context_panel {
top: 87px;
}
#selected_panel {
clear: right;
}
}
@media screen and (max-width:1100px) {

View File

@ -1,46 +1,11 @@
const editorTemplate = document.createElement('template');
editorTemplate.innerHTML = `
<style>
#svgroot {
-moz-user-select: none;
-webkit-user-select: none;
position: absolute;
top: 0;
left: 0;
}
#workarea {
display: inline-table-cell;
position:absolute;
top: 40px;
left: 40px;
bottom: 40px;
right: 14px;
background-color: #A0A0A0;
border: 1px solid var(--border-color);
overflow: auto;
text-align: center;
}
#svgcanvas {
line-height: normal;
display: inline-block;
background: var(--canvas-bg-color);
text-align: center;
vertical-align: middle;
width: 640px;
height: 480px;
/* for widget regions that shouldn't react to dragging */
-apple-dashboard-region:dashboard-region(control rectangle 0px 0px 0px 0px);
position: relative;
}
</style>
</div>
<div id="workarea">
<div id="svgcanvas" style="position: relative;">
</div>
</div>
<div class="svg_editor">
<div id="workarea">
<div id="svgcanvas"></div>
</div>
</div>
`;
export default editorTemplate;

View File

@ -5,9 +5,11 @@ rulersTemplate.innerHTML = `
/* Rulers
*/
#rulers {
position: relative;
top: -14px;
}
#rulers > div {
position: absolute;
background: var(--ruler-color);
z-index: 1;
overflow: hidden;
@ -54,32 +56,20 @@ rulersTemplate.innerHTML = `
#ruler_y > div {
overflow: hidden;
}
/*
@media screen and (max-width: 1250px) {
#rulers #ruler_corner,
#rulers #ruler_x {
top: 71px;
}
#rulers #ruler_y {
top: 57px;
}
}
*/
</style>
<div id="rulers">
<div id="ruler_corner"></div>
<div id="ruler_x">
<div>
<canvas height="15"></canvas>
</div>
</div>
<div id="ruler_y">
<div>
<canvas width="15"></canvas>
</div>
</div>
</div>
<div id="ruler_corner"></div>
<div id="ruler_x">
<div>
<canvas height="15"></canvas>
</div>
</div>
<div id="ruler_y">
<div>
<canvas width="15"></canvas>
</div>
</div>
</div>
`;
export default rulersTemplate;