Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
drawForeground(c: SvgCanvas2D, x: number, y: number, w: number, h: number) {
super.drawForeground(c, x, y, w, h)
let inset = 0
if (this.rounded) {
const f = (this.style.arcSize || 0.15 * 100) / 100
inset = Math.max(inset, Math.min(w * f, h * f))
}
const dx = util.clamp(util.getNumber(this.style, 'dx', this.dx), inset, w)
const dy = util.clamp(util.getNumber(this.style, 'dy', this.dy), inset, h)
c.begin()
c.moveTo(x, y + dy)
c.lineTo(x + w, y + dy)
c.stroke()
c.begin()
c.moveTo(x + dx, y)
c.lineTo(x + dx, y + h)
c.stroke()
}
}
getInset(width: number, height: number, round?: boolean) {
let inset = getFactor(this.style, this.factor, width)
if (this.rounded) {
const f = (this.style.arcSize || 0.15 * 100) / 100
inset = util.clamp(f * width, f * height, inset)
}
if (round) {
inset = Math.round(inset)
}
return inset
}
export function clampFactor(factor: number, size: number, max: number = 1) {
return factor > 1
? util.clamp(factor, 0, size * max)
: util.clamp(factor, 0, max) * size
}
export function clampFactor(factor: number, size: number, max: number = 1) {
return factor > 1
? util.clamp(factor, 0, size * max)
: util.clamp(factor, 0, max) * size
}
<div>
<div>
Opacity
{this.state.opacity != null && (
`${value!}%`}
parser={value => value!.replace(/%$/g, '')}
style={{ flex: 1 }}
/>
)}
</div>
</div>
<div>
<div>
</div></div>
drawForeground(c: SvgCanvas2D, x: number, y: number, w: number, h: number) {
super.drawForeground(c, x, y, w, h)
let inset = 0
if (this.rounded) {
const f = (this.style.arcSize || 0.15 * 100) / 100
inset = Math.max(inset, Math.min(w * f, h * f))
}
const dx = util.clamp(util.getNumber(this.style, 'dx', this.dx), inset, w)
const dy = util.clamp(util.getNumber(this.style, 'dy', this.dy), inset, h)
c.begin()
c.moveTo(x, y + dy)
c.lineTo(x + w, y + dy)
c.stroke()
c.begin()
c.moveTo(x + dx, y)
c.lineTo(x + dx, y + h)
c.stroke()
}
}