PageSourceSearch

https://piatra-naturala.ro/wp-content/plugins/lemet-sbc-calculator…/layers/waterfall-layer.js?ver=3.5.0

js piatra-naturala.ro collected 2026-10-06 12:14:41 UTC 3,059 bytes, 66 lines download raw bytes

1import { profiledEdges } from '../../domain/profiled-edges.js?ver=3.5.0';
2
3export const WaterfallLayer = {
4    render(piece, options, scale) {
5        if (!piece || !options || !options.islandLegs) {
6            return '';
7        }
8
9        // Waterfall se aplica doar pe piesa principala a insulei.
10        if (piece.id && piece.id !== 1) {
11            return '';
12        }
13
14        const legs = options.islandLegs;
15        const w = (piece.l || 0) * scale;
16        const h = (piece.w || 0) * scale;
17        const color = '#8d6e63';
18        // Un picior waterfall se profilează doar dacă latura blatului de pe partea lui e
19        // bifată — atunci profilul coboară din blat pe picior, fără întrerupere (aceeași
20        // regulă ca în price-engine, secțiunea „Island waterfall legs"). Desenul trebuie să
21        // arate exact ce se facturează, altfel clientul vede profil pe un picior pe care nu-l
22        // plătește (sau invers). `profiledEdges`, nu `piece.edges` brut: cu „Fără prelucrare"
23        // nu se profilează nimic, oricâte laturi ar fi bifate.
24        const profiled = profiledEdges(piece, options);
25        const gold = '#D49400';
26        let markup = '';
27
28        const drawLeg = (x, y, width, height) => `
29            <rect x="${x}" y="${y}" width="${width}" height="${height}"
30                  fill="${color}" fill-opacity="0.28" stroke="${color}" stroke-width="2" stroke-dasharray="4,2" />
31        `;
32
33        // Muchia PROFILATĂ a piciorului: cea exterioară, paralelă cu latura din care coboară
34        // profilul. Aceeași bordură aurie cu glow ca la ProfilingLayer, ca cele două să se
35        // citească drept o singură linie continuă.
36        const drawProfiledEdge = (x1, y1, x2, y2) => `
37            <line x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}"
38                  stroke="${gold}" stroke-width="6" stroke-linecap="square" class="svg-glow-gold" />
39        `;
40
41        if (legs.left) {
42            markup += drawLeg(-15, 0, 15, h);
43            if (profiled.left) markup += drawProfiledEdge(-15, 0, -15, h);
44        }
45        if (legs.right) {
46            markup += drawLeg(w, 0, 15, h);
47            if (profiled.right) markup += drawProfiledEdge(w + 15, 0, w + 15, h);
48        }
49        if (legs.top) {
50            markup += drawLeg(0, -15, w, 15);
51            if (profiled.top) markup += drawProfiledEdge(0, -15, w, -15);
52        }
53        if (legs.bottom) {
54            markup += drawLeg(0, h, w, 15);
55            if (profiled.bottom) markup += drawProfiledEdge(0, h + 15, w, h + 15);
56        }
57        if (legs.center) {
58            // Panoul interior de susținere n-are cant vizibil, deci nu se profilează niciodată
59            // — nici în desen, nici în deviz.
60            markup += `<line x1="${w / 2}" y1="0" x2="${w / 2}" y2="${h}" stroke="${color}" stroke-width="4" stroke-dasharray="8,4" opacity="0.55" />`;
61            markup += `<text x="${(w / 2) + 6}" y="${h / 2}" fill="${color}" font-size="8" opacity="0.9">SUPORT</text>`;
62        }
63
64        return markup;
65    }
66};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.