#91 issue fix and JavaScript changes (#93)

* #91 clickSelect issue fixed

* #90 image src set issue fixed

* #91 svgcanvas undefined issue fixed

* #91 console removed and each changes

* #91 $.each changes

* #91 $.each changes

* #91 forech change to Object.entries

* #91 each and entries changes

* #91 jquery extend changes

* #91 extend modification changes
This commit is contained in:
Agriya Dev5
2021-04-23 13:48:15 +05:30
committed by GitHub
parent 9d2379f333
commit 80ff613075
14 changed files with 37 additions and 34 deletions

View File

@@ -22,6 +22,7 @@ import { isMac } from '../common/browser.js';
import SvgCanvas from '../svgcanvas/svgcanvas.js';
import ConfigObj from './ConfigObj.js';
import {mergeDeep} from './components/jgraduate/Util.js';
import {
readLang, putLocale,
@@ -1207,7 +1208,7 @@ class Editor extends EditorStartup {
// Todo: Add proper RTL Support!
// Todo: Use RTL detection instead and take out of locales?
// document.documentElement.dir = allStrings.dir;
$.extend(this.uiStrings, allStrings);
this.uiStrings = mergeDeep(this.uiStrings, allStrings);
// const notif = allStrings.notification; // Currently unused
// $.extend will only replace the given strings

View File

@@ -215,7 +215,7 @@ export default {
const mtypes = ['start', 'mid', 'end'];
const defs = svgCanvas.findDefs();
$.each(mtypes, function (i, type) {
mtypes.forEach(function(type, i){
const marker = getLinked(elem, 'marker-' + type);
if (!marker) { return; }

View File

@@ -24,7 +24,7 @@ export default {
async init(S) {
const svgEditor = this;
const { svgCanvas } = svgEditor;
const { getElem, $id } = svgCanvas;
const { getElem, $id, mergeDeep } = svgCanvas;
const { $, svgroot } = S,
addElem = svgCanvas.addSVGElementFromJson,
selManager = S.selectorManager;
@@ -51,7 +51,7 @@ export default {
const getBBintersect = (x, y, bb, offset) => {
if (offset) {
offset -= 0;
bb = $.extend({}, bb);
bb = mergeDeep({}, bb);
bb.width += offset;
bb.height += offset;
bb.x -= offset / 2;

View File

@@ -28,7 +28,7 @@ export default {
const { $id } = svgEditor.svgCanvas;
const imagelibStrings = await loadExtensionTranslation(svgEditor.configObj.pref('lang'));
const { uiStrings, canvas: svgCanvas } = svgEditor;
const { uiStrings, svgCanvas } = svgEditor;
const allowedImageLibOrigins = imagelibStrings.imgLibs.map(({ url }) => {
try {
@@ -332,9 +332,9 @@ export default {
}
const toggleMultiLoop = () => {
$.each(multiArr, function (i) {
const type = this[0];
const data = this[1];
multiArr.forEach(function(item, i){
const type = item[0];
const data = item[1];
if (type === 'svg') {
svgCanvas.importSvgString(data);
} else {

View File

@@ -89,7 +89,7 @@ class BottomPanel {
buttonsNeedingStroke.forEach((btn) => {
// if btn is pressed, change to select button
if ($id(btn).pressed) {
this.editor.leftPanelHandlers.clickSelect();
this.editor.leftPanel.clickSelect();
}
$id(btn).disabled = true;
});
@@ -103,7 +103,7 @@ class BottomPanel {
buttonsNeedingFillAndStroke.forEach((btn) => {
// if btn is pressed, change to select button
if ($id(btn).pressed) {
this.editor.leftPanelHandlers.clickSelect();
this.editor.leftPanel.clickSelect();
}
$id(btn).disabled = true;
});