merge
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
import './seButton.js';
|
import './seButton.js';
|
||||||
import './seFlyingButton.js';
|
import './seFlyingButton.js';
|
||||||
import './seExplorerButton.js';
|
import './seExplorerButton.js';
|
||||||
import './seDropdown.js';
|
import './seZoom.js';
|
||||||
import './seInput.js';
|
import './seInput.js';
|
||||||
import './seSpinInput.js';
|
import './seSpinInput.js';
|
||||||
import './sePalette.js';
|
import './sePalette.js';
|
||||||
import './seMenu.js';
|
import './seMenu.js';
|
||||||
import './seMenuItem.js';
|
import './seMenuItem.js';
|
||||||
|
import './seList.js';
|
||||||
|
import './seListItem.js';
|
||||||
import './seColorPicker.js';
|
import './seColorPicker.js';
|
||||||
|
|||||||
87
src/editor/components/seList.js
Normal file
87
src/editor/components/seList.js
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/* eslint-disable node/no-unpublished-import */
|
||||||
|
import 'elix/define/DropdownList.js';
|
||||||
|
|
||||||
|
const template = document.createElement('template');
|
||||||
|
template.innerHTML = `
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
<label>Label</label>
|
||||||
|
<elix-dropdown-list>
|
||||||
|
<slot></slot>
|
||||||
|
</elix-dropdown-list>
|
||||||
|
|
||||||
|
`;
|
||||||
|
/**
|
||||||
|
* @class SeList
|
||||||
|
*/
|
||||||
|
export class SeList extends HTMLElement {
|
||||||
|
/**
|
||||||
|
* @function constructor
|
||||||
|
*/
|
||||||
|
constructor () {
|
||||||
|
super();
|
||||||
|
// create the shadowDom and insert the template
|
||||||
|
this._shadowRoot = this.attachShadow({mode: 'open'});
|
||||||
|
this._shadowRoot.appendChild(template.content.cloneNode(true));
|
||||||
|
this.$dropdown = this._shadowRoot.querySelector('elix-dropdown-list');
|
||||||
|
this.$label = this._shadowRoot.querySelector('label');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function observedAttributes
|
||||||
|
* @returns {any} observed
|
||||||
|
*/
|
||||||
|
static get observedAttributes () {
|
||||||
|
return ['label'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function attributeChangedCallback
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} oldValue
|
||||||
|
* @param {string} newValue
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
attributeChangedCallback (name, oldValue, newValue) {
|
||||||
|
if (oldValue === newValue) return;
|
||||||
|
switch (name) {
|
||||||
|
case 'label':
|
||||||
|
this.$label.textContent = newValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`unknown attribute: ${name}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
get label () {
|
||||||
|
return this.getAttribute('label');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function set
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set label (value) {
|
||||||
|
this.setAttribute('label', value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function connectedCallback
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
connectedCallback () {
|
||||||
|
this.$dropdown.addEventListener('change', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const selectedItem = e?.detail?.closeResult;
|
||||||
|
if (selectedItem !== undefined && selectedItem?.id !== undefined) {
|
||||||
|
document.getElementById(selectedItem.id).click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register
|
||||||
|
customElements.define('se-list', SeList);
|
||||||
71
src/editor/components/seListItem.js
Normal file
71
src/editor/components/seListItem.js
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
/* eslint-disable node/no-unpublished-import */
|
||||||
|
import 'elix/define/Option.js';
|
||||||
|
|
||||||
|
const template = document.createElement('template');
|
||||||
|
template.innerHTML = `
|
||||||
|
<style>
|
||||||
|
</style>
|
||||||
|
<elix-option aria-label="option">
|
||||||
|
<slot></slot>
|
||||||
|
</elix-option>
|
||||||
|
`;
|
||||||
|
/**
|
||||||
|
* @class SeMenu
|
||||||
|
*/
|
||||||
|
export class SeListItem extends HTMLElement {
|
||||||
|
/**
|
||||||
|
* @function constructor
|
||||||
|
*/
|
||||||
|
constructor () {
|
||||||
|
super();
|
||||||
|
// create the shadowDom and insert the template
|
||||||
|
this._shadowRoot = this.attachShadow({mode: 'open'});
|
||||||
|
this._shadowRoot.appendChild(template.content.cloneNode(true));
|
||||||
|
this.$menuitem = this._shadowRoot.querySelector('elix-menu-item');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function observedAttributes
|
||||||
|
* @returns {any} observed
|
||||||
|
*/
|
||||||
|
static get observedAttributes () {
|
||||||
|
return ['option'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function attributeChangedCallback
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} oldValue
|
||||||
|
* @param {string} newValue
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
attributeChangedCallback (name, oldValue, newValue) {
|
||||||
|
if (oldValue === newValue) return;
|
||||||
|
switch (name) {
|
||||||
|
case 'option':
|
||||||
|
this.$menuitem.setAttribute('option', newValue);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
|
console.error(`unknown attribute: ${name}`);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
get option () {
|
||||||
|
return this.getAttribute('option');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function set
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set option (value) {
|
||||||
|
this.setAttribute('option', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register
|
||||||
|
customElements.define('se-list-item', SeListItem);
|
||||||
179
src/editor/components/seZoom.js
Normal file
179
src/editor/components/seZoom.js
Normal file
@@ -0,0 +1,179 @@
|
|||||||
|
/* eslint-disable node/no-unpublished-import */
|
||||||
|
import ListComboBox from 'elix/define/ListComboBox.js';
|
||||||
|
import NumberSpinBox from 'elix/define/NumberSpinBox.js';
|
||||||
|
// import Input from 'elix/src/base/Input.js';
|
||||||
|
import * as internal from 'elix/src/base/internal.js';
|
||||||
|
import {templateFrom, fragmentFrom} from 'elix/src/core/htmlLiterals.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @class Dropdown
|
||||||
|
*/
|
||||||
|
class Zoom extends ListComboBox {
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {PlainObject}
|
||||||
|
*/
|
||||||
|
get [internal.defaultState] () {
|
||||||
|
return Object.assign(super[internal.defaultState], {
|
||||||
|
inputPartType: NumberSpinBox,
|
||||||
|
src: './images/logo.svg',
|
||||||
|
inputsize: '100%'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {PlainObject}
|
||||||
|
*/
|
||||||
|
get [internal.template] () {
|
||||||
|
const result = super[internal.template];
|
||||||
|
const source = result.content.getElementById('source');
|
||||||
|
// add a icon before our dropdown
|
||||||
|
source.prepend(fragmentFrom.html`
|
||||||
|
<img src="./images/logo.svg" alt="icon" width="18" height="18"></img>
|
||||||
|
`.cloneNode(true));
|
||||||
|
// change the style so it fits in our toolbar
|
||||||
|
result.content.append(
|
||||||
|
templateFrom.html`
|
||||||
|
<style>
|
||||||
|
[part~="source"] {
|
||||||
|
grid-template-columns: 20px 1fr auto;
|
||||||
|
}
|
||||||
|
::slotted(*) {
|
||||||
|
padding: 4px;
|
||||||
|
background: #E8E8E8;
|
||||||
|
border: 1px solid #B0B0B0;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
[part~="popup"] {
|
||||||
|
width: 150%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
`.content
|
||||||
|
);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function observedAttributes
|
||||||
|
* @returns {any} observed
|
||||||
|
*/
|
||||||
|
static get observedAttributes () {
|
||||||
|
return ['title', 'src', 'inputsize', 'value'];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function attributeChangedCallback
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} oldValue
|
||||||
|
* @param {string} newValue
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
attributeChangedCallback (name, oldValue, newValue) {
|
||||||
|
if (oldValue === newValue) return;
|
||||||
|
switch (name) {
|
||||||
|
case 'title':
|
||||||
|
// this.$span.setAttribute('title', `${newValue} ${shortcut ? `[${shortcut}]` : ''}`);
|
||||||
|
break;
|
||||||
|
case 'src':
|
||||||
|
this.src = newValue;
|
||||||
|
break;
|
||||||
|
case 'inputsize':
|
||||||
|
this.inputsize = newValue;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
super.attributeChangedCallback(name, oldValue, newValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function [internal.render]
|
||||||
|
* @param {PlainObject} changed
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
[internal.render] (changed) {
|
||||||
|
super[internal.render](changed);
|
||||||
|
if (this[internal.firstRender]) {
|
||||||
|
this.$img = this.shadowRoot.querySelector('img');
|
||||||
|
this.$input = this.shadowRoot.getElementById('input');
|
||||||
|
}
|
||||||
|
if (changed.src) {
|
||||||
|
this.$img.setAttribute('src', this[internal.state].src);
|
||||||
|
}
|
||||||
|
if (changed.inputsize) {
|
||||||
|
this.$input.shadowRoot.querySelector('[part~="input"]').style.width = this[internal.state].inputsize;
|
||||||
|
}
|
||||||
|
if (changed.inputPartType) {
|
||||||
|
// Wire up handler on new input.
|
||||||
|
this.addEventListener('close', (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
const value = e.detail?.closeResult?.getAttribute('value');
|
||||||
|
if (value) {
|
||||||
|
const closeEvent = new CustomEvent('change', {detail: {value}});
|
||||||
|
this.dispatchEvent(closeEvent);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function src
|
||||||
|
* @returns {string} src
|
||||||
|
*/
|
||||||
|
get src () {
|
||||||
|
return this[internal.state].src;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function src
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set src (src) {
|
||||||
|
this[internal.setState]({src});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function inputsize
|
||||||
|
* @returns {string} src
|
||||||
|
*/
|
||||||
|
get inputsize () {
|
||||||
|
return this[internal.state].inputsize;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function src
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set inputsize (inputsize) {
|
||||||
|
this[internal.setState]({inputsize});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function value
|
||||||
|
* @returns {string} src
|
||||||
|
*/
|
||||||
|
get value () {
|
||||||
|
return this[internal.state].value;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function value
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set value (value) {
|
||||||
|
this[internal.setState]({value});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register
|
||||||
|
customElements.define('se-zoom', Zoom);
|
||||||
|
|
||||||
|
/*
|
||||||
|
{TODO
|
||||||
|
min: 0.001, max: 10000, step: 50, stepfunc: stepZoom,
|
||||||
|
function stepZoom (elem, step) {
|
||||||
|
const origVal = Number(elem.value);
|
||||||
|
if (origVal === 0) { return 100; }
|
||||||
|
const sugVal = origVal + step;
|
||||||
|
if (step === 0) { return origVal; }
|
||||||
|
|
||||||
|
if (origVal >= 100) {
|
||||||
|
return sugVal;
|
||||||
|
}
|
||||||
|
if (sugVal >= origVal) {
|
||||||
|
return origVal * 2;
|
||||||
|
}
|
||||||
|
return origVal / 2;
|
||||||
|
}
|
||||||
|
*/
|
||||||
@@ -4,3 +4,7 @@ import './svgSourceDialog.js';
|
|||||||
import './cmenuDialog.js';
|
import './cmenuDialog.js';
|
||||||
import './cmenuLayersDialog.js';
|
import './cmenuLayersDialog.js';
|
||||||
import './seSelectDialog.js';
|
import './seSelectDialog.js';
|
||||||
|
import './seConfirmDialog.js';
|
||||||
|
import './sePromptDialog.js';
|
||||||
|
import './seAlertDialog.js';
|
||||||
|
import './storageDialog.js';
|
||||||
|
|||||||
11
src/editor/dialogs/seAlertDialog.js
Normal file
11
src/editor/dialogs/seAlertDialog.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
// eslint-disable-next-line node/no-unpublished-import
|
||||||
|
import AlertDialog from 'elix/define/AlertDialog.js';
|
||||||
|
|
||||||
|
const dialog = new AlertDialog();
|
||||||
|
const seAlert = (type, text) => {
|
||||||
|
dialog.textContent = text;
|
||||||
|
dialog.choices = (type === 'alert') ? ['Ok'] : ['Cancel'];
|
||||||
|
dialog.open();
|
||||||
|
};
|
||||||
|
|
||||||
|
window.seAlert = seAlert;
|
||||||
13
src/editor/dialogs/seConfirmDialog.js
Normal file
13
src/editor/dialogs/seConfirmDialog.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
// eslint-disable-next-line node/no-unpublished-import
|
||||||
|
import AlertDialog from 'elix/define/AlertDialog.js';
|
||||||
|
|
||||||
|
const dialog = new AlertDialog();
|
||||||
|
const seConfirm = async (text, choices) => {
|
||||||
|
dialog.textContent = text;
|
||||||
|
dialog.choices = (choices === undefined) ? ['Ok', 'Cancel'] : choices;
|
||||||
|
dialog.open();
|
||||||
|
const response = await dialog.whenClosed();
|
||||||
|
return response.choice;
|
||||||
|
};
|
||||||
|
|
||||||
|
window.seConfirm = seConfirm;
|
||||||
83
src/editor/dialogs/sePromptDialog.js
Normal file
83
src/editor/dialogs/sePromptDialog.js
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
// eslint-disable-next-line node/no-unpublished-import
|
||||||
|
import AlertDialog from 'elix/define/AlertDialog.js';
|
||||||
|
/**
|
||||||
|
* @class SePromptDialog
|
||||||
|
*/
|
||||||
|
export class SePromptDialog extends HTMLElement {
|
||||||
|
/**
|
||||||
|
* @function constructor
|
||||||
|
*/
|
||||||
|
constructor () {
|
||||||
|
super();
|
||||||
|
// create the shadowDom and insert the template
|
||||||
|
this._shadowRoot = this.attachShadow({mode: 'open'});
|
||||||
|
this.dialog = new AlertDialog();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function observedAttributes
|
||||||
|
* @returns {any} observed
|
||||||
|
*/
|
||||||
|
static get observedAttributes () {
|
||||||
|
return ['title', 'close'];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function attributeChangedCallback
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} oldValue
|
||||||
|
* @param {string} newValue
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
attributeChangedCallback (name, oldValue, newValue) {
|
||||||
|
switch (name) {
|
||||||
|
case 'title':
|
||||||
|
if (this.dialog.opened) {
|
||||||
|
this.dialog.close();
|
||||||
|
}
|
||||||
|
this.dialog.textContent = newValue;
|
||||||
|
this.dialog.choices = ['Cancel'];
|
||||||
|
this.dialog.open();
|
||||||
|
break;
|
||||||
|
case 'close':
|
||||||
|
if (this.dialog.opened) {
|
||||||
|
this.dialog.close();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.error('unkonw attr for:', name, 'newValue =', newValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
get title () {
|
||||||
|
return this.getAttribute('title');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function set
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set title (value) {
|
||||||
|
this.setAttribute('title', value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
get close () {
|
||||||
|
return this.getAttribute('close');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @function set
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set close (value) {
|
||||||
|
this.setAttribute('close', value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register
|
||||||
|
customElements.define('se-prompt-dialog', SePromptDialog);
|
||||||
166
src/editor/dialogs/storageDialog.js
Normal file
166
src/editor/dialogs/storageDialog.js
Normal file
@@ -0,0 +1,166 @@
|
|||||||
|
/* eslint-disable node/no-unpublished-import */
|
||||||
|
import 'elix/define/Dialog.js';
|
||||||
|
|
||||||
|
const template = document.createElement('template');
|
||||||
|
template.innerHTML = `
|
||||||
|
<style>
|
||||||
|
|
||||||
|
#dialog_content {
|
||||||
|
margin: 10px 10px 5px 10px;
|
||||||
|
background: #DDD;
|
||||||
|
overflow: auto;
|
||||||
|
text-align: left;
|
||||||
|
border: 1px solid #B0B0B0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dialog_content p, #dialog_content select, #dialog_content label {
|
||||||
|
margin: 10px;
|
||||||
|
line-height: 1.3em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dialog_container {
|
||||||
|
font-family: Verdana;
|
||||||
|
text-align: center;
|
||||||
|
left: 50%;
|
||||||
|
top: 50%;
|
||||||
|
max-width: 400px;
|
||||||
|
z-index: 50001;
|
||||||
|
background: #CCC;
|
||||||
|
border: 1px outset #777;
|
||||||
|
font-family:Verdana,Helvetica,sans-serif;
|
||||||
|
font-size:0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dialog_container, #dialog_content {
|
||||||
|
border-radius: 5px;
|
||||||
|
-moz-border-radius: 5px;
|
||||||
|
-webkit-border-radius: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dialog_buttons input[type=text] {
|
||||||
|
width: 90%;
|
||||||
|
display: block;
|
||||||
|
margin: 0 0 5px 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#dialog_buttons input[type=button] {
|
||||||
|
margin: 0 1em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<elix-dialog id="dialog_box" aria-label="SVG-Edit storage preferences" closed>
|
||||||
|
<div class="overlay"></div>
|
||||||
|
<div id="dialog_container">
|
||||||
|
<div id="dialog_content">
|
||||||
|
<p>
|
||||||
|
By default and where supported, SVG-Edit can store your editor preferences and SVG content locally on your machine so you do not need to add these back each time you load SVG-Edit. If, for privacy reasons, you do not wish to store this information on your machine, you can change away from the default option below.
|
||||||
|
</p>
|
||||||
|
<select id="se-storage-pref">
|
||||||
|
<option value="prefsAndContent" id="js-storage" disabled>Store preferences and SVG content locally</option>
|
||||||
|
<option value="prefsOnly">Only store preferences locally</option>
|
||||||
|
<option value="noPrefsOrContent">Do not store my preferences or SVG content locally</option>
|
||||||
|
</select>
|
||||||
|
<label title="If you choose to opt out of storage while remembering this choice, the URL will change so as to avoid asking again.">
|
||||||
|
Remember this choice?<input type="checkbox" id="se-remember" value="" checked>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div id="dialog_buttons">
|
||||||
|
<button id="storage_ok">
|
||||||
|
<img class="svg_icon" src="./images/ok.svg" alt="icon" width="16" height="16" />
|
||||||
|
Ok
|
||||||
|
</button>
|
||||||
|
<button id="storage_cancel">
|
||||||
|
<img class="svg_icon" src="./images/cancel.svg" alt="icon" width="16" height="16" />
|
||||||
|
Cancel
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</elix-dialog>
|
||||||
|
`;
|
||||||
|
/**
|
||||||
|
* @class SeStorageDialog
|
||||||
|
*/
|
||||||
|
export class SeStorageDialog extends HTMLElement {
|
||||||
|
/**
|
||||||
|
* @function constructor
|
||||||
|
*/
|
||||||
|
constructor () {
|
||||||
|
super();
|
||||||
|
// create the shadowDom and insert the template
|
||||||
|
this._shadowRoot = this.attachShadow({mode: 'open'});
|
||||||
|
this._shadowRoot.appendChild(template.content.cloneNode(true));
|
||||||
|
this.$dialog = this._shadowRoot.querySelector('#dialog_box');
|
||||||
|
this.$storage = this._shadowRoot.querySelector('#js-storage');
|
||||||
|
this.$okBtn = this._shadowRoot.querySelector('#storage_ok');
|
||||||
|
this.$cancelBtn = this._shadowRoot.querySelector('#storage_cancel');
|
||||||
|
this.$storageInput = this._shadowRoot.querySelector('#se-storage-pref');
|
||||||
|
this.$rememberInput = this._shadowRoot.querySelector('#se-remember');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function observedAttributes
|
||||||
|
* @returns {any} observed
|
||||||
|
*/
|
||||||
|
static get observedAttributes () {
|
||||||
|
return ['dialog', 'storage'];
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function attributeChangedCallback
|
||||||
|
* @param {string} name
|
||||||
|
* @param {string} oldValue
|
||||||
|
* @param {string} newValue
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
attributeChangedCallback (name, oldValue, newValue) {
|
||||||
|
switch (name) {
|
||||||
|
case 'dialog':
|
||||||
|
if (newValue === 'open') {
|
||||||
|
this.$dialog.open();
|
||||||
|
} else {
|
||||||
|
this.$dialog.close();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'storage':
|
||||||
|
if (newValue === 'true') {
|
||||||
|
this.$storageInput.options[0].disabled = false;
|
||||||
|
} else {
|
||||||
|
this.$storageInput.options[0].disabled = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// super.attributeChangedCallback(name, oldValue, newValue);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function get
|
||||||
|
* @returns {any}
|
||||||
|
*/
|
||||||
|
get dialog () {
|
||||||
|
return this.getAttribute('dialog');
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function set
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
set dialog (value) {
|
||||||
|
this.setAttribute('dialog', value);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @function connectedCallback
|
||||||
|
* @returns {void}
|
||||||
|
*/
|
||||||
|
connectedCallback () {
|
||||||
|
const onSubmitHandler = (e, action) => {
|
||||||
|
const triggerEvent = new CustomEvent('change', {detail: {
|
||||||
|
trigger: action,
|
||||||
|
select: this.$storageInput.value,
|
||||||
|
checkbox: this.$rememberInput.checked
|
||||||
|
}});
|
||||||
|
this.dispatchEvent(triggerEvent);
|
||||||
|
};
|
||||||
|
this.$okBtn.addEventListener('click', (evt) => onSubmitHandler(evt, 'ok'));
|
||||||
|
this.$cancelBtn.addEventListener('click', (evt) => onSubmitHandler(evt, 'cancel'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Register
|
||||||
|
customElements.define('se-storage-dialog', SeStorageDialog);
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
/* globals seSelect */
|
|
||||||
/**
|
/**
|
||||||
* @file ext-storage.js
|
* @file ext-storage.js
|
||||||
*
|
*
|
||||||
@@ -44,7 +43,6 @@ export default {
|
|||||||
// to change, set the "emptyStorageOnDecline" config setting to true
|
// to change, set the "emptyStorageOnDecline" config setting to true
|
||||||
// in svgedit-config-iife.js/svgedit-config-es.js.
|
// in svgedit-config-iife.js/svgedit-config-es.js.
|
||||||
const {
|
const {
|
||||||
emptyStorageOnDecline,
|
|
||||||
// When the code in svg-editor.js prevents local storage on load per
|
// When the code in svg-editor.js prevents local storage on load per
|
||||||
// user request, we also prevent storing on unload here so as to
|
// user request, we also prevent storing on unload here so as to
|
||||||
// avoid third-party sites making XSRF requests or providing links
|
// avoid third-party sites making XSRF requests or providing links
|
||||||
@@ -56,31 +54,8 @@ export default {
|
|||||||
// the "noStorageOnLoad" config setting to true in svgedit-config-*.js.
|
// the "noStorageOnLoad" config setting to true in svgedit-config-*.js.
|
||||||
noStorageOnLoad,
|
noStorageOnLoad,
|
||||||
forceStorage
|
forceStorage
|
||||||
} = svgEditor.configObj.curConfig;
|
} = svgEditor.curConfig;
|
||||||
const {storage, updateCanvas} = svgEditor;
|
const {storage} = svgEditor;
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace `storagePrompt` parameter within URL.
|
|
||||||
* @param {string} val
|
|
||||||
* @returns {void}
|
|
||||||
* @todo Replace the string manipulation with `searchParams.set`
|
|
||||||
*/
|
|
||||||
function replaceStoragePrompt (val) {
|
|
||||||
val = val ? 'storagePrompt=' + val : '';
|
|
||||||
const loc = top.location; // Allow this to work with the embedded editor as well
|
|
||||||
if (loc.href.includes('storagePrompt=')) {
|
|
||||||
/*
|
|
||||||
loc.href = loc.href.replace(/(?<sep>[&?])storagePrompt=[^&]*(?<amp>&?)/, function (n0, sep, amp) {
|
|
||||||
return (val ? sep : '') + val + (!val && amp ? sep : (amp || ''));
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
loc.href = loc.href.replace(/([&?])storagePrompt=[^&]*(&?)/, function (n0, n1, amp) {
|
|
||||||
return (val ? n1 : '') + val + (!val && amp ? n1 : (amp || ''));
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
loc.href += (loc.href.includes('?') ? '&' : '?') + val;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets SVG content as a string with "svgedit-" and the current
|
* Sets SVG content as a string with "svgedit-" and the current
|
||||||
@@ -99,40 +74,6 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the cookie to expire.
|
|
||||||
* @param {string} cookie
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function expireCookie (cookie) {
|
|
||||||
document.cookie = encodeURIComponent(cookie) + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Expire the storage cookie.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function removeStoragePrefCookie () {
|
|
||||||
expireCookie('svgeditstore');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Empties storage for each of the current preferences.
|
|
||||||
* @returns {void}
|
|
||||||
*/
|
|
||||||
function emptyStorage () {
|
|
||||||
setSVGContentStorage('');
|
|
||||||
Object.keys(svgEditor.curPrefs).forEach((name) => {
|
|
||||||
name = 'svg-edit-' + name;
|
|
||||||
if (storage) {
|
|
||||||
storage.removeItem(name);
|
|
||||||
}
|
|
||||||
expireCookie(name);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// emptyStorage();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for unloading: If and only if opted in by the user, set the content
|
* Listen for unloading: If and only if opted in by the user, set the content
|
||||||
* document and preferences into storage:
|
* document and preferences into storage:
|
||||||
@@ -180,12 +121,15 @@ export default {
|
|||||||
name: 'storage',
|
name: 'storage',
|
||||||
async langReady ({lang}) {
|
async langReady ({lang}) {
|
||||||
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
const storagePrompt = new URL(top.location).searchParams.get('storagePrompt');
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
const strings = await loadExtensionTranslation(svgEditor.pref('lang'));
|
const strings = await loadExtensionTranslation(svgEditor.pref('lang'));
|
||||||
|
/*
|
||||||
const {
|
const {
|
||||||
message /* , storagePrefsAndContent, storagePrefsOnly,
|
message, storagePrefsAndContent, storagePrefsOnly,
|
||||||
storagePrefs, storageNoPrefsOrContent, storageNoPrefs,
|
storagePrefs, storageNoPrefsOrContent, storageNoPrefs,
|
||||||
rememberLabel, rememberTooltip */
|
rememberLabel, rememberTooltip
|
||||||
} = strings;
|
} = strings;
|
||||||
|
*/
|
||||||
|
|
||||||
// No need to run this one-time dialog again just because the user
|
// No need to run this one-time dialog again just because the user
|
||||||
// changes the language
|
// changes the language
|
||||||
@@ -214,83 +158,13 @@ export default {
|
|||||||
)
|
)
|
||||||
// ...then show the storage prompt.
|
// ...then show the storage prompt.
|
||||||
)) {
|
)) {
|
||||||
/*
|
const options = Boolean(storage);
|
||||||
const options = [];
|
|
||||||
if (storage) {
|
|
||||||
options.unshift(
|
|
||||||
{value: 'prefsAndContent', text: storagePrefsAndContent},
|
|
||||||
{value: 'prefsOnly', text: storagePrefsOnly},
|
|
||||||
{value: 'noPrefsOrContent', text: storageNoPrefsOrContent}
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
options.unshift(
|
|
||||||
{value: 'prefsOnly', text: storagePrefs},
|
|
||||||
{value: 'noPrefsOrContent', text: storageNoPrefs}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
const options = storage ? ['prefsAndContent', 'prefsOnly', 'noPrefsOrContent'] : ['prefsOnly', 'noPrefsOrContent'];
|
|
||||||
|
|
||||||
// Open select-with-checkbox dialog
|
// Open select-with-checkbox dialog
|
||||||
// From svg-editor.js
|
// From svg-editor.js
|
||||||
svgEditor.storagePromptState = 'waiting';
|
svgEditor.storagePromptState = 'waiting';
|
||||||
/* JFH !!!!!
|
const $storageDialog = document.getElementById('se-storage-dialog');
|
||||||
const {response: pref, checked} = await $.select(
|
$storageDialog.setAttribute('dialog', 'open');
|
||||||
message,
|
$storageDialog.setAttribute('storage', options);
|
||||||
options,
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
{
|
|
||||||
label: rememberLabel,
|
|
||||||
checked: true,
|
|
||||||
tooltip: rememberTooltip
|
|
||||||
}
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
const pref = await seSelect(message, options);
|
|
||||||
if (pref && pref !== 'noPrefsOrContent') {
|
|
||||||
// Regardless of whether the user opted
|
|
||||||
// to remember the choice (and move to a URL which won't
|
|
||||||
// ask them again), we have to assume the user
|
|
||||||
// doesn't even want to remember their not wanting
|
|
||||||
// storage, so we don't set the cookie or continue on with
|
|
||||||
// setting storage on beforeunload
|
|
||||||
document.cookie = 'svgeditstore=' + encodeURIComponent(pref) + '; expires=Fri, 31 Dec 9999 23:59:59 GMT'; // 'prefsAndContent' | 'prefsOnly'
|
|
||||||
// If the URL was configured to always insist on a prompt, if
|
|
||||||
// the user does indicate a wish to store their info, we
|
|
||||||
// don't want ask them again upon page refresh so move
|
|
||||||
// them instead to a URL which does not always prompt
|
|
||||||
if (storagePrompt === 'true' /* && checked */) {
|
|
||||||
replaceStoragePrompt();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} else { // The user does not wish storage (or cancelled, which we treat equivalently)
|
|
||||||
removeStoragePrefCookie();
|
|
||||||
if (pref && // If the user explicitly expresses wish for no storage
|
|
||||||
emptyStorageOnDecline
|
|
||||||
) {
|
|
||||||
emptyStorage();
|
|
||||||
}
|
|
||||||
if (pref /* && checked */) {
|
|
||||||
// Open a URL which won't set storage and won't prompt user about storage
|
|
||||||
replaceStoragePrompt('false');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// It should be enough to (conditionally) add to storage on
|
|
||||||
// beforeunload, but if we wished to update immediately,
|
|
||||||
// we might wish to try setting:
|
|
||||||
// svgEditor.setConfig({noStorageOnLoad: true});
|
|
||||||
// and then call:
|
|
||||||
// svgEditor.loadContentAndPrefs();
|
|
||||||
|
|
||||||
// We don't check for noStorageOnLoad here because
|
|
||||||
// the prompt gives the user the option to store data
|
|
||||||
setupBeforeUnloadListener();
|
|
||||||
|
|
||||||
svgEditor.storagePromptState = 'closed';
|
|
||||||
updateCanvas(true);
|
|
||||||
} else if (!noStorageOnLoad || forceStorage) {
|
} else if (!noStorageOnLoad || forceStorage) {
|
||||||
setupBeforeUnloadListener();
|
setupBeforeUnloadListener();
|
||||||
}
|
}
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 839 B After Width: | Height: | Size: 839 B |
@@ -127,15 +127,23 @@
|
|||||||
title="Change rotation angle"></se-spin-input>
|
title="Change rotation angle"></se-spin-input>
|
||||||
<se-spin-input size="2" id="blur" min=0 max=100 step=5 src="./images/blur.svg"
|
<se-spin-input size="2" id="blur" min=0 max=100 step=5 src="./images/blur.svg"
|
||||||
title="Change gaussian blur value"></se-spin-input>
|
title="Change gaussian blur value"></se-spin-input>
|
||||||
|
<se-list>
|
||||||
|
<se-list-item id="tool_posleft">Align Left</se-list-item>
|
||||||
|
<se-list-item id="tool_poscenter">Align Center</se-list-item>
|
||||||
|
<se-list-item id="tool_posright">Align Right</se-list-item>
|
||||||
|
<se-list-item id="tool_postop">Align Top</se-list-item>
|
||||||
|
<se-list-item id="tool_posmiddle">Align Middle</se-list-item>
|
||||||
|
<se-list-item id="tool_posbottom">Align Bottom</se-list-item>
|
||||||
|
</se-list>
|
||||||
<div class="dropdown toolset" id="tool_position" title="Align Element to Page">
|
<div class="dropdown toolset" id="tool_position" title="Align Element to Page">
|
||||||
<div id="cur_position" class="icon_label"></div>
|
<div id="cur_position" class="icon_label"></div>
|
||||||
<button></button>
|
<button></button>
|
||||||
</div>
|
</div>
|
||||||
<div id="xy_panel" class="toolset">
|
<div id="xy_panel" class="toolset">
|
||||||
<se-input id="selected_x" data-attr:="x" size="4" type="text" label="x:" title="Change X coordinate">
|
<se-spin-input id="selected_x" data-attr:="x" size="4" type="text" label="x:" title="Change X coordinate">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
<se-input id="selected_y" data-attr="y" size="4" type="text" label="y:" title="Change Y coordinate">
|
<se-spin-input id="selected_y" data-attr="y" size="4" type="text" label="y:" title="Change Y coordinate">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- selected_panel -->
|
</div> <!-- selected_panel -->
|
||||||
<!-- Buttons when multiple elements are selected -->
|
<!-- Buttons when multiple elements are selected -->
|
||||||
@@ -154,33 +162,30 @@
|
|||||||
<se-button id="tool_align_top" title="Align Top" src="./images/align_top.svg"></se-button>
|
<se-button id="tool_align_top" title="Align Top" src="./images/align_top.svg"></se-button>
|
||||||
<se-button id="tool_align_middle" title="Align Middle" src="./images/align_middle.svg"></se-button>
|
<se-button id="tool_align_middle" title="Align Middle" src="./images/align_middle.svg"></se-button>
|
||||||
<se-button id="tool_align_bottom" title="Align Bottom" src="./images/align_bottom.svg"></se-button>
|
<se-button id="tool_align_bottom" title="Align Bottom" src="./images/align_bottom.svg"></se-button>
|
||||||
<label id="tool_align_relative">
|
<se-list id="tool_align_relative" label="relative to:">
|
||||||
<span id="relativeToLabel">relative to:</span>
|
<se-list-item id="selected_objects" value="selected">selected objects</se-list-item>
|
||||||
<select id="align_relative_to" title="Align relative to ...">
|
<se-list-item id="largest_object" value="largest">largest object</se-list-item>
|
||||||
<option id="selected_objects" value="selected">selected objects</option>
|
<se-list-item id="smallest_object" value="smallest">smallest object</se-list-item>
|
||||||
<option id="largest_object" value="largest">largest object</option>
|
<se-list-item id="page" value="page">page</se-list-item>
|
||||||
<option id="smallest_object" value="smallest">smallest object</option>
|
</se-list>
|
||||||
<option id="page" value="page">page</option>
|
|
||||||
</select>
|
|
||||||
</label>
|
|
||||||
<div class="tool_sep"></div>
|
<div class="tool_sep"></div>
|
||||||
</div> <!-- multiselected_panel -->
|
</div> <!-- multiselected_panel -->
|
||||||
<div id="rect_panel">
|
<div id="rect_panel">
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="rect_width" data-attr="width" size="4" src="./images/width.svg"
|
<se-spin-input id="rect_width" data-attr="width" size="4" src="./images/width.svg"
|
||||||
title="Change rectangle width"></se-input>
|
title="Change rectangle width"></se-spin-input>
|
||||||
<se-input id="rect_height" data-attr="height" size="4" src="./images/height.svg"
|
<se-spin-input id="rect_height" data-attr="height" size="4" src="./images/height.svg"
|
||||||
title="Change rectangle height"></se-input>
|
title="Change rectangle height"></se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
<se-spin-input id="rect_rx" min=0 max=1000 step=1 size="3" title="Change Rectangle Corner Radius"
|
<se-spin-input id="rect_rx" min=0 max=1000 step=1 size="3" title="Change Rectangle Corner Radius"
|
||||||
data-attr="Corner Radius" src="./images/c_radius.svg"></se-spin-input>
|
data-attr="Corner Radius" src="./images/c_radius.svg"></se-spin-input>
|
||||||
</div> <!-- rect_panel -->
|
</div> <!-- rect_panel -->
|
||||||
<div id="image_panel">
|
<div id="image_panel">
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="image_width" data-attr="width" size="4" type="text" src="./images/width.svg"
|
<se-spin-input id="image_width" data-attr="width" size="4" type="text" src="./images/width.svg"
|
||||||
title="Change image width"></se-input>
|
title="Change image width"></se-spin-input>
|
||||||
<se-input id="image_height" data-attr="height" size="4" type="text" src="./images/height.svg"
|
<se-spin-input id="image_height" data-attr="height" size="4" type="text" src="./images/height.svg"
|
||||||
title="Change image height"></se-input>
|
title="Change image height"></se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<label id="tool_image_url">url:
|
<label id="tool_image_url">url:
|
||||||
@@ -195,37 +200,35 @@
|
|||||||
</div> <!-- image_panel -->
|
</div> <!-- image_panel -->
|
||||||
<div id="circle_panel">
|
<div id="circle_panel">
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="circle_cx" data-attr="cx" size="4" label="cx:"></se-input>
|
<se-spin-input id="circle_cx" data-attr="cx" size="4" label="cx:"></se-spin-input>
|
||||||
<se-input id="circle_cy" data-attr="cy" size="4" label="cy:"></se-input>
|
<se-spin-input id="circle_cy" data-attr="cy" size="4" label="cy:"></se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="circle_r" data-attr="r" size="4" label="r:"></se-input>
|
<se-spin-input id="circle_r" data-attr="r" size="4" label="r:"></se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- circle_panel -->
|
</div> <!-- circle_panel -->
|
||||||
<div id="ellipse_panel">
|
<div id="ellipse_panel">
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="ellipse_cx" data-attr="cx" size="4" title="Change ellipse's cx coordinate" label="cx:">
|
<se-spin-input id="ellipse_cx" data-attr="cx" size="4" title="Change ellipse's cx coordinate" label="cx:">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
<se-input id="ellipse_cy" data-attr="cy" size="4" title="Change ellipse's cy coordinate" label="cy:">
|
<se-spin-input id="ellipse_cy" data-attr="cy" size="4" title="Change ellipse's cy coordinate" label="cy:">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="ellipse_rx" data-attr="rx" size="4" title="Change ellipse's x radius" label="rx:"></se-input>
|
<se-spin-input id="ellipse_rx" data-attr="rx" size="4" title="Change ellipse's x radius" label="rx:"></se-spin-input>
|
||||||
<se-input id="ellipse_ry" data-attr="ry" size="4" title="Change ellipse's y radius" label="ry:"></se-input>
|
<se-spin-input id="ellipse_ry" data-attr="ry" size="4" title="Change ellipse's y radius" label="ry:"></se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- ellipse_panel -->
|
</div> <!-- ellipse_panel -->
|
||||||
<div id="line_panel">
|
<div id="line_panel">
|
||||||
<div class="toolset">
|
<div class="toolset">
|
||||||
<se-input id="line_x1" data-attr="x1" size="4" title="Change line's starting x coordinate" label="x1:">
|
<se-spin-input id="line_x1" data-attr="x1" size="4" title="Change line's starting x coordinate" label="x1:">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
<se-input id="line_y1" data-attr="y1" size="4" title="Change line's starting y coordinate" label="y1:">
|
<se-spin-input id="line_y1" data-attr="y1" size="4" title="Change line's starting y coordinate" label="y1:">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
</div>
|
<se-spin-input id="line_x2" data-attr="x2" size="4" title="Change line's ending x coordinate" label="x2:">
|
||||||
<div class="toolset">
|
</se-spin-input>
|
||||||
<se-input id="line_x2" data-attr="x2" size="4" title="Change line's ending x coordinate" label="x2:">
|
<se-spin-input id="line_y2" data-attr="y2" size="4" title="Change line's ending y coordinate" label="y2:">
|
||||||
</se-input>
|
</se-spin-input>
|
||||||
<se-input id="line_y2" data-attr="y2" size="4" title="Change line's ending y coordinate" label="y2:">
|
|
||||||
</se-input>
|
|
||||||
</div>
|
</div>
|
||||||
</div> <!-- line_panel -->
|
</div> <!-- line_panel -->
|
||||||
<div id="text_panel">
|
<div id="text_panel">
|
||||||
@@ -236,25 +239,16 @@
|
|||||||
<se-button id="tool_text_anchor_middle" title="Align the text from middle" src="./images/anchor_middle.svg"></se-button>
|
<se-button id="tool_text_anchor_middle" title="Align the text from middle" src="./images/anchor_middle.svg"></se-button>
|
||||||
<se-button id="tool_text_anchor_end" title="Align the text from end" src="./images/anchor_end.svg"></se-button>
|
<se-button id="tool_text_anchor_end" title="Align the text from end" src="./images/anchor_end.svg"></se-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="toolset" id="tool_font_family">
|
<se-list id="tool_font_family" label="Font:">
|
||||||
<label>
|
<se-list-item value="Sans-serif"> <div style="font-family:serif">Sans-serif</div></se-list-item>
|
||||||
<!-- Font family -->
|
<se-list-item value="Serif"> <div style="font-family:serif">Serif</div></se-list-item>
|
||||||
<input id="font_family" type="text" title="Change Font Family" size="12" />
|
<se-list-item value="Cursive"> <div style="font-family:serif">Cursive</div></se-list-item>
|
||||||
</label>
|
<se-list-item value="Fantasy"> <div style="font-family:serif">Fantasy</div></se-list-item>
|
||||||
<div id="font_family_dropdown" class="dropdown">
|
<se-list-item value="Monospace"> <div style="font-family:serif">Monospace</div></se-list-item>
|
||||||
<button></button>
|
<se-list-item value="Courier"> <div style="font-family:serif">Courier</div></se-list-item>
|
||||||
<ul>
|
<se-list-item value="Helvetica"> <div style="font-family:serif">Helvetica</div></se-list-item>
|
||||||
<li style="font-family:serif">Serif</li>
|
<se-list-item value="Times"> <div style="font-family:serif">Times</div></se-list-item>
|
||||||
<li style="font-family:sans-serif">Sans-serif</li>
|
</se-list>
|
||||||
<li style="font-family:cursive">Cursive</li>
|
|
||||||
<li style="font-family:fantasy">Fantasy</li>
|
|
||||||
<li style="font-family:monospace">Monospace</li>
|
|
||||||
<li style="font-family:courier">Courier</li>
|
|
||||||
<li style="font-family:helvetica">Helvetica</li>
|
|
||||||
<li style="font-family:times">Times</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<se-spin-input size="2" id="font_size" min=1 max=1000 step=1 title="Change Font Size"
|
<se-spin-input size="2" id="font_size" min=1 max=1000 step=1 title="Change Font Size"
|
||||||
src="./images/fontsize.svg"></se-spin-input>
|
src="./images/fontsize.svg"></se-spin-input>
|
||||||
<!-- Not visible, but still used -->
|
<!-- Not visible, but still used -->
|
||||||
@@ -286,8 +280,8 @@
|
|||||||
<div class="tool_sep"></div>
|
<div class="tool_sep"></div>
|
||||||
<se-button id="tool_node_link" title="Link Control Points" src="./images/tool_node_link.svg" pressed></se-button>
|
<se-button id="tool_node_link" title="Link Control Points" src="./images/tool_node_link.svg" pressed></se-button>
|
||||||
<div class="tool_sep"></div>
|
<div class="tool_sep"></div>
|
||||||
<se-input id="path_node_x" data-attr="x" size="4" title="Change node's x coordinate" label="x:"></se-input>
|
<se-spin-input id="path_node_x" data-attr="x" size="4" title="Change node's x coordinate" label="x:"></se-spin-input>
|
||||||
<se-input id="path_node_y" data-attr="y" size="4" title="Change node's y coordinate" label="y:"></se-input>
|
<se-spin-input id="path_node_y" data-attr="y" size="4" title="Change node's y coordinate" label="y:"></se-spin-input>
|
||||||
<select id="seg_type" title="Change Segment type">
|
<select id="seg_type" title="Change Segment type">
|
||||||
<option id="straight_segments" selected="selected" value="4">Straight</option>
|
<option id="straight_segments" selected="selected" value="4">Straight</option>
|
||||||
<option id="curve_segments" value="6">Curve</option>
|
<option id="curve_segments" value="6">Curve</option>
|
||||||
@@ -332,7 +326,7 @@
|
|||||||
</div> <!-- tools_left -->
|
</div> <!-- tools_left -->
|
||||||
<div id="tools_bottom">
|
<div id="tools_bottom">
|
||||||
<!-- Zoom buttons -->
|
<!-- Zoom buttons -->
|
||||||
<se-dropdown id="zoom" src="./images/zoom.svg" title="Change zoom level" inputsize="40px">
|
<se-zoom id="zoom" src="./images/zoom.svg" title="Change zoom level" inputsize="40px">
|
||||||
<div value="1000">1000</div>
|
<div value="1000">1000</div>
|
||||||
<div value="400">400</div>
|
<div value="400">400</div>
|
||||||
<div value="200">200</div>
|
<div value="200">200</div>
|
||||||
@@ -343,66 +337,37 @@
|
|||||||
<div value="selection">Fit to selection</div>
|
<div value="selection">Fit to selection</div>
|
||||||
<div value="layer">Fit to layer content</div>
|
<div value="layer">Fit to layer content</div>
|
||||||
<div value="content">Fit to all content</div>
|
<div value="content">Fit to all content</div>
|
||||||
</se-dropdown>
|
</se-zoom>
|
||||||
<se-colorpicker id="fill_color" src="./images/fill.svg" title="Change fill color" type="fill"></se-colorpicker>
|
<se-colorpicker id="fill_color" src="./images/fill.svg" title="Change fill color" type="fill"></se-colorpicker>
|
||||||
<se-colorpicker id="stroke_color" src="./images/stroke.svg" title="Change stroke color" type="stroke"></se-colorpicker>
|
<se-colorpicker id="stroke_color" src="./images/stroke.svg" title="Change stroke color" type="stroke"></se-colorpicker>
|
||||||
<se-spin-input id="stroke_width" min=0 max=99 step=1 title="Change stroke width by 1" label=""></se-spin-input>
|
<se-spin-input id="stroke_width" min=0 max=99 step=1 title="Change stroke width by 1" label=""></se-spin-input>
|
||||||
<label class="stroke_tool">
|
<se-list id="stroke_style" title="Change stroke dash style" label="">
|
||||||
<select id="stroke_style" title="Change stroke dash style">
|
<se-list-item value="none">—</se-list-item>
|
||||||
<option selected="selected" value="none">—</option>
|
<se-list-item value="2,2">...</se-list-item>
|
||||||
<option value="2,2">...</option>
|
<se-list-item value="5,5">- -</se-list-item>
|
||||||
<option value="5,5">- -</option>
|
<se-list-item value="5,2,2,2">- .</se-list-item>
|
||||||
<option value="5,2,2,2">- .</option>
|
<se-list-item value="5,2,2,2,2,2">- ..</se-list-item>
|
||||||
<option value="5,2,2,2,2,2">- ..</option>
|
</se-list>
|
||||||
</select>
|
<se-list id="stroke_linejoin" title="Linejoin: Miter" label="">
|
||||||
</label>
|
<se-list-item id="linejoin_miter"><se-button size="small" title="Linejoin: Miter" src="./images/linejoin_miter.svg"></se-button></se-list-item>
|
||||||
<div class="stroke_tool dropdown" id="stroke_linejoin">
|
<se-list-item id="linejoin_round"><se-button size="small" title="Linejoin: Round" src="./images/linejoin_round.svg"></se-button></se-list-item>
|
||||||
<div id="cur_linejoin" title="Linejoin: Miter"></div>
|
<se-list-item id="linejoin_bevel"><se-button size="small" title="Linejoin: Bevel" src="./images/linejoin_bevel.svg"></se-button></se-list-item>
|
||||||
<button></button>
|
</se-list>
|
||||||
</div>
|
<se-list id="stroke_linecap" title="Linecap: Butt" label="">
|
||||||
<div class="stroke_tool dropdown" id="stroke_linecap">
|
<se-list-item id="linecap_butt"><se-button size="small" title="Linecap: Butt" src="./images/linecap_butt.svg"></se-button></se-list-item>
|
||||||
<div id="cur_linecap" title="Linecap: Butt"></div>
|
<se-list-item id="linecap_square"><se-button size="small" title="Linecap: Square" src="./images/linecap_square.svg"></se-button></se-list-item>
|
||||||
<button></button>
|
<se-list-item id="linecap_round"><se-button size="small" title="Linecap: Round" src="./images/linecap_round.svg"></se-button></se-list-item>
|
||||||
</div>
|
</se-list>
|
||||||
<div id="tool_opacity">
|
<se-list id="opacity_dropdown" label="">
|
||||||
<se-spin-input size="3" id="group_opacity" min=0 max=100 step=5 title="Change selected item opacity" label=""></se-spin-input>
|
<se-list-item>0%</se-list-item>
|
||||||
<div id="opacity_dropdown" class="dropdown">
|
<se-list-item>25%</se-list-item>
|
||||||
<button></button>
|
<se-list-item>50%</se-list-item>
|
||||||
<ul>
|
<se-list-item>75%</se-list-item>
|
||||||
<li>0%</li>
|
<se-list-item>100%</se-list-item>
|
||||||
<li>25%</li>
|
</se-list>
|
||||||
<li>50%</li>
|
<se-spin-input size="3" id="group_opacity" min=0 max=100 step=5 title="Change selected item opacity" label=""></se-spin-input>
|
||||||
<li>75%</li>
|
|
||||||
<li>100%</li>
|
|
||||||
<li class="special">
|
|
||||||
<div id="opac_slider"></div>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div> <!-- tool_opacity -->
|
|
||||||
<se-palette id="palette"></se-palette>
|
<se-palette id="palette"></se-palette>
|
||||||
</div> <!-- tools_bottom -->
|
</div> <!-- tools_bottom -->
|
||||||
<div id="option_lists" class="dropdown">
|
|
||||||
<ul id="linejoin_opts">
|
|
||||||
<li class="tool_button current" id="linejoin_miter" title="Linejoin: Miter"></li>
|
|
||||||
<li class="tool_button" id="linejoin_round" title="Linejoin: Round"></li>
|
|
||||||
<li class="tool_button" id="linejoin_bevel" title="Linejoin: Bevel"></li>
|
|
||||||
</ul>
|
|
||||||
<ul id="linecap_opts">
|
|
||||||
<li class="tool_button current" id="linecap_butt" title="Linecap: Butt"></li>
|
|
||||||
<li class="tool_button" id="linecap_square" title="Linecap: Square"></li>
|
|
||||||
<li class="tool_button" id="linecap_round" title="Linecap: Round"></li>
|
|
||||||
</ul>
|
|
||||||
<ul id="position_opts" class="optcols3">
|
|
||||||
<li class="push_button" id="tool_posleft" title="Align Left"></li>
|
|
||||||
<li class="push_button" id="tool_poscenter" title="Align Center"></li>
|
|
||||||
<li class="push_button" id="tool_posright" title="Align Right"></li>
|
|
||||||
<li class="push_button" id="tool_postop" title="Align Top"></li>
|
|
||||||
<li class="push_button" id="tool_posmiddle" title="Align Middle"></li>
|
|
||||||
<li class="push_button" id="tool_posbottom" title="Align Bottom"></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="dialog_box">
|
<div id="dialog_box">
|
||||||
<div class="overlay"></div>
|
<div class="overlay"></div>
|
||||||
<div id="dialog_container">
|
<div id="dialog_container">
|
||||||
|
|||||||
@@ -379,25 +379,6 @@ hr {
|
|||||||
|
|
||||||
/*—————————————————————————————*/
|
/*—————————————————————————————*/
|
||||||
|
|
||||||
.tool_button:hover,
|
|
||||||
.push_button:hover,
|
|
||||||
.buttonup:hover,
|
|
||||||
.buttondown,
|
|
||||||
.tool_button_current,
|
|
||||||
.push_button_pressed
|
|
||||||
{
|
|
||||||
background-color: #ffc !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tool_button_current,
|
|
||||||
.push_button_pressed,
|
|
||||||
.buttondown {
|
|
||||||
background-color: #f4e284 !important;
|
|
||||||
-webkit-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important;
|
|
||||||
-moz-box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important;
|
|
||||||
box-shadow: inset 1px 1px 2px rgba(0,0,0,0.4), 1px 1px 0 white !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#tools_top {
|
#tools_top {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 108px;
|
left: 108px;
|
||||||
@@ -405,7 +386,6 @@ hr {
|
|||||||
top: 2px;
|
top: 2px;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
overflow: auto;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#tools_top .tool_sep {
|
#tools_top .tool_sep {
|
||||||
@@ -515,12 +495,6 @@ input[type=text] {
|
|||||||
padding: 2px;
|
padding: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#tools_left .tool_button,
|
|
||||||
#tools_left .tool_button_current {
|
|
||||||
position: relative;
|
|
||||||
z-index: 11;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dropdown {
|
.dropdown {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
@@ -592,21 +566,6 @@ input[type=text] {
|
|||||||
margin-right: 0;
|
margin-right: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.tool_button,
|
|
||||||
.push_button,
|
|
||||||
.tool_button_current,
|
|
||||||
.push_button_pressed
|
|
||||||
{
|
|
||||||
height: 24px;
|
|
||||||
width: 24px;
|
|
||||||
margin: 2px 2px 4px 2px;
|
|
||||||
padding: 3px;
|
|
||||||
box-shadow: inset 1px 1px 2px white, 1px 1px 1px rgba(0,0,0,0.3);
|
|
||||||
background-color: #E8E8E8;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#main_menu li#tool_open, #main_menu li#tool_import {
|
#main_menu li#tool_open, #main_menu li#tool_import {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -683,10 +642,6 @@ input[type=text] {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dropdown li.tool_button {
|
|
||||||
width: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#stroke_expand {
|
#stroke_expand {
|
||||||
width: 0;
|
width: 0;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
|||||||
Reference in New Issue
Block a user