@@ -2351,7 +2351,9 @@ OSD.initializeRulers = function () {
2351
2351
const preview = document . querySelector ( ".preview" ) ;
2352
2352
const container = document . querySelector ( ".preview-container" ) ;
2353
2353
const enabled = document . querySelector ( "#osd-preview-rulers-selector" ) ?. checked ;
2354
- if ( ! canvas || ! preview || ! container || ! OSD . data ?. displaySize ) return false ;
2354
+ if ( ! canvas || ! preview || ! container || ! OSD . data ?. displaySize ) {
2355
+ return false ;
2356
+ }
2355
2357
if ( ! enabled ) {
2356
2358
canvas . style . display = "none" ;
2357
2359
preview . style . marginRight = "" ;
@@ -2372,17 +2374,25 @@ OSD.initializeRulers = function () {
2372
2374
OSD . setupRulerContext = function ( canvas , preview , container , config ) {
2373
2375
const cw = Math . max ( 1 , Math . floor ( container . clientWidth ) ) ;
2374
2376
const ch = Math . max ( 1 , Math . floor ( container . clientHeight ) ) ;
2375
- if ( canvas . width !== cw ) canvas . width = cw ;
2376
- if ( canvas . height !== ch ) canvas . height = ch ;
2377
+ if ( canvas . width !== cw ) {
2378
+ canvas . width = cw ;
2379
+ }
2380
+ if ( canvas . height !== ch ) {
2381
+ canvas . height = ch ;
2382
+ }
2377
2383
const ctx = canvas . getContext ( "2d" ) ;
2378
2384
ctx . clearRect ( 0 , 0 , canvas . width , canvas . height ) ;
2379
2385
ctx . font = config . font ;
2380
2386
ctx . textAlign = "center" ;
2381
2387
ctx . textBaseline = "middle" ;
2382
2388
const rows = preview . querySelectorAll ( ".row" ) ;
2383
- if ( ! rows . length ) return false ;
2389
+ if ( ! rows . length ) {
2390
+ return false ;
2391
+ }
2384
2392
const colsInRow = rows [ 0 ] . querySelectorAll ( ".char" ) ;
2385
- if ( ! colsInRow . length ) return false ;
2393
+ if ( ! colsInRow . length ) {
2394
+ return false ;
2395
+ }
2386
2396
const containerRect = container . getBoundingClientRect ( ) ;
2387
2397
const previewRect = preview . getBoundingClientRect ( ) ;
2388
2398
const left = Math . floor ( previewRect . left - containerRect . left ) ;
@@ -2439,8 +2449,9 @@ function drawHorizontalAxis(ctx, params, axis) {
2439
2449
const x = OSD . _colCenterX ( i , containerRect , colsInRow ) ;
2440
2450
const isCenter = offset === 0 ;
2441
2451
const isMajor = offset % 5 === 0 || isCenter ;
2452
+ const isMajorColor = isMajor ? config . colorMajor : config . colorMinor ;
2442
2453
const tick = isMajor ? config . tickMajor : config . tickMinor ;
2443
- ctx . strokeStyle = isCenter ? config . colorCenter : isMajor ? config . colorMajor : config . colorMinor ;
2454
+ ctx . strokeStyle = isCenter ? config . colorCenter : isMajorColor ;
2444
2455
ctx . lineWidth = 1 ;
2445
2456
ctx . beginPath ( ) ;
2446
2457
let y0 , y1 , labelY ;
0 commit comments