Merge pull request #164 from scala-steward/update/scalafmt-core-3.5.1
Update scalafmt-core to 3.5.1
This commit is contained in:
commit
353ecaa1eb
|
@ -1,3 +1,3 @@
|
|||
version="3.5.0"
|
||||
version="3.5.1"
|
||||
maxColumn = 120
|
||||
runner.dialect = scala3
|
||||
|
|
|
@ -46,7 +46,7 @@ class BackgroundTask(config: Config, captchaManager: CaptchaManager) {
|
|||
(captcha.allowedLevels).flatMap { level =>
|
||||
(captcha.allowedMedia).flatMap { media =>
|
||||
(captcha.allowedInputType).flatMap { inputType =>
|
||||
(captcha.allowedSizes).map {size =>
|
||||
(captcha.allowedSizes).map { size =>
|
||||
Parameters(level, media, inputType, size)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,16 +43,16 @@ class FilterChallenge extends ChallengeProvider {
|
|||
val height = size2D(1)
|
||||
val canvas = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB)
|
||||
val g = canvas.createGraphics()
|
||||
val fontHeight = (height*0.6).toInt
|
||||
val fontHeight = (height * 0.6).toInt
|
||||
g.setColor(Color.WHITE)
|
||||
g.fillRect(0, 0, canvas.getWidth, canvas.getHeight)
|
||||
g.setColor(Color.BLACK)
|
||||
val font = new Font("Serif", Font.BOLD, fontHeight)
|
||||
g.setFont(font)
|
||||
val stringWidth = g.getFontMetrics().stringWidth(secret)
|
||||
val scaleX = if (stringWidth > width) width/(stringWidth.toDouble) else 1d
|
||||
val scaleX = if (stringWidth > width) width / (stringWidth.toDouble) else 1d
|
||||
val margin = if (stringWidth > width) 0 else (width - stringWidth)
|
||||
val xOffset = (margin*r.nextDouble).toInt
|
||||
val xOffset = (margin * r.nextDouble).toInt
|
||||
g.scale(scaleX, 1d)
|
||||
g.drawString(secret, xOffset, fontHeight)
|
||||
g.dispose()
|
||||
|
|
|
@ -128,13 +128,13 @@ class RainDropsCP extends ChallengeProvider {
|
|||
val textX = if (textWidth > width) 0 else ((width - textWidth) / 2)
|
||||
|
||||
// this will be overlapped by the following text to show the top outline because of the offset
|
||||
val yOffset = (fontHeight*0.01).ceil.toInt
|
||||
val yOffset = (fontHeight * 0.01).ceil.toInt
|
||||
g.setColor(textHighlightColor)
|
||||
g.drawString(secret, textX, (fontHeight*1.1).toInt - yOffset)
|
||||
g.drawString(secret, textX, (fontHeight * 1.1).toInt - yOffset)
|
||||
|
||||
// paint the text
|
||||
g.setColor(textColor)
|
||||
g.drawString(secret, textX, (fontHeight*1.1).toInt)
|
||||
g.drawString(secret, textX, (fontHeight * 1.1).toInt)
|
||||
|
||||
g.dispose()
|
||||
writer.writeToSequence(canvas)
|
||||
|
|
Loading…
Reference in New Issue