@@ -3,7 +3,8 @@ import { ref, watch } from 'vue'
33// Import tool types
44interface Tool {
55 id : number
6- offset : number
6+ offsetX : number
7+ offsetZ : number
78 description : string
89}
910
@@ -20,20 +21,21 @@ const isQuitting = ref(false)
2021
2122// Tool table state
2223const tools = ref < Tool [ ] > ( [
23- { id : 0 , offset : 0 , description : 'Reference Tool' } ,
24- { id : 1 , offset : 0 , description : '' } ,
25- { id : 2 , offset : 0 , description : '' } ,
26- { id : 3 , offset : 0 , description : '' } ,
27- { id : 4 , offset : 0 , description : '' } ,
28- { id : 5 , offset : 0 , description : '' } ,
29- { id : 6 , offset : 0 , description : '' } ,
30- { id : 7 , offset : 0 , description : '' } ,
31- { id : 8 , offset : 0 , description : '' } ,
32- { id : 9 , offset : 0 , description : '' }
24+ { id : 0 , offsetX : 0 , offsetZ : 0 , description : 'Reference Tool' } ,
25+ { id : 1 , offsetX : 0 , offsetZ : 0 , description : '' } ,
26+ { id : 2 , offsetX : 0 , offsetZ : 0 , description : '' } ,
27+ { id : 3 , offsetX : 0 , offsetZ : 0 , description : '' } ,
28+ { id : 4 , offsetX : 0 , offsetZ : 0 , description : '' } ,
29+ { id : 5 , offsetX : 0 , offsetZ : 0 , description : '' } ,
30+ { id : 6 , offsetX : 0 , offsetZ : 0 , description : '' } ,
31+ { id : 7 , offsetX : 0 , offsetZ : 0 , description : '' } ,
32+ { id : 8 , offsetX : 0 , offsetZ : 0 , description : '' } ,
33+ { id : 9 , offsetX : 0 , offsetZ : 0 , description : '' }
3334] )
3435
3536const currentToolIndex = ref ( 0 )
36- const currentToolOffset = ref ( 0 )
37+ const currentToolOffsetX = ref ( 0 )
38+ const currentToolOffsetZ = ref ( 0 )
3739
3840// Flag to ensure watcher is only set up once
3941let isWatcherSetup = false
@@ -65,8 +67,11 @@ export function useSettings() {
6567 if ( settings . currentToolIndex !== undefined ) {
6668 currentToolIndex . value = settings . currentToolIndex
6769 }
68- if ( settings . currentToolOffset !== undefined ) {
69- currentToolOffset . value = settings . currentToolOffset
70+ if ( settings . currentToolOffsetX !== undefined ) {
71+ currentToolOffsetX . value = settings . currentToolOffsetX
72+ }
73+ if ( settings . currentToolOffsetZ !== undefined ) {
74+ currentToolOffsetZ . value = settings . currentToolOffsetZ
7075 }
7176 } else {
7277 console . error ( 'window.settings is not available' )
@@ -96,7 +101,8 @@ export function useSettings() {
96101 pitchZ : pitchZ . value ,
97102 tools : plainTools ,
98103 currentToolIndex : currentToolIndex . value ,
99- currentToolOffset : currentToolOffset . value
104+ currentToolOffsetX : currentToolOffsetX . value ,
105+ currentToolOffsetZ : currentToolOffsetZ . value
100106 } )
101107 } catch ( error ) {
102108 console . error ( 'Failed to save settings:' , error )
@@ -106,7 +112,7 @@ export function useSettings() {
106112
107113 // Auto-save settings when they change (only set up once)
108114 if ( ! isWatcherSetup ) {
109- watch ( [ diameterMode , defaultMetricOnStartup , selectedThreadingTab , selectedTurningTab , selectedPitchTab , pitchX , pitchZ , tools , currentToolIndex , currentToolOffset ] , ( ) => {
115+ watch ( [ diameterMode , defaultMetricOnStartup , selectedThreadingTab , selectedTurningTab , selectedPitchTab , pitchX , pitchZ , tools , currentToolIndex , currentToolOffsetX , currentToolOffsetZ ] , ( ) => {
110116 saveSettings ( )
111117 } , { deep : true } )
112118 isWatcherSetup = true
@@ -126,6 +132,7 @@ export function useSettings() {
126132 saveSettings,
127133 tools,
128134 currentToolIndex,
129- currentToolOffset
135+ currentToolOffsetX,
136+ currentToolOffsetZ
130137 }
131138}
0 commit comments