Refactor code structure for improved readability and maintainability

This commit is contained in:
CNCKitchen
2026-03-25 08:03:22 +01:00
parent 0cff3f8d10
commit 475945a799
12 changed files with 33 additions and 12 deletions
+2
View File
@@ -141,6 +141,7 @@ export const TRANSLATIONS = {
'sponsor.title': 'Thanks for using CNC Kitchen STL Texturizer!',
'sponsor.body': 'This tool is provided <strong>completely free</strong> by CNC Kitchen.<br>While your STL is being processed, why not check out the store that helps us keep making cool stuff for you?',
'sponsor.visitStore': '\uD83D\uDED2 Visit CNCKitchen.STORE',
'sponsor.donate': '\uD83D\uDC99 Donate on PayPal',
'sponsor.dontShow': "Don\u2019t show this again",
'sponsor.closeAndContinue':'Close &amp; Continue',
@@ -292,6 +293,7 @@ export const TRANSLATIONS = {
'sponsor.title': 'Danke f\u00fcr die Nutzung des CNC Kitchen STL Texturizers!',
'sponsor.body': 'Dieses Tool wird von CNC Kitchen <strong>komplett kostenlos</strong> bereitgestellt.<br>W\u00e4hrend dein STL verarbeitet wird, schau doch mal im Shop vorbei, der uns hilft, coole Sachen f\u00fcr dich zu machen!',
'sponsor.visitStore': '\uD83D\uDED2 CNCKitchen.STORE besuchen',
'sponsor.donate': '\uD83D\uDC99 Via PayPal spenden',
'sponsor.dontShow': 'Nicht mehr anzeigen',
'sponsor.closeAndContinue':'Schlie\u00dfen &amp; Weiter',
+5
View File
@@ -1408,6 +1408,11 @@ function addSmoothNormals(geometry) {
async function toggleDisplacementPreview(enable) {
settings.useDisplacement = enable;
// Exit surface masking mode when the 3D preview is activated
if (enable && exclusionTool) {
setExclusionTool(null);
}
if (!enable) {
// Revert to original geometry with bump-only shading.
if (currentGeometry && previewMaterial) {
+18 -12
View File
@@ -29,18 +29,24 @@ function fitDimensions(imgW, imgH) {
// ── Image-based presets ───────────────────────────────────────────────────────
const IMAGE_PRESETS = [
{ name: 'Basket', url: 'textures/basket.jpg' },
{ name: 'Brick', url: 'textures/brick.jpg' },
{ name: 'Bubble', url: 'textures/bubble.jpg' },
{ name: 'Crystal', url: 'textures/crystal.jpg' },
{ name: 'Hexagon', url: 'textures/hexagon.jpg' },
{ name: 'Knitting', url: 'textures/knitting.jpg' },
{ name: 'Knurling', url: 'textures/knurling.jpg' },
{ name: 'Leather', url: 'textures/leather.jpg' },
{ name: 'Leather 2', url: 'textures/leather2.jpg' },
{ name: 'Weave', url: 'textures/weave.jpg' },
{ name: 'Wood', url: 'textures/wood.jpg' },
{ name: 'Noise', url: 'textures/noise.jpg' },
{ name: 'Basket', url: 'textures/basket.jpg' },
{ name: 'Brick', url: 'textures/brick.jpg' },
{ name: 'Bubble', url: 'textures/bubble.jpg' },
{ name: 'Crystal', url: 'textures/crystal.jpg' },
{ name: 'Grip Surface', url: 'textures/gripSurface.jpg' },
{ name: 'Hexagon', url: 'textures/hexagon.jpg' },
{ name: 'Hexagons', url: 'textures/hexagons.jpg' },
{ name: 'Knitting', url: 'textures/knitting.jpg' },
{ name: 'Knurling', url: 'textures/knurling.jpg' },
{ name: 'Leather', url: 'textures/leather.jpg' },
{ name: 'Leather 2', url: 'textures/leather2.jpg' },
{ name: 'Melt', url: 'textures/melt.jpg' },
{ name: 'Noise', url: 'textures/noise.jpg' },
{ name: 'Rhombic', url: 'textures/rhombic.jpg' },
{ name: 'Voronoi', url: 'textures/voronoi.jpg' },
{ name: 'Weave', url: 'textures/weave.jpg' },
{ name: 'Weave 02', url: 'textures/weave_02.jpg' },
{ name: 'Wood', url: 'textures/wood.jpg' },
];
function loadImagePreset({ name, url }) {