fix missing semicolumns
parent
dc5d9b05a6
commit
9a5292b467
|
@ -25,6 +25,7 @@ module.exports = {
|
||||||
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
||||||
"sonarjs/cognitive-complexity": ["warn", 40],
|
"sonarjs/cognitive-complexity": ["warn", 40],
|
||||||
"sonarjs/no-duplicate-string": 0,
|
"sonarjs/no-duplicate-string": 0,
|
||||||
|
"semi" : "error",
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,7 +295,7 @@ class Editor extends EditorStartup {
|
||||||
'5/Shift+5': 'tools_ellipse'
|
'5/Shift+5': 'tools_ellipse'
|
||||||
};
|
};
|
||||||
Object.entries(keyAssocs).forEach(([keyval, sel]) => {
|
Object.entries(keyAssocs).forEach(([keyval, sel]) => {
|
||||||
const parentsElements = this.getParents($id(sel), $id('main_menu'))
|
const parentsElements = this.getParents($id(sel), $id('main_menu'));
|
||||||
const menu = (parentsElements.length);
|
const menu = (parentsElements.length);
|
||||||
|
|
||||||
$qa(sel).forEach((element) => {
|
$qa(sel).forEach((element) => {
|
||||||
|
@ -350,9 +350,9 @@ class Editor extends EditorStartup {
|
||||||
const elements = document.getElementsByClassName("tool_button_current");
|
const elements = document.getElementsByClassName("tool_button_current");
|
||||||
Array.from(elements).forEach(function (element) {
|
Array.from(elements).forEach(function (element) {
|
||||||
element.classList.add('tool_button_current');
|
element.classList.add('tool_button_current');
|
||||||
element.classList.remove('tool_button')
|
element.classList.remove('tool_button');
|
||||||
});
|
});
|
||||||
$id('tool_select').classList.add('tool_button_current')
|
$id('tool_select').classList.add('tool_button_current');
|
||||||
$id('tool_select').classList.remove('tool_button');
|
$id('tool_select').classList.remove('tool_button');
|
||||||
this.multiselected = false;
|
this.multiselected = false;
|
||||||
if (elems.length) {
|
if (elems.length) {
|
||||||
|
|
|
@ -53,7 +53,7 @@ class EditorStartup {
|
||||||
constructor () {
|
constructor () {
|
||||||
this.extensionsAdded = false;
|
this.extensionsAdded = false;
|
||||||
this.messageQueue = [];
|
this.messageQueue = [];
|
||||||
this.$svgEditor = $id('svg_editor')
|
this.$svgEditor = $id('svg_editor');
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Auto-run after a Promise microtask.
|
* Auto-run after a Promise microtask.
|
||||||
|
@ -136,7 +136,7 @@ class EditorStartup {
|
||||||
this.selectedElement = null;
|
this.selectedElement = null;
|
||||||
this.multiselected = false;
|
this.multiselected = false;
|
||||||
|
|
||||||
const aLinks = $id('cur_context_panel').querySelectorAll('a')
|
const aLinks = $id('cur_context_panel').querySelectorAll('a');
|
||||||
|
|
||||||
for (const aLink of aLinks) {
|
for (const aLink of aLinks) {
|
||||||
aLink.addEventListener('click', (evt) => {
|
aLink.addEventListener('click', (evt) => {
|
||||||
|
@ -426,16 +426,16 @@ class EditorStartup {
|
||||||
Array.from(elements).forEach(function(element) {
|
Array.from(elements).forEach(function(element) {
|
||||||
element.addEventListener('mousedown', function(event) {
|
element.addEventListener('mousedown', function(event) {
|
||||||
if (!event.currentTarget.classList.contains('disabled')) {
|
if (!event.currentTarget.classList.contains('disabled')) {
|
||||||
event.currentTarget.classList.add('push_button_pressed')
|
event.currentTarget.classList.add('push_button_pressed');
|
||||||
event.currentTarget.classList.remove('push_button');
|
event.currentTarget.classList.remove('push_button');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
element.addEventListener('mouseout', function(event) {
|
element.addEventListener('mouseout', function(event) {
|
||||||
event.currentTarget.classList.add('push_button')
|
event.currentTarget.classList.add('push_button');
|
||||||
event.currentTarget.classList.remove('push_button_pressed');
|
event.currentTarget.classList.remove('push_button_pressed');
|
||||||
});
|
});
|
||||||
element.addEventListener('mouseup', function(event) {
|
element.addEventListener('mouseup', function(event) {
|
||||||
event.currentTarget.classList.add('push_button')
|
event.currentTarget.classList.add('push_button');
|
||||||
event.currentTarget.classList.remove('push_button_pressed');
|
event.currentTarget.classList.remove('push_button_pressed');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -305,7 +305,7 @@ class MainMenu {
|
||||||
init() {
|
init() {
|
||||||
// add Top panel
|
// add Top panel
|
||||||
const template = document.createElement("template");
|
const template = document.createElement("template");
|
||||||
const {i18next} = this.editor
|
const {i18next} = this.editor;
|
||||||
// eslint-disable-next-line no-unsanitized/property
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
template.innerHTML = `
|
template.innerHTML = `
|
||||||
<se-menu id="main_button" label="SVG-Edit" src="./images/logo.svg" alt="logo">
|
<se-menu id="main_button" label="SVG-Edit" src="./images/logo.svg" alt="logo">
|
||||||
|
|
|
@ -1368,7 +1368,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc
|
||||||
if (!that.querySelectorAll('div.jPicker.Container').length) {
|
if (!that.querySelectorAll('div.jPicker.Container').length) {
|
||||||
document.body.insertBefore(container, document.body.firstChild);
|
document.body.insertBefore(container, document.body.firstChild);
|
||||||
} else {
|
} else {
|
||||||
that.querySelector('div.jPicker.Container:last').insertAdjacentElement('afterend', container)
|
that.querySelector('div.jPicker.Container:last').insertAdjacentElement('afterend', container);
|
||||||
}
|
}
|
||||||
container.addEventListener('mousedown', function () {
|
container.addEventListener('mousedown', function () {
|
||||||
container.style.zIndex = 20;
|
container.style.zIndex = 20;
|
||||||
|
@ -1520,7 +1520,7 @@ export function jPickerMethod (elem, options, commitCallback, liveCallback, canc
|
||||||
iconAlpha = that.icon.querySelector('.Alpha');
|
iconAlpha = that.icon.querySelector('.Alpha');
|
||||||
setImg.call(that, iconAlpha, images.clientPath + 'bar-opacity.png');
|
setImg.call(that, iconAlpha, images.clientPath + 'bar-opacity.png');
|
||||||
setAlpha.call(that, iconAlpha, toFixedNumeric(((255 - (!isNullish(all) ? all.a : 0)) * 100) / 255, 4));
|
setAlpha.call(that, iconAlpha, toFixedNumeric(((255 - (!isNullish(all) ? all.a : 0)) * 100) / 255, 4));
|
||||||
iconImage = that.icon.querySelector('.Image')
|
iconImage = that.icon.querySelector('.Image');
|
||||||
iconImage.style.backgroundImage = 'url(\'' + images.clientPath + images.picker.file + '\')';
|
iconImage.style.backgroundImage = 'url(\'' + images.clientPath + images.picker.file + '\')';
|
||||||
iconImage.addEventListener('click', iconImageClicked);
|
iconImage.addEventListener('click', iconImageClicked);
|
||||||
if (win.bindToInput && win.updateInputColor) {
|
if (win.bindToInput && win.updateInputColor) {
|
||||||
|
|
|
@ -92,6 +92,6 @@ export const dragmove = function(target, handler, parent, onStart, onEnd, onDrag
|
||||||
target.style.left = lastX + "px";
|
target.style.left = lastX + "px";
|
||||||
target.style.top = lastY + "px";
|
target.style.top = lastY + "px";
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
export { dragmove as default };
|
export { dragmove as default };
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
const loadExtensionTranslation = async function (svgEditor) {
|
const loadExtensionTranslation = async function (svgEditor) {
|
||||||
let translationModule;
|
let translationModule;
|
||||||
const lang = svgEditor.configObj.pref('lang')
|
const lang = svgEditor.configObj.pref('lang');
|
||||||
try {
|
try {
|
||||||
// eslint-disable-next-line no-unsanitized/method
|
// eslint-disable-next-line no-unsanitized/method
|
||||||
translationModule = await import(`./locale/${encodeURIComponent(lang)}.js`);
|
translationModule = await import(`./locale/${encodeURIComponent(lang)}.js`);
|
||||||
|
|
|
@ -79,7 +79,7 @@ export default {
|
||||||
x: midX + lenX * ratio,
|
x: midX + lenX * ratio,
|
||||||
y: midY + lenY * ratio
|
y: midY + lenY * ratio
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {"start"|"end"} side
|
* @param {"start"|"end"} side
|
||||||
|
@ -92,7 +92,7 @@ export default {
|
||||||
// TODO: Make this number (5) be based on marker width/height
|
// TODO: Make this number (5) be based on marker width/height
|
||||||
const size = line.getAttribute('stroke-width') * 5;
|
const size = line.getAttribute('stroke-width') * 5;
|
||||||
return giveOffset ? size : 0;
|
return giveOffset ? size : 0;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} on
|
* @param {boolean} on
|
||||||
|
@ -108,7 +108,7 @@ export default {
|
||||||
connRules.textContent = (!on ? '' : '#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }');
|
connRules.textContent = (!on ? '' : '#tool_clone, #tool_topath, #tool_angle, #xy_panel { display: none !important; }');
|
||||||
if ($id('connector_panel'))
|
if ($id('connector_panel'))
|
||||||
$id('connector_panel').style.display = (on) ? 'block' : 'none';
|
$id('connector_panel').style.display = (on) ? 'block' : 'none';
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Element} elem
|
* @param {Element} elem
|
||||||
|
@ -144,7 +144,7 @@ export default {
|
||||||
const ptEnd = pts.getItem(pts.numberOfItems - 1);
|
const ptEnd = pts.getItem(pts.numberOfItems - 1);
|
||||||
setPoint(elem, 1, (ptEnd.x + ptStart.x) / 2, (ptEnd.y + ptStart.y) / 2);
|
setPoint(elem, 1, (ptEnd.x + ptStart.x) / 2, (ptEnd.y + ptStart.y) / 2);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Float} diffX
|
* @param {Float} diffX
|
||||||
|
@ -184,7 +184,7 @@ export default {
|
||||||
const pt2 = getBBintersect(pt.x, pt.y, dataStorage.get(line, altPre + '_bb'), getOffset(altPre, line));
|
const pt2 = getBBintersect(pt.x, pt.y, dataStorage.get(line, altPre + '_bb'), getOffset(altPre, line));
|
||||||
setPoint(line, conn.is_start ? 'end' : 0, pt2.x, pt2.y, true);
|
setPoint(line, conn.is_start ? 'end' : 0, pt2.x, pt2.y, true);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -244,7 +244,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Element[]} [elems=selElems]
|
* @param {Element[]} [elems=selElems]
|
||||||
|
@ -302,7 +302,7 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
// Do once
|
// Do once
|
||||||
(function () {
|
(function () {
|
||||||
|
@ -347,7 +347,7 @@ export default {
|
||||||
svgCanvas.getEditorNS(true);
|
svgCanvas.getEditorNS(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
};
|
||||||
|
|
||||||
const strings = await loadExtensionTranslation(svgEditor.configObj.pref('lang'));
|
const strings = await loadExtensionTranslation(svgEditor.configObj.pref('lang'));
|
||||||
return {
|
return {
|
||||||
|
@ -359,7 +359,7 @@ export default {
|
||||||
const buttonTemplate = document.createElement("template");
|
const buttonTemplate = document.createElement("template");
|
||||||
buttonTemplate.innerHTML = `
|
buttonTemplate.innerHTML = `
|
||||||
<se-button id="mode_connect" title="Connect two objects" src="./images/conn.svg"></se-button>
|
<se-button id="mode_connect" title="Connect two objects" src="./images/conn.svg"></se-button>
|
||||||
`
|
`;
|
||||||
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
||||||
$id('mode_connect').addEventListener("click", () => {
|
$id('mode_connect').addEventListener("click", () => {
|
||||||
svgCanvas.setMode('connector');
|
svgCanvas.setMode('connector');
|
||||||
|
|
|
@ -71,7 +71,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
tool.classList.add('disabled');
|
tool.classList.add('disabled');
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: strings.name,
|
name: strings.name,
|
||||||
|
@ -80,7 +80,7 @@ export default {
|
||||||
const buttonTemplate = document.createElement("template");
|
const buttonTemplate = document.createElement("template");
|
||||||
buttonTemplate.innerHTML = `
|
buttonTemplate.innerHTML = `
|
||||||
<se-button id="tool_eyedropper" title="Eye Dropper Tool" src="./images/eye_dropper.svg" shortcut="I"></se-button>
|
<se-button id="tool_eyedropper" title="Eye Dropper Tool" src="./images/eye_dropper.svg" shortcut="I"></se-button>
|
||||||
`
|
`;
|
||||||
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
||||||
$id('tool_eyedropper').addEventListener("click", () => {
|
$id('tool_eyedropper').addEventListener("click", () => {
|
||||||
svgCanvas.setMode('eyedropper');
|
svgCanvas.setMode('eyedropper');
|
||||||
|
|
|
@ -277,7 +277,7 @@ export default {
|
||||||
const attrs = {
|
const attrs = {
|
||||||
width: newFO.getAttribute('width'),
|
width: newFO.getAttribute('width'),
|
||||||
height: newFO.getAttribute('height'),
|
height: newFO.getAttribute('height'),
|
||||||
}
|
};
|
||||||
const keep = (attrs.width !== '0' || attrs.height !== '0');
|
const keep = (attrs.width !== '0' || attrs.height !== '0');
|
||||||
svgCanvas.addToSelection([newFO], true);
|
svgCanvas.addToSelection([newFO], true);
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ export default {
|
||||||
gridimg.parentNode.setAttribute('width', bigInt);
|
gridimg.parentNode.setAttribute('width', bigInt);
|
||||||
gridimg.parentNode.setAttribute('height', bigInt);
|
gridimg.parentNode.setAttribute('height', bigInt);
|
||||||
svgCanvas.setHref(gridimg, datauri);
|
svgCanvas.setHref(gridimg, datauri);
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -150,7 +150,7 @@ export default {
|
||||||
}
|
}
|
||||||
$id('canvasGrid').style.display = (showGrid) ? 'block' : 'none';
|
$id('canvasGrid').style.display = (showGrid) ? 'block' : 'none';
|
||||||
document.getElementById('view_grid').pressed = showGrid;
|
document.getElementById('view_grid').pressed = showGrid;
|
||||||
}
|
};
|
||||||
return {
|
return {
|
||||||
name: strings.name,
|
name: strings.name,
|
||||||
zoomChanged (zoom) {
|
zoomChanged (zoom) {
|
||||||
|
@ -161,7 +161,7 @@ export default {
|
||||||
const buttonTemplate = document.createElement("template");
|
const buttonTemplate = document.createElement("template");
|
||||||
buttonTemplate.innerHTML = `
|
buttonTemplate.innerHTML = `
|
||||||
<se-button id="view_grid" title="Show grid" src="./images/grid.svg"></se-button>
|
<se-button id="view_grid" title="Show grid" src="./images/grid.svg"></se-button>
|
||||||
`
|
`;
|
||||||
$id('editor_panel').append(buttonTemplate.content.cloneNode(true));
|
$id('editor_panel').append(buttonTemplate.content.cloneNode(true));
|
||||||
$id('view_grid').addEventListener("click", () => {
|
$id('view_grid').addEventListener("click", () => {
|
||||||
svgEditor.configObj.curConfig.showGrid = showGrid = !showGrid;
|
svgEditor.configObj.curConfig.showGrid = showGrid = !showGrid;
|
||||||
|
|
|
@ -46,7 +46,7 @@ export default {
|
||||||
const closeBrowser = () => {
|
const closeBrowser = () => {
|
||||||
$id("imgbrowse_holder").style.display = 'none';
|
$id("imgbrowse_holder").style.display = 'none';
|
||||||
document.activeElement.blur(); // make sure focus is the body to correct issue #417
|
document.activeElement.blur(); // make sure focus is the body to correct issue #417
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} url
|
* @param {string} url
|
||||||
|
@ -67,7 +67,7 @@ export default {
|
||||||
svgCanvas.clearSelection();
|
svgCanvas.clearSelection();
|
||||||
svgCanvas.addToSelection([newImage]);
|
svgCanvas.addToSelection([newImage]);
|
||||||
svgCanvas.setImageURL(url);
|
svgCanvas.setImageURL(url);
|
||||||
}
|
};
|
||||||
|
|
||||||
const pending = {};
|
const pending = {};
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ export default {
|
||||||
const img = document.createElement("img");
|
const img = document.createElement("img");
|
||||||
img.src = curMeta.preview_url;
|
img.src = curMeta.preview_url;
|
||||||
entry.appendChild(img);
|
entry.appendChild(img);
|
||||||
entry.appendChild(document.createTextNode(title))
|
entry.appendChild(document.createTextNode(title));
|
||||||
} else {
|
} else {
|
||||||
entry = document.createElement("img");
|
entry = document.createElement("img");
|
||||||
entry.src = response;
|
entry.src = response;
|
||||||
|
@ -330,7 +330,7 @@ export default {
|
||||||
|
|
||||||
const insertAfter = (referenceNode, newNode) => {
|
const insertAfter = (referenceNode, newNode) => {
|
||||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
||||||
}
|
};
|
||||||
|
|
||||||
const toggleMultiLoop = () => {
|
const toggleMultiLoop = () => {
|
||||||
multiArr.forEach(function(item, i){
|
multiArr.forEach(function(item, i){
|
||||||
|
@ -347,7 +347,7 @@ export default {
|
||||||
preview.removeChild(preview.firstChild);
|
preview.removeChild(preview.firstChild);
|
||||||
multiArr = [];
|
multiArr = [];
|
||||||
$id("imgbrowse_holder").style.display = 'none';
|
$id("imgbrowse_holder").style.display = 'none';
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} show
|
* @param {boolean} show
|
||||||
|
@ -375,7 +375,7 @@ export default {
|
||||||
submit.style.display = (show) ? 'block' : 'none';
|
submit.style.display = (show) ? 'block' : 'none';
|
||||||
preview.style.display = (show) ? 'block' : 'none';
|
preview.style.display = (show) ? 'block' : 'none';
|
||||||
|
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -496,7 +496,7 @@ export default {
|
||||||
} else {
|
} else {
|
||||||
$id("imgbrowse_holder").style.display = 'block';
|
$id("imgbrowse_holder").style.display = 'block';
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
svgicons: 'ext-imagelib.xml',
|
svgicons: 'ext-imagelib.xml',
|
||||||
|
|
|
@ -48,5 +48,5 @@ Array.prototype.forEach.call(atags, function (aEle) {
|
||||||
}, 'html'); // 'html' is necessary to keep returned data as a string
|
}, 'html'); // 'html' is necessary to keep returned data as a string
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -123,8 +123,8 @@ export default {
|
||||||
function setIcon (pos, id) {
|
function setIcon (pos, id) {
|
||||||
if (id.substr(0, 1) !== '\\') { id = '\\textmarker'; }
|
if (id.substr(0, 1) !== '\\') { id = '\\textmarker'; }
|
||||||
const ci = idPrefix + pos + '_' + id.substr(1);
|
const ci = idPrefix + pos + '_' + id.substr(1);
|
||||||
console.log(ci)
|
console.log(ci);
|
||||||
console.log('cur_' + pos + '_marker_list')
|
console.log('cur_' + pos + '_marker_list');
|
||||||
svgEditor.setIcon('cur_' + pos + '_marker_list', $id(ci).children);
|
svgEditor.setIcon('cur_' + pos + '_marker_list', $id(ci).children);
|
||||||
$id(ci).classList.add('current');
|
$id(ci).classList.add('current');
|
||||||
const siblings = Array.prototype.filter.call($id(ci).parentNode.children, function(child){
|
const siblings = Array.prototype.filter.call($id(ci).parentNode.children, function(child){
|
||||||
|
|
|
@ -119,12 +119,12 @@ export default {
|
||||||
if((el.offsetLeft + el.offsetWidth) > parseFloat(getComputedStyle(parent, null).width.replace("px", ""))){
|
if((el.offsetLeft + el.offsetWidth) > parseFloat(getComputedStyle(parent, null).width.replace("px", ""))){
|
||||||
el.style.left = (parseFloat(getComputedStyle(parent, null).width.replace("px", "")) - el.offsetWidth) + 'px';
|
el.style.left = (parseFloat(getComputedStyle(parent, null).width.replace("px", "")) - el.offsetWidth) + 'px';
|
||||||
} else if(el.offsetLeft < 0){
|
} else if(el.offsetLeft < 0){
|
||||||
el.style.left = "0px"
|
el.style.left = "0px";
|
||||||
}
|
}
|
||||||
if((el.offsetTop + el.offsetHeight) > parseFloat(getComputedStyle(parent, null).height.replace("px", ""))){
|
if((el.offsetTop + el.offsetHeight) > parseFloat(getComputedStyle(parent, null).height.replace("px", ""))){
|
||||||
el.style.top = (parseFloat(getComputedStyle(parent, null).height.replace("px", "")) - el.offsetHeight) + 'px';
|
el.style.top = (parseFloat(getComputedStyle(parent, null).height.replace("px", "")) - el.offsetHeight) + 'px';
|
||||||
} else if(el.offsetTop < 0){
|
} else if(el.offsetTop < 0){
|
||||||
el.style.top = "0px"
|
el.style.top = "0px";
|
||||||
}
|
}
|
||||||
overviewWindowGlobals.viewBoxDragging = false;
|
overviewWindowGlobals.viewBoxDragging = false;
|
||||||
updateViewPortFromViewBox();
|
updateViewPortFromViewBox();
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
} = svgCanvas;
|
} = svgCanvas;
|
||||||
const insertAfter = (referenceNode, newNode) => {
|
const insertAfter = (referenceNode, newNode) => {
|
||||||
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
|
||||||
}
|
};
|
||||||
return {
|
return {
|
||||||
newUI: true,
|
newUI: true,
|
||||||
name: strings.name,
|
name: strings.name,
|
||||||
|
|
|
@ -36,7 +36,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
const showPanel = (on) => {
|
const showPanel = (on) => {
|
||||||
$id('polygon_panel').style.display = (on) ? 'block' : 'none';
|
$id('polygon_panel').style.display = (on) ? 'block' : 'none';
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} attr
|
* @param {string} attr
|
||||||
|
@ -46,7 +46,7 @@ export default {
|
||||||
const setAttr = (attr, val) => {
|
const setAttr = (attr, val) => {
|
||||||
svgCanvas.changeSelectedAttribute(attr, val);
|
svgCanvas.changeSelectedAttribute(attr, val);
|
||||||
svgCanvas.call('changed', selElems);
|
svgCanvas.call('changed', selElems);
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Float} n
|
* @param {Float} n
|
||||||
|
@ -73,7 +73,7 @@ export default {
|
||||||
<se-button id="tool_polygon" title="Polygon Tool" src="./images/polygon.svg"></se-button>
|
<se-button id="tool_polygon" title="Polygon Tool" src="./images/polygon.svg"></se-button>
|
||||||
<se-button id="tool_star" title="Star Tool" src="./images/star.svg"></se-button>
|
<se-button id="tool_star" title="Star Tool" src="./images/star.svg"></se-button>
|
||||||
</se-flyingbutton>
|
</se-flyingbutton>
|
||||||
`
|
`;
|
||||||
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
||||||
}
|
}
|
||||||
$id('tool_polygon').addEventListener("click", () => {
|
$id('tool_polygon').addEventListener("click", () => {
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
||||||
<se-spin-input size="3" id="polySides" min=1 step=1 value=5 label="sides">
|
<se-spin-input size="3" id="polySides" min=1 step=1 value=5 label="sides">
|
||||||
</se-spin-input>
|
</se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
`
|
`;
|
||||||
$id('tools_top').appendChild(panelTemplate.content.cloneNode(true));
|
$id('tools_top').appendChild(panelTemplate.content.cloneNode(true));
|
||||||
$id("polygon_panel").style.display = 'none';
|
$id("polygon_panel").style.display = 'none';
|
||||||
$id("polySides").addEventListener("change", (event) => {
|
$id("polySides").addEventListener("change", (event) => {
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default {
|
||||||
buttonTemplate.innerHTML = `
|
buttonTemplate.innerHTML = `
|
||||||
<se-explorerbutton id="tool_shapelib" title="Shape library" lib="./extensions/ext-shapes/shapelib/"
|
<se-explorerbutton id="tool_shapelib" title="Shape library" lib="./extensions/ext-shapes/shapelib/"
|
||||||
src="./images/shapelib.svg"></se-explorerbutton>
|
src="./images/shapelib.svg"></se-explorerbutton>
|
||||||
`
|
`;
|
||||||
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
||||||
$id('tool_shapelib').addEventListener("click", () => {
|
$id('tool_shapelib').addEventListener("click", () => {
|
||||||
canv.setMode(modeId);
|
canv.setMode(modeId);
|
||||||
|
|
|
@ -37,7 +37,7 @@ export default {
|
||||||
*/
|
*/
|
||||||
const showPanel = (on) => {
|
const showPanel = (on) => {
|
||||||
$id('star_panel').style.display = (on) ? 'block' : 'none';
|
$id('star_panel').style.display = (on) ? 'block' : 'none';
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -48,7 +48,7 @@ export default {
|
||||||
const setAttr = (attr, val) => {
|
const setAttr = (attr, val) => {
|
||||||
svgCanvas.changeSelectedAttribute(attr, val);
|
svgCanvas.changeSelectedAttribute(attr, val);
|
||||||
svgCanvas.call('changed', selElems);
|
svgCanvas.call('changed', selElems);
|
||||||
}
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name: strings.name,
|
name: strings.name,
|
||||||
|
@ -63,7 +63,7 @@ export default {
|
||||||
<se-button id="tool_polygon" title="Polygon Tool" src="./images/polygon.svg"></se-button>
|
<se-button id="tool_polygon" title="Polygon Tool" src="./images/polygon.svg"></se-button>
|
||||||
<se-button id="tool_star" title="Star Tool" src="./images/star.svg"></se-button>
|
<se-button id="tool_star" title="Star Tool" src="./images/star.svg"></se-button>
|
||||||
</se-flyingbutton>
|
</se-flyingbutton>
|
||||||
`
|
`;
|
||||||
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
$id('tools_left').append(buttonTemplate.content.cloneNode(true));
|
||||||
}
|
}
|
||||||
$id('tool_star').addEventListener("click", () => { showPanel(true);
|
$id('tool_star').addEventListener("click", () => { showPanel(true);
|
||||||
|
@ -84,7 +84,7 @@ export default {
|
||||||
<se-spin-input id="radialShift" min=0 step=1 value=0 label="radial shift" title="Change rotation angle">
|
<se-spin-input id="radialShift" min=0 step=1 value=0 label="radial shift" title="Change rotation angle">
|
||||||
</se-spin-input>
|
</se-spin-input>
|
||||||
</div>
|
</div>
|
||||||
`
|
`;
|
||||||
//add handlers for the panel
|
//add handlers for the panel
|
||||||
$id('tools_top').appendChild(panelTemplate.content.cloneNode(true));
|
$id('tools_top').appendChild(panelTemplate.content.cloneNode(true));
|
||||||
$id("starNumPoints").addEventListener("change", (event) => {
|
$id("starNumPoints").addEventListener("change", (event) => {
|
||||||
|
|
|
@ -217,7 +217,7 @@ class BottomPanel {
|
||||||
src="./images/opacity.svg"></se-spin-input>
|
src="./images/opacity.svg"></se-spin-input>
|
||||||
<se-palette id="palette"></se-palette>
|
<se-palette id="palette"></se-palette>
|
||||||
</div> <!-- tools_bottom -->
|
</div> <!-- tools_bottom -->
|
||||||
`
|
`;
|
||||||
this.editor.$svgEditor.append(template.content.cloneNode(true));
|
this.editor.$svgEditor.append(template.content.cloneNode(true));
|
||||||
$id('palette').addEventListener('change', this.handlePalette.bind(this));
|
$id('palette').addEventListener('change', this.handlePalette.bind(this));
|
||||||
const {curConfig} = this.editor.configObj;
|
const {curConfig} = this.editor.configObj;
|
||||||
|
|
|
@ -79,7 +79,7 @@ class LayersPanel {
|
||||||
*/
|
*/
|
||||||
toggleSidePanel(close) {
|
toggleSidePanel(close) {
|
||||||
const dpr = window.devicePixelRatio || 1;
|
const dpr = window.devicePixelRatio || 1;
|
||||||
const w = parseFloat(getComputedStyle($id("sidepanels"), null).width.replace("px", ""))
|
const w = parseFloat(getComputedStyle($id("sidepanels"), null).width.replace("px", ""));
|
||||||
const isOpened = (dpr < 1 ? w : w / dpr) > 2;
|
const isOpened = (dpr < 1 ? w : w / dpr) > 2;
|
||||||
const zoomAdjustedSidepanelWidth =
|
const zoomAdjustedSidepanelWidth =
|
||||||
(dpr < 1 ? 1 : dpr) * SIDEPANEL_OPENWIDTH;
|
(dpr < 1 ? 1 : dpr) * SIDEPANEL_OPENWIDTH;
|
||||||
|
|
|
@ -352,7 +352,7 @@ class TopPanel {
|
||||||
if (this.editor.svgCanvas.addedNew) {
|
if (this.editor.svgCanvas.addedNew) {
|
||||||
// Timeout needed for IE9
|
// Timeout needed for IE9
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
$id("text").focus()
|
$id("text").focus();
|
||||||
$id("text").select();
|
$id("text").select();
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ class TopPanel {
|
||||||
|
|
||||||
if ((elem && !isNode) || this.multiselected) {
|
if ((elem && !isNode) || this.multiselected) {
|
||||||
// update the selected elements' layer
|
// update the selected elements' layer
|
||||||
$id("selLayerNames").removeAttribute("disabled")
|
$id("selLayerNames").removeAttribute("disabled");
|
||||||
$id("selLayerNames").value = currentLayerName;
|
$id("selLayerNames").value = currentLayerName;
|
||||||
|
|
||||||
// Enable regular menu options
|
// Enable regular menu options
|
||||||
|
@ -742,7 +742,7 @@ class TopPanel {
|
||||||
init() {
|
init() {
|
||||||
// add Top panel
|
// add Top panel
|
||||||
const template = document.createElement("template");
|
const template = document.createElement("template");
|
||||||
const {i18next} = this.editor
|
const {i18next} = this.editor;
|
||||||
// eslint-disable-next-line no-unsanitized/property
|
// eslint-disable-next-line no-unsanitized/property
|
||||||
template.innerHTML = `
|
template.innerHTML = `
|
||||||
<div id="tools_top">
|
<div id="tools_top">
|
||||||
|
|
|
@ -41,7 +41,7 @@ export const copyElem = function (el, getNextId) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (el.dataset.gsvg) {
|
if (el.dataset.gsvg) {
|
||||||
newEl.dataset.gsvg = newEl.firstChild
|
newEl.dataset.gsvg = newEl.firstChild;
|
||||||
} else if (el.dataset.symbol) {
|
} else if (el.dataset.symbol) {
|
||||||
const ref = el.dataset.symbol;
|
const ref = el.dataset.symbol;
|
||||||
newEl.dataset.ref = ref;
|
newEl.dataset.ref = ref;
|
||||||
|
|
|
@ -428,7 +428,7 @@ export class Segment {
|
||||||
*/
|
*/
|
||||||
selectCtrls (y) {
|
selectCtrls (y) {
|
||||||
document.getElementById('ctrlpointgrip_' + this.index + 'c1').setAttribute('fill', y ? '#0FF' : '#EEE');
|
document.getElementById('ctrlpointgrip_' + this.index + 'c1').setAttribute('fill', y ? '#0FF' : '#EEE');
|
||||||
document.getElementById('ctrlpointgrip_' + this.index + 'c2').setAttribute('fill', y ? '#0FF' : '#EEE')
|
document.getElementById('ctrlpointgrip_' + this.index + 'c2').setAttribute('fill', y ? '#0FF' : '#EEE');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -707,7 +707,7 @@ export const recalculateDimensions = function (selected) {
|
||||||
y1: selected.getAttribute('y1'),
|
y1: selected.getAttribute('y1'),
|
||||||
x2: selected.getAttribute('x2'),
|
x2: selected.getAttribute('x2'),
|
||||||
y2: selected.getAttribute('y2'),
|
y2: selected.getAttribute('y2'),
|
||||||
}
|
};
|
||||||
// Fallthrough
|
// Fallthrough
|
||||||
case 'polyline':
|
case 'polyline':
|
||||||
case 'polygon':
|
case 'polygon':
|
||||||
|
|
|
@ -733,7 +733,7 @@ export const convertToGroup = function (elem) {
|
||||||
recalculateDimensions(elem);
|
recalculateDimensions(elem);
|
||||||
elementContext_.call('selected', [elem]);
|
elementContext_.call('selected', [elem]);
|
||||||
} else if (dataStorage.has($elem, 'symbol')) {
|
} else if (dataStorage.has($elem, 'symbol')) {
|
||||||
elem = dataStorage.get($elem, 'symbol')
|
elem = dataStorage.get($elem, 'symbol');
|
||||||
|
|
||||||
ts = $elem.attr('transform');
|
ts = $elem.attr('transform');
|
||||||
const pos = $elem.attr(['x', 'y']);
|
const pos = $elem.attr(['x', 'y']);
|
||||||
|
|
|
@ -1140,7 +1140,7 @@ export const getVisibleElements = function (parentElement) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const contentElems = [];
|
const contentElems = [];
|
||||||
const childrens = parentElement.children
|
const childrens = parentElement.children;
|
||||||
Array.prototype.forEach.call(childrens, function (elem) {
|
Array.prototype.forEach.call(childrens, function (elem) {
|
||||||
if (elem.getBBox) {
|
if (elem.getBBox) {
|
||||||
contentElems.push(elem);
|
contentElems.push(elem);
|
||||||
|
|
Loading…
Reference in New Issue