Update bounds

This commit is contained in:
ZXY101
2024-03-12 10:17:35 +02:00
parent 5d3f17679b
commit 39d4e0f072
3 changed files with 6 additions and 4 deletions

View File

@@ -9,6 +9,7 @@
{ key: 'boldFont', text: 'Bold font', value: $settings.boldFont }, { key: 'boldFont', text: 'Bold font', value: $settings.boldFont },
{ key: 'pageNum', text: 'Show page number', value: $settings.pageNum }, { key: 'pageNum', text: 'Show page number', value: $settings.pageNum },
{ key: 'charCount', text: 'Show character count', value: $settings.charCount }, { key: 'charCount', text: 'Show character count', value: $settings.charCount },
{ key: 'bounds', text: 'Bounds', value: $settings.bounds },
{ key: 'mobile', text: 'Mobile', value: $settings.mobile }, { key: 'mobile', text: 'Mobile', value: $settings.mobile },
{ key: 'showTimer', text: 'Show timer', value: $settings.showTimer }, { key: 'showTimer', text: 'Show timer', value: $settings.showTimer },
{ key: 'quickActions', text: 'Show quick actions', value: $settings.quickActions } { key: 'quickActions', text: 'Show quick actions', value: $settings.quickActions }

View File

@@ -147,9 +147,9 @@ export function keepInBounds() {
return return
} }
const { mobile } = get(settings) const { mobile, bounds } = get(settings)
if (!mobile) { if (!mobile && !bounds) {
return return
} }
@@ -161,7 +161,7 @@ export function keepInBounds() {
const width = container.offsetWidth * scale; const width = container.offsetWidth * scale;
const height = container.offsetHeight * scale; const height = container.offsetHeight * scale;
const marginX = innerWidth * 0.01; const marginX = innerWidth * 0.001;
const marginY = innerHeight * 0.01; const marginY = innerHeight * 0.01;
let minX = innerWidth - width - marginX; let minX = innerWidth - width - marginX;
@@ -190,7 +190,6 @@ export function keepInBounds() {
if (x < minX) { if (x < minX) {
transform.x = minX; transform.x = minX;
} }
if (x > maxX) { if (x > maxX) {
transform.x = maxX; transform.x = maxX;

View File

@@ -47,6 +47,7 @@ export type Settings = {
boldFont: boolean; boldFont: boolean;
pageNum: boolean; pageNum: boolean;
charCount: boolean; charCount: boolean;
bounds: boolean;
mobile: boolean; mobile: boolean;
backgroundColor: string; backgroundColor: string;
swipeThreshold: number; swipeThreshold: number;
@@ -73,6 +74,7 @@ const defaultSettings: Settings = {
pageNum: true, pageNum: true,
charCount: false, charCount: false,
mobile: false, mobile: false,
bounds: false,
backgroundColor: '#030712', backgroundColor: '#030712',
swipeThreshold: 50, swipeThreshold: 50,
edgeButtonWidth: 10, edgeButtonWidth: 10,