Something went wrong. Try again.
Monorepo for Aesthetic.Computer aesthetic.computer
Something went wrong. Try again.
1.4 kB · 32 lines
Swift
123456789101112131415161718192021222324252627282930313233// MascotView.swift — the JukeWizard mascot drawn as a faint full-window// watermark behind the working UI (same treatment as wave/clip-wizard).// PNG generated via bin/gen-mascot.mjs; degrades to empty if absent.// Never intercepts mouse events (hitTest → nil) so the controls on top// stay fully clickable.import AppKit
final class MascotView: NSView { private let image: NSImage? = { if let url = JukeResources.url(forResource: "jukewizard-mascot", withExtension: "png"), let img = NSImage(contentsOf: url) { return img } return nil }()
override func hitTest(_ point: NSPoint) -> NSView? { nil } override var wantsDefaultClipping: Bool { false }
override func draw(_ dirtyRect: NSRect) { guard let img = image else { return } let imgAR = img.size.width / img.size.height let viewAR = bounds.width / bounds.height var drawRect = bounds if imgAR > viewAR { let w = bounds.height * imgAR drawRect = NSRect(x: (bounds.width - w) * 0.5, y: 0, width: w, height: bounds.height) } else { let h = bounds.width / imgAR drawRect = NSRect(x: 0, y: (bounds.height - h) * 0.5, width: bounds.width, height: h) } img.draw(in: drawRect, from: .zero, operation: .sourceOver, fraction: 0.10) }}