diff --git a/extension/locale.txt b/extension/locale.txt index e3798b5..19fb307 100644 --- a/extension/locale.txt +++ b/extension/locale.txt @@ -21,8 +21,7 @@ Solid region (copper fill / keepout, board cutout) = Fläche (copper fill / keep Track (board outline, silk) = Linien (Umriss, Beschriftung) (curves will be broken up into segments) = (Kurven werden in Segmente geteilt) Curve segmentation accuracy (Track import only) = Genauigkeit für Kurven-Segmente (Linien-Import) -Import scale (EasyEDA base unit is 0.1 inch) = Skalierung (EasyEDA verwendet 0.1 Inch als Basis-Einheit) -Import origin (svg origin will be placed here) = SVG Ursprung an dieser Stelle plazieren +Import scale (EasyEDA base unit is 0.01 inch) = Skalierung (EasyEDA verwendet 0.01 Inch als Basis-Einheit) err_file_not_supported = Dateityp nicht unterstützt, bitte .svg wählen err_no_paths_found = Keine path-Tags gefunden 😕 err_parsing_all_paths = Fehler beim parsen der path-Tags, siehe Konsole für Details 😕 diff --git a/extension/main.js b/extension/main.js index 10e4d50..d7df680 100644 --- a/extension/main.js +++ b/extension/main.js @@ -15,6 +15,7 @@ var svgDocument = ''; var svgPaths = []; var svgImportLayer = 1; var unknownCommandFlag = false; +var svgImportUnitsSet = false; var dlg = api('createDialog', { title: "SVG Import", @@ -51,7 +52,7 @@ var dlg = api('createDialog', {
- Import scale (EasyEDA base unit is 0.1 inch) + Import scale (EasyEDA base unit is 0.01 inch)
mil @@ -131,12 +132,14 @@ api('createCommand', { }, 'extension-svgimport-open' : () => { getOffsets(); - uiUpdateLayerOptions(); + initUnits(); + uiUpdateLayerOptions(); dlg.dialog('open'); dlg.dialog('expand'); }, 'extension-svgimport-openfile' : () => { getOffsets(); + initUnits(); uiUpdateLayerOptions(); dlg.dialog('open'); dlg.dialog('expand'); @@ -147,11 +150,11 @@ api('createCommand', { uiDisplayImportScale(); }, 'extension-svgimport-set_inch' : () => { - setSvgImportScale(10); + setSvgImportScale(100); uiDisplayImportScale(); }, 'extension-svgimport-set_mil' : () => { - setSvgImportScale(0.01); + setSvgImportScale(0.1); uiDisplayImportScale(); }, 'extension-svgimport-openfiledlg' : () => { @@ -194,6 +197,15 @@ api('createToolbarButton', { ] }); +function initUnits() { + if(svgImportUnitsSet) return; + svgImportUnitsSet = true; + var config = api('editorCall', 'getConfig'); + if(svgImportScale==1 && config.canvas.unit == 'mm') api('doCommand','extension-svgimport-set_mm'); + if(svgImportScale==1 && config.canvas.unit == 'inch') api('doCommand','extension-svgimport-set_inch'); + if(svgImportScale==1 && config.canvas.unit == 'mil') api('doCommand','extension-svgimport-set_mil'); +} + function uiDisplayImportFlattenAccuracy() { $('#extension-svgimport-flatten-accuracy').val(svgImportScale); }