@@ -3,29 +3,7 @@ $(function() {
33var root = window ;
44var cnc = root . cnc || { } ;
55var controller = cnc . controller ;
6- const jogValueSelect = $ ( 'select[data-name="select-distance"]' ) ;
7-
8- function nextSelectDistance ( ) {
9- const $current = jogValueSelect . find ( 'option:selected' ) ;
10- var $next = $current . next ( 'option' ) ;
11- if ( $next . length === 0 ) {
12- $next = jogValueSelect . find ( 'option' ) . first ( ) ; // Wrap to the first option
13- }
14- $current . prop ( 'selected' , false ) ;
15- $next . prop ( 'selected' , true ) ;
16- }
17- $ ( 'button[data-name="next-select-distance"]' ) . on ( 'click' , nextSelectDistance )
18-
19- function prevSelectDistance ( ) {
20- const $current = jogValueSelect . find ( 'option:selected' ) ;
21- var $prev = $current . prev ( 'option' ) ;
22- if ( $prev . length === 0 ) {
23- $prev = jogValueSelect . find ( 'option' ) . last ( ) ; // Wrap to the last option
24- }
25- $current . prop ( 'selected' , false ) ;
26- $prev . prop ( 'selected' , true ) ;
27- }
28- $ ( 'button[data-name="prev-select-distance"]' ) . on ( 'click' , prevSelectDistance )
6+ const jogDistanceSelect = $ ( 'select[data-name="select-distance"]' ) ;
297
308controller . on ( 'serialport:list' , function ( list ) {
319 var $el = $ ( '[data-route="connection"] select[data-name="port"]' ) ;
@@ -442,3 +420,26 @@ $('[data-route="axes"] [data-name="active-state"]').text('Not connected');
442420$ ( '[data-route="axes"] select[data-name="select-distance"]' ) . val ( '1' ) ;
443421
444422} ) ;
423+
424+ function nextSelectDistance ( ) {
425+ const $current = jogDistanceSelect . find ( 'option:selected' ) ;
426+ var $next = $current . next ( 'option' ) ;
427+ if ( $next . length === 0 ) {
428+ $next = jogDistanceSelect . find ( 'option' ) . first ( ) ; // Wrap to the first option
429+ }
430+ $current . prop ( 'selected' , false ) ;
431+ $next . prop ( 'selected' , true ) ;
432+ }
433+ $ ( 'button[data-name="next-select-distance"]' ) . on ( 'click' , nextSelectDistance )
434+
435+ function prevSelectDistance ( ) {
436+ const $current = jogDistanceSelect . find ( 'option:selected' ) ;
437+ var $prev = $current . prev ( 'option' ) ;
438+ if ( $prev . length === 0 ) {
439+ $prev = jogDistanceSelect . find ( 'option' ) . last ( ) ; // Wrap to the last option
440+ }
441+ $current . prop ( 'selected' , false ) ;
442+ $prev . prop ( 'selected' , true ) ;
443+ }
444+ $ ( 'button[data-name="prev-select-distance"]' ) . on ( 'click' , prevSelectDistance )
445+
0 commit comments