You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is for automatically rounding values in the spreadsheet for node locations
document.addEventListener('keydown',(event)=>{if(event.ctrlKey&&event.key===']'){constactiveTextarea=document.querySelector('textarea.handsontableInput');if(activeTextarea){constoriginalValue=activeTextarea.value;constparsedValue=parseFloat(originalValue);if(!isNaN(parsedValue)){constroundedValue=parsedValue.toFixed(3);activeTextarea.value=roundedValue;showDifferencePopup(activeTextarea,originalValue,roundedValue);// Pass activeTextarea here}}}});functionshowDifferencePopup(activeTextarea,original,rounded){// Create the popup elementconstpopup=document.createElement('div');popup.style.position='absolute';popup.style.zIndex='1000';popup.style.backgroundColor='#444';popup.style.color='#eee';popup.style.padding='10px';popup.style.borderRadius='5px';popup.style.fontFamily='Arial, sans-serif';popup.style.fontSize='14px';popup.style.maxWidth='300px';popup.style.boxShadow='0 2px 10px rgba(0, 0, 0, 0.3)';// Set the popup content (show original value and rounded value in diff format)popup.innerHTML=`<strong>Original:</strong> <span>${original}</span><br><strong>Rounded:</strong> <span style="color: #ff795d;">${rounded}</span> `;// Position the popup near the active textareaconstrect=activeTextarea.getBoundingClientRect();popup.style.top=`${rect.top+window.scrollY-90}px`;popup.style.left=`${rect.left+window.scrollX}px`;// Append to the bodydocument.body.appendChild(popup);// Remove the popup after 3 secondssetTimeout(()=>{popup.remove();},1000);}
this avoids using tabatbatabatabenter in the ctrl+D dialogue