in progress

This commit is contained in:
JFH
2021-12-27 20:54:49 -03:00
parent f32be000a0
commit 258e2bd6a1
28 changed files with 220 additions and 218 deletions

View File

@@ -25,12 +25,12 @@ const loadExtensionTranslation = async function (svgEditor) {
export default {
name,
async init(S) {
async init() {
const svgEditor = this;
await loadExtensionTranslation(svgEditor);
const { ChangeElementCommand } = S;
// svgdoc = S.svgroot.parentNode.ownerDocument,
const { svgCanvas } = svgEditor;
await loadExtensionTranslation(svgEditor);
const { ChangeElementCommand } = svgCanvas.history;
// svgdoc = S.svgroot.parentNode.ownerDocument,
const addToHistory = function (cmd) { svgCanvas.undoMgr.addCommandToHistory(cmd); };
const currentStyle = {
fillPaint: 'red', fillOpacity: 1.0,

View File

@@ -29,9 +29,10 @@
export default {
name: 'markers',
async init (S) {
async init () {
const svgEditor = this;
const { svgCanvas } = svgEditor;
const { BatchCommand, RemoveElementCommand, InsertElementCommand } = svgCanvas.history;
const { $id, addSVGElemensFromJson: addElem } = svgCanvas;
const mtypes = [ 'start', 'mid', 'end' ];
const markerElems = [ 'line', 'path', 'polyline', 'polygon' ];
@@ -182,16 +183,16 @@ export default {
if (m) { pline.setAttribute(nam, elem.getAttribute(nam)); }
});
const batchCmd = new S.BatchCommand();
batchCmd.addSubCommand(new S.RemoveElementCommand(elem, elem.parentNode));
batchCmd.addSubCommand(new S.InsertElementCommand(pline));
const batchCmd = new BatchCommand();
batchCmd.addSubCommand(new RemoveElementCommand(elem, elem.parentNode));
batchCmd.addSubCommand(new InsertElementCommand(pline));
elem.insertAdjacentElement('afterend', pline);
elem.remove();
svgCanvas.clearSelection();
pline.id = id;
svgCanvas.addToSelection([ pline ]);
S.addCommandToHistory(batchCmd);
svgCanvas.addCommandToHistory(batchCmd);
return pline;
};

View File

@@ -25,11 +25,11 @@ const loadExtensionTranslation = async function (svgEditor) {
export default {
name,
async init(_S) {
async init() {
const svgEditor = this;
const { ChangeElementCommand } = _S; // , svgcontent,
const addToHistory = function (cmd) { svgCanvas.undoMgr.addCommandToHistory(cmd); };
const { svgCanvas } = svgEditor;
const { ChangeElementCommand } = svgCanvas.history;
const addToHistory = function (cmd) { svgCanvas.undoMgr.addCommandToHistory(cmd); };
const { $id } = svgCanvas;
let selElems;
let started;