change to css grid
parent
b048afb72e
commit
cfb47fa952
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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">
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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>
|
||||
`;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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>
|
||||
`;
|
||||
|
||||
/**
|
||||
|
|
|
@ -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", ""));
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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>
|
|
@ -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));
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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");
|
||||
|
@ -988,7 +988,7 @@ class TopPanel {
|
|||
<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 -->
|
||||
</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(
|
||||
|
|
|
@ -10,22 +10,46 @@
|
|||
--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 {
|
||||
|
@ -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 {
|
||||
|
@ -258,8 +277,7 @@ hr {
|
|||
top: -9px;
|
||||
}
|
||||
|
||||
#main_menu ul,
|
||||
#main_menu li {
|
||||
#main_menu ul, #main_menu li {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -345,6 +338,7 @@ hr {
|
|||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
#tools_bottom elix-dropdown-list {
|
||||
width: 22px;
|
||||
}
|
||||
|
@ -352,15 +346,8 @@ hr {
|
|||
/*—————————————————————————————*/
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
/*—————————————————————————————*/
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
|
|
@ -1,44 +1,9 @@
|
|||
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 class="svg_editor">
|
||||
<div id="workarea">
|
||||
<div id="svgcanvas" style="position: relative;">
|
||||
<div id="svgcanvas"></div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
|
|
@ -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,18 +56,6 @@ 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>
|
||||
|
|
Loading…
Reference in New Issue