Add more control
This commit is contained in:
@@ -7,7 +7,7 @@ import { ImageEditor } from "./image-editor";
|
||||
import { ToolHandler } from "./handler-tools";
|
||||
import { GlobalSettingsHandler } from "./handler-global-settings";
|
||||
import { Popup } from "./popup";
|
||||
import { imageToLaserSVG } from "../svg-tracer";
|
||||
import { imageToOutlineSVG } from "../svg-tracer";
|
||||
import { urlToImage, canvasToBlob, imageToCanvas } from "../utils/image";
|
||||
import { loadFileAsDataUrl, makeFilenameSafe } from "../utils/generic";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
@@ -242,9 +242,7 @@ export class VectraceHandler {
|
||||
async importFile(file: File) {
|
||||
const buffer = await loadFileAsDataUrl(file);
|
||||
const imageElement = await urlToImage(buffer);
|
||||
const options: TracerOptions = {};
|
||||
const svg = imageToLaserSVG(imageElement, {
|
||||
...options,
|
||||
const { svg, options } = imageToOutlineSVG(imageElement, {
|
||||
scale: 1,
|
||||
strokewidth: this.STROKE_WIDTH
|
||||
});
|
||||
@@ -375,17 +373,17 @@ export class VectraceHandler {
|
||||
const base = images.image;
|
||||
|
||||
const scale = rendered.scale;
|
||||
const options: TracerOptions = {
|
||||
const oldOptions: TracerOptions = {
|
||||
...rendered.svg.options,
|
||||
scale,
|
||||
strokewidth: this.STROKE_WIDTH
|
||||
};
|
||||
|
||||
const prevOptions = cloneDeep(options);
|
||||
const prevOptions = cloneDeep(oldOptions);
|
||||
|
||||
const svg = imageToLaserSVG(rendered.image, options);
|
||||
const { svg, options } = imageToOutlineSVG(rendered.image, oldOptions);
|
||||
|
||||
const dirty = !isEqual(prevOptions, options);
|
||||
const dirty = !isEqual(prevOptions, oldOptions);
|
||||
rendered.svg.dirty = dirty;
|
||||
base.svg.dirty = dirty;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user