diff --git a/client/src/gl/viewport.ts b/client/src/gl/viewport.ts index 4b3663d..17f5cbe 100644 --- a/client/src/gl/viewport.ts +++ b/client/src/gl/viewport.ts @@ -108,8 +108,7 @@ export class Viewport { const [canvasX, canvasY] = this.pixelToCanvas(e.clientX, e.clientY) // wheel button or ctrl + left click - if (e.buttons === 4 || (e.ctrlKey && e.buttons === 1)) - this.onDragStart(canvasX, canvasY) + if (e.buttons === 4 || (e.ctrlKey && e.buttons === 1)) this.onDragStart(canvasX, canvasY) } private onmousemove(e: MouseEvent) { @@ -119,10 +118,8 @@ export class Viewport { this.mousePos.y = worldY if (this.drag) { - if (e.buttons === 4 || (e.ctrlKey && e.buttons === 1)) - this.onDrag(canvasX, canvasY) - else - this.drag = false + if (e.buttons === 4 || (e.ctrlKey && e.buttons === 1)) this.onDrag(canvasX, canvasY) + else this.drag = false } } diff --git a/client/src/server/server.ts b/client/src/server/server.ts index 0a48477..190deb6 100755 --- a/client/src/server/server.ts +++ b/client/src/server/server.ts @@ -103,7 +103,7 @@ export class WebSocketServer extends EventDispatcher implements Server { this.httpUrl = serverHttpUrl(cfg) - this.errorListener = () => { } + this.errorListener = () => {} this.queryListeners = {} this.history = new History() @@ -120,14 +120,18 @@ export class WebSocketServer extends EventDispatcher implements Server { async fetch(path: string, init: RequestInit = {}) { init.headers = { ...init.headers, - ...(this.token && { 'Authorization': 'Bearer ' + this.token }) + ...(this.token && { Authorization: 'Bearer ' + this.token }), } const resp = await fetch(`${this.httpUrl}/${path}`, init) if (!resp.ok) throw await resp.text() return resp } - query(type: K, content: Send[K], options: Partial = {}): Promise { + query( + type: K, + content: Send[K], + options: Partial = {} + ): Promise { let timeoutID = -1 let id = this.generateID() @@ -208,7 +212,6 @@ export class WebSocketServer extends EventDispatcher implements Server { } } - send(type: K, content: Send[K], options: Partial = {}) { this.query(type, content, options) } diff --git a/client/src/storage.ts b/client/src/storage.ts index c5321e2..4ce93a3 100644 --- a/client/src/storage.ts +++ b/client/src/storage.ts @@ -1,4 +1,4 @@ -import type { ServerConfig } from "./server/server" +import type { ServerConfig } from './server/server' const { VITE_SERVER_URLS } = import.meta.env diff --git a/client/src/twmap/map.ts b/client/src/twmap/map.ts index 4c0be8f..e063a04 100644 --- a/client/src/twmap/map.ts +++ b/client/src/twmap/map.ts @@ -131,7 +131,10 @@ export class Map { this.groups.findIndex( g => g.layers.findIndex( - l => (l instanceof TilesLayer && l.colorEnv === envelope) || (l instanceof QuadsLayer && l.quads.findIndex(q => q.colorEnv === envelope || q.posEnv === envelope) !== -1) + l => + (l instanceof TilesLayer && l.colorEnv === envelope) || + (l instanceof QuadsLayer && + l.quads.findIndex(q => q.colorEnv === envelope || q.posEnv === envelope) !== -1) ) !== -1 ) !== -1 ) diff --git a/client/src/twmap/tilesLayer.ts b/client/src/twmap/tilesLayer.ts index 3e37d28..daf9c81 100644 --- a/client/src/twmap/tilesLayer.ts +++ b/client/src/twmap/tilesLayer.ts @@ -49,10 +49,8 @@ export abstract class AnyTilesLayer extends Layer { } getTile(x: number, y: number) { - if ((0 <= x && x < this.width) && (0 <= y && y < this.height)) - return this.tiles[y * this.width + x] - else - return this.defaultTile() + if (0 <= x && x < this.width && 0 <= y && y < this.height) return this.tiles[y * this.width + x] + else return this.defaultTile() } setTile(x: number, y: number, tile: Tile) { diff --git a/client/src/ui/lib/editAutomapper.svelte b/client/src/ui/lib/editAutomapper.svelte index 333176d..c3361e4 100644 --- a/client/src/ui/lib/editAutomapper.svelte +++ b/client/src/ui/lib/editAutomapper.svelte @@ -17,7 +17,7 @@ import { basicSetup } from 'codemirror' import { EditorState } from '@codemirror/state' import { EditorView, tooltips, keymap } from '@codemirror/view' - import { linter, setDiagnostics } from '@codemirror/lint' + import { setDiagnostics } from '@codemirror/lint' import { DDNetRules } from './lang-ddnet_rules/index' import { DDNetRulesLinter } from './lang-ddnet_rules/lint' import { Rpp } from './lang-rpp/index' diff --git a/client/styles/style.scss b/client/styles/style.scss index 0f8f655..338bf0e 100644 --- a/client/styles/style.scss +++ b/client/styles/style.scss @@ -1,7 +1,9 @@ // carbon design stylesheets @use '@carbon/themes/scss/themes' as *; -@use '@carbon/themes' with ($theme: $white); +@use '@carbon/themes' with ( + $theme: $white +); @import './carbon-style-compiled.css'; @@ -15,7 +17,7 @@ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; - padding: .4rem 0; // without this padding, letters below the baseline (q,p,g..) would get cropped by the overflow. + padding: 0.4rem 0; // without this padding, letters below the baseline (q,p,g..) would get cropped by the overflow. } #lobby { @@ -32,7 +34,7 @@ // make scrollbars fit nicely with page viewport size // carbon's stickyheader property on datatables is shit // this is quite complicated, idk of better ways - .bx--row>* { + .bx--row > * { display: flex; flex-direction: column; @@ -68,7 +70,6 @@ } #edit { - input[type='number'], input[type='text'], input[type='button'], @@ -156,13 +157,13 @@ $header-h: 3rem; } } - .splitpanes--vertical>.splitpanes__splitter, - &.splitpanes--vertical>.splitpanes__splitter { + .splitpanes--vertical > .splitpanes__splitter, + &.splitpanes--vertical > .splitpanes__splitter { width: 4px; } - .splitpanes--horizontal>.splitpanes__splitter, - &.splitpanes--horizontal>.splitpanes__splitter { + .splitpanes--horizontal > .splitpanes__splitter, + &.splitpanes--horizontal > .splitpanes__splitter { height: 4px; } @@ -202,14 +203,14 @@ $header-h: 3rem; box-shadow: inset 0 0 20px -10px black; } - >canvas { + > canvas { height: 100%; width: 100%; } } -.map-view>canvas, -.tiles>canvas { +.map-view > canvas, +.tiles > canvas { background-image: url('/editor/checker.png'); background-repeat: repeat; } @@ -223,9 +224,9 @@ $header-h: 3rem; background: #161616; color: white; - >.left, - >.right, - >.middle { + > .left, + > .right, + > .middle { display: flex; align-items: center; flex-direction: row; @@ -289,11 +290,11 @@ $header-h: 3rem; margin: 0; padding: 0; - >svg { + > svg { fill: white; } - &[disabled]>svg { + &[disabled] > svg { fill: grey; } @@ -366,7 +367,7 @@ $header-h: 3rem; background: themes.$focus; } - >.label { + > .label { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; @@ -386,11 +387,11 @@ $header-h: 3rem; display: flex; flex-direction: column; - &.folded>ul { + &.folded > ul { display: none; } - &.folded>.node>.toggle>svg { + &.folded > .node > .toggle > svg { transform: rotate(-90deg); } } @@ -406,11 +407,11 @@ $header-h: 3rem; cursor: pointer; } - li.visible:not(:hover)>.node>.eye { + li.visible:not(:hover) > .node > .eye { display: none; } - .toggle>svg { + .toggle > svg { transition: transform 0.2s; } @@ -439,8 +440,7 @@ $header-h: 3rem; } #tile-picker { - - >.picker { + > .picker { position: absolute; inset: 0; padding-top: 6rem; @@ -450,12 +450,12 @@ $header-h: 3rem; display: flex; justify-content: center; - >.content { + > .content { aspect-ratio: 1/1; display: flex; align-items: flex-end; - >.tiles { + > .tiles { position: relative; flex-grow: 1; z-index: 1; @@ -525,7 +525,7 @@ $header-h: 3rem; width: 2rem; height: 2rem; - >img { + > img { width: 100%; height: 100%; } @@ -575,7 +575,7 @@ $header-h: 3rem; width: 2rem; height: 2rem; - >svg { + > svg { width: 100%; height: 100%; } @@ -639,7 +639,7 @@ nav.hidden .context { width: 100%; height: 100%; - >.map-view>canvas { + > .map-view > canvas { position: fixed; inset: 0; z-index: -1; @@ -683,7 +683,7 @@ nav.hidden .context { $img-size: 10rem; - >.footer { + > .footer { // background: white; // border: 1px solid black; // border-top: none; @@ -694,7 +694,7 @@ nav.hidden .context { justify-content: space-between; } - >.images { + > .images { overflow: auto; .list { @@ -712,7 +712,7 @@ nav.hidden .context { overflow: hidden; padding: 0; - &:hover>button { + &:hover > button { position: absolute; top: 0; right: 0; @@ -760,7 +760,9 @@ nav.hidden .context { width: 100%; height: 100%; object-fit: contain; - filter: drop-shadow(1px 0px 0px rgba(0, 0, 0, 0.4)) drop-shadow(0px 1px 0px rgba(0, 0, 0, 0.4)) drop-shadow(-1px 0px 0px rgba(0, 0, 0, 0.4)) drop-shadow(0px -1px 0px rgba(0, 0, 0, 0.4)); + filter: drop-shadow(1px 0px 0px rgba(0, 0, 0, 0.4)) + drop-shadow(0px 1px 0px rgba(0, 0, 0, 0.4)) drop-shadow(-1px 0px 0px rgba(0, 0, 0, 0.4)) + drop-shadow(0px -1px 0px rgba(0, 0, 0, 0.4)); } } } @@ -771,10 +773,10 @@ nav.hidden .context { position: absolute; inset: 0; - >svg { + > svg { position: absolute; - >* { + > * { pointer-events: auto; vector-effect: non-scaling-stroke; } @@ -829,7 +831,7 @@ nav.hidden .context { flex-direction: row; gap: 1rem; - >.channels { + > .channels { flex-grow: 1; } @@ -906,22 +908,22 @@ nav.hidden .context { color: orange; } - &.red input:checked~span { + &.red input:checked ~ span { background-color: red; color: white; } - &.green input:checked~span { + &.green input:checked ~ span { background-color: green; color: white; } - &.blue input:checked~span { + &.blue input:checked ~ span { background-color: blue; color: white; } - &.orange input:checked~span { + &.orange input:checked ~ span { background-color: orange; color: white; } @@ -961,7 +963,6 @@ nav.hidden .context { } #edit-automapper { - .left, .middle, .right { @@ -973,7 +974,7 @@ nav.hidden .context { display: flex; flex-direction: column; - >input[type='text'] { + > input[type='text'] { margin-top: 0.5rem; } } @@ -1018,7 +1019,7 @@ nav.hidden .context { background: themes.$focus; } - >.label { + > .label { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; @@ -1028,12 +1029,12 @@ nav.hidden .context { align-items: center; } - >.icon>svg { + > .icon > svg { width: 1rem; height: 1rem; } - >button { + > button { color: inherit; background: none; width: 2rem; @@ -1045,11 +1046,11 @@ nav.hidden .context { cursor: pointer; } - &:not(:hover)>button { + &:not(:hover) > button { display: none; } - >button:hover svg { + > button:hover svg { color: #da1e28; } } @@ -1104,13 +1105,13 @@ textarea.diagnostics { width: 100vw; height: 100vh; - >.content>.text { + > .content > .text { margin-top: 10rem; } } - >.content>.text { + > .content > .text { z-index: 7000; margin: 1rem; } -} \ No newline at end of file +}