From 7d91721ce8be5e597d0065b11f4c3146cf7ec194 Mon Sep 17 00:00:00 2001 From: LoveEevee Date: Sat, 10 Nov 2018 23:10:48 +0300 Subject: [PATCH] Limit horizontal scaling in sub-titles --- README.md | 2 +- public/src/js/canvasdraw.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index afea7ec..c2052d0 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Still in developement. Works best with Chrome. Create a SQLite databse named `taiko.db` with the following schema: - CREATE TABLE "songs" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT, `easy` INTEGER, `normal` INTEGER, `hard` INTEGER, `oni` INTEGER, `ura` INTEGER, `enabled` INTEGER NOT NULL, `category` INTEGER, `type` TEXT , `offset` REAL NOT NULL ) + CREATE TABLE "songs" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT, `subtitle` TEXT, `subtitle_en` TEXT, `easy` INTEGER, `normal` INTEGER, `hard` INTEGER, `oni` INTEGER, `ura` INTEGER, `enabled` INTEGER NOT NULL, `category` INTEGER, `type` TEXT , `offset` REAL NOT NULL ) CREATE TABLE "categories" ( `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, `title` TEXT NOT NULL, `title_en` TEXT NOT NULL ) When inserting song rows, leave any difficulty columns as NULL if you don't intend to add notecharts for them. diff --git a/public/src/js/canvasdraw.js b/public/src/js/canvasdraw.js index 1349551..f215936 100644 --- a/public/src/js/canvasdraw.js +++ b/public/src/js/canvasdraw.js @@ -394,12 +394,13 @@ var scaling = 1 if(config.height && drawnHeight > config.height){ - scaling = config.height / drawnHeight if(config.align === "bottom"){ + scaling = Math.max(0.6, config.height / drawnHeight) ctx.translate(40 * mul, 0) - ctx.scale(scaling, scaling) + ctx.scale(scaling, config.height / drawnHeight) ctx.translate(-40 * mul, 0) }else{ + scaling = config.height / drawnHeight ctx.scale(1, scaling) } if(config.selectable){