mirror of
https://github.com/youfoundjk/TeXcore.git
synced 2026-07-22 07:33:31 +00:00
feat(tikz): implement undo functionality and clean up TikZ output generation
This commit is contained in:
parent
416e4fa987
commit
1642b5cd76
2 changed files with 7 additions and 4 deletions
|
|
@ -530,6 +530,12 @@ export class TikzEditorModal extends Modal implements TikzEditorContext {
|
|||
return;
|
||||
}
|
||||
|
||||
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'z') {
|
||||
e.preventDefault();
|
||||
this.handleUndo();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((e.ctrlKey || e.metaKey) && e.key.toLowerCase() === 'c') {
|
||||
e.preventDefault();
|
||||
const uniqueIds = Array.from(new Set(this.selectedVertices.map(v => v.elementId)));
|
||||
|
|
|
|||
|
|
@ -305,10 +305,7 @@ export class TikzCodec {
|
|||
|
||||
public generate(elements: EditorElement[], pictureOptions: string): string {
|
||||
let output = '';
|
||||
output += `\\begin{tikzpicture}${pictureOptions}\n`;
|
||||
|
||||
const stateObj = { elements, pictureOptions };
|
||||
output += ` % [ObsiTeXState:${JSON.stringify(stateObj)}]\n\n`;
|
||||
output += `\\begin{tikzpicture}${pictureOptions}\n\n`;
|
||||
|
||||
elements.forEach(elem => {
|
||||
const xVal = this.fromCanvasX(elem.x).toFixed(2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue