55 defaultCoastSettings ,
66 fractalize ,
77 makeRoughnessProfile ,
8- PROFILE_SIZE
8+ PROFILE_SIZE ,
99} from "../renderers/coastline-fractal" ;
1010import { byId } from "../utils" ;
1111
@@ -27,7 +27,7 @@ const SLIDER_DEFS: SliderDef[] = [
2727 min : 1 ,
2828 max : 5 ,
2929 step : 1 ,
30- key : "maxDepth"
30+ key : "maxDepth" ,
3131 } ,
3232 {
3333 id : "coastBaseAmplitude" ,
@@ -36,7 +36,7 @@ const SLIDER_DEFS: SliderDef[] = [
3636 min : 0.2 ,
3737 max : 4 ,
3838 step : 0.1 ,
39- key : "baseAmplitude"
39+ key : "baseAmplitude" ,
4040 } ,
4141 {
4242 id : "coastAmplitudeDecay" ,
@@ -45,7 +45,7 @@ const SLIDER_DEFS: SliderDef[] = [
4545 min : 0.01 ,
4646 max : 0.99 ,
4747 step : 0.01 ,
48- key : "amplitudeDecay"
48+ key : "amplitudeDecay" ,
4949 } ,
5050 {
5151 id : "coastMinEdge" ,
@@ -54,7 +54,7 @@ const SLIDER_DEFS: SliderDef[] = [
5454 min : 0.1 ,
5555 max : 10 ,
5656 step : 0.1 ,
57- key : "minEdge"
57+ key : "minEdge" ,
5858 } ,
5959 {
6060 id : "coastSmoothThreshold" ,
@@ -63,7 +63,7 @@ const SLIDER_DEFS: SliderDef[] = [
6363 min : 0.01 ,
6464 max : 0.5 ,
6565 step : 0.01 ,
66- key : "smoothThreshold"
66+ key : "smoothThreshold" ,
6767 } ,
6868 {
6969 id : "coastRoughnessContrast" ,
@@ -72,7 +72,7 @@ const SLIDER_DEFS: SliderDef[] = [
7272 min : 0.5 ,
7373 max : 10 ,
7474 step : 0.1 ,
75- key : "roughnessContrast"
75+ key : "roughnessContrast" ,
7676 } ,
7777 {
7878 id : "coastProfileHarmonics" ,
@@ -81,7 +81,7 @@ const SLIDER_DEFS: SliderDef[] = [
8181 min : 1 ,
8282 max : 8 ,
8383 step : 1 ,
84- key : "profileHarmonics"
84+ key : "profileHarmonics" ,
8585 } ,
8686 {
8787 id : "coastLakeSmoothThreshMult" ,
@@ -90,8 +90,8 @@ const SLIDER_DEFS: SliderDef[] = [
9090 min : 0.1 ,
9191 max : 5 ,
9292 step : 0.1 ,
93- key : "lakeSmoothThreshMult"
94- }
93+ key : "lakeSmoothThreshMult" ,
94+ } ,
9595] ;
9696
9797const COAST_PRESETS : Record < string , Omit < CoastlineSettings , "enabled" > > = {
@@ -147,7 +147,7 @@ export function open(): void {
147147 document . body . insertAdjacentHTML ( "beforeend" , buildDialogHTML ( ) ) ;
148148 }
149149
150- for ( const { id, key} of SLIDER_DEFS ) {
150+ for ( const { id, key } of SLIDER_DEFS ) {
151151 const slider = byId ( id ) as HTMLInputElement | null ;
152152 const output = byId ( `${ id } Out` ) as HTMLElement | null ;
153153 const resetBtn = byId ( `${ id } Reset` ) as HTMLElement | null ;
@@ -185,7 +185,7 @@ export function open(): void {
185185 thumb . style . left = defaultCoastSettings . enabled ? "18px" : "2px" ;
186186 slidersDiv . style . opacity = defaultCoastSettings . enabled ? "" : "0.4" ;
187187 slidersDiv . style . pointerEvents = defaultCoastSettings . enabled ? "" : "none" ;
188- Object . keys ( COAST_PRESETS ) . forEach ( name => {
188+ Object . keys ( COAST_PRESETS ) . forEach ( ( name ) => {
189189 const btn = byId ( `coastPreset_${ name } ` ) as HTMLButtonElement | null ;
190190 if ( btn ) btn . disabled = ! defaultCoastSettings . enabled ;
191191 } ) ;
@@ -205,7 +205,7 @@ export function open(): void {
205205 if ( ! btn ) continue ;
206206 btn . on ( "click" , ( ) => {
207207 const preset = COAST_PRESETS [ name ] ;
208- for ( const { id, key} of SLIDER_DEFS ) {
208+ for ( const { id, key } of SLIDER_DEFS ) {
209209 if ( ! ( key in preset ) ) continue ;
210210 const val = preset [ key as keyof typeof preset ] ;
211211 defaultCoastSettings [ key ] = val ;
@@ -225,19 +225,20 @@ export function open(): void {
225225 $ ( "#coastlineSettingsDialog" ) . dialog ( {
226226 title : "Coastline Settings Editor" ,
227227 resizable : false ,
228- width : ' auto' ,
229- position : { my : "right top" , at : "right-10 top+10" , of : "svg" }
228+ width : " auto" ,
229+ position : { my : "right top" , at : "right-10 top+10" , of : "svg" } ,
230230 } ) ;
231231}
232232
233233function buildDialogHTML ( ) : string {
234234 const presetButtons = Object . keys ( COAST_PRESETS )
235235 . map (
236- name => `<button id="coastPreset_${ name } " style="font-size:.78em;padding:2px 8px">${ name } </button>`
236+ ( name ) =>
237+ `<button id="coastPreset_${ name } " style="font-size:.78em;padding:2px 8px">${ name } </button>` ,
237238 )
238239 . join ( "" ) ;
239240
240- const rows = SLIDER_DEFS . map ( ( { id, label, tip, min, max, step, key} ) => {
241+ const rows = SLIDER_DEFS . map ( ( { id, label, tip, min, max, step, key } ) => {
241242 const value = defaultCoastSettings [ key ] ;
242243 return /* html */ `
243244 <tr data-tip="${ tip } ">
@@ -303,7 +304,11 @@ function drawRoughnessGraph(canvas: HTMLCanvasElement): void {
303304 ctx . clearRect ( 0 , 0 , W , H ) ;
304305
305306 const rand = Alea ( PREVIEW_SEED ) ;
306- const profile = makeRoughnessProfile ( rand , defaultCoastSettings . roughnessContrast , defaultCoastSettings . profileHarmonics ) ;
307+ const profile = makeRoughnessProfile (
308+ rand ,
309+ defaultCoastSettings . roughnessContrast ,
310+ defaultCoastSettings . profileHarmonics ,
311+ ) ;
307312
308313 const thresh = Math . min ( Math . max ( defaultCoastSettings . smoothThreshold , 0 ) , 1 ) ;
309314 const threshY = H * ( 1 - thresh ) ;
@@ -337,7 +342,11 @@ function drawRoughnessGraph(canvas: HTMLCanvasElement): void {
337342 } ;
338343
339344 // Helper: stroke curve clipped to a horizontal band
340- const strokeBand = ( clipTop : number , clipBot : number , color : string ) : void => {
345+ const strokeBand = (
346+ clipTop : number ,
347+ clipBot : number ,
348+ color : string ,
349+ ) : void => {
341350 const h = clipBot - clipTop ;
342351 if ( h <= 0 ) return ;
343352 ctx . save ( ) ;
@@ -407,23 +416,37 @@ function drawShapePreview(canvas: HTMLCanvasElement): void {
407416 [ cx , cy - r ] , // top
408417 [ cx + r , cy ] , // right
409418 [ cx , cy + r ] , // bottom
410- [ cx - r , cy ] // left
419+ [ cx - r , cy ] , // left
411420 ] ;
412421
413422 const shape = defaultCoastSettings . enabled
414423 ? fractalize ( basePts , Alea ( PREVIEW_SEED ) , defaultCoastSettings )
415- : { points : basePts , origIndices : [ 0 , 1 , 2 , 3 ] } ;
424+ : { points : basePts , origIndices : [ 0 , 1 , 2 , 3 ] } ;
416425 const path = new Path2D ( `${ buildCoastlinePath ( shape ) } Z` ) ;
417426
418427 // Ocean background — radial gradient, lighter at centre
419- const bgGrad = ctx . createRadialGradient ( cx , cy , 0 , cx , cy , Math . max ( W , H ) * 0.85 ) ;
428+ const bgGrad = ctx . createRadialGradient (
429+ cx ,
430+ cy ,
431+ 0 ,
432+ cx ,
433+ cy ,
434+ Math . max ( W , H ) * 0.85 ,
435+ ) ;
420436 bgGrad . addColorStop ( 0 , "#cce5f5" ) ;
421437 bgGrad . addColorStop ( 1 , "#6aa4cb" ) ;
422438 ctx . fillStyle = bgGrad ;
423439 ctx . fillRect ( 0 , 0 , W , H ) ;
424440
425441 // Land fill with drop shadow
426- const landGrad = ctx . createRadialGradient ( cx - r * 0.1 , cy - r * 0.1 , r * 0.05 , cx , cy , r * 1.1 ) ;
442+ const landGrad = ctx . createRadialGradient (
443+ cx - r * 0.1 ,
444+ cy - r * 0.1 ,
445+ r * 0.05 ,
446+ cx ,
447+ cy ,
448+ r * 1.1 ,
449+ ) ;
427450 landGrad . addColorStop ( 0 , "#d8c87a" ) ;
428451 landGrad . addColorStop ( 0.5 , "#9cbc60" ) ;
429452 landGrad . addColorStop ( 1 , "#5c8e40" ) ;
@@ -443,7 +466,7 @@ function drawShapePreview(canvas: HTMLCanvasElement): void {
443466 ctx . stroke ( path ) ;
444467
445468 // Original polygon skeleton — shows the raw 4-vertex input before fractalization
446- const origPts = shape . origIndices . map ( i => shape . points [ i ] ) ;
469+ const origPts = shape . origIndices . map ( ( i ) => shape . points [ i ] ) ;
447470 ctx . beginPath ( ) ;
448471 for ( let j = 0 ; j < origPts . length ; j ++ ) {
449472 const [ x , y ] = origPts [ j ] ;
@@ -482,8 +505,8 @@ function drawShapePreview(canvas: HTMLCanvasElement): void {
482505
483506declare global {
484507 interface Window {
485- CoastlineEditor : { open : ( ) => void } ;
508+ CoastlineEditor : { open : ( ) => void } ;
486509 }
487510}
488511
489- window . CoastlineEditor = { open} ;
512+ window . CoastlineEditor = { open } ;
0 commit comments