Update to Angular 14

This commit is contained in:
2026-03-23 20:46:24 +01:00
parent 1dea5953f6
commit f23e34dd09
33 changed files with 2483 additions and 2977 deletions
@@ -1,4 +1,4 @@
import { Component, Input, ViewChild, ElementRef } from '@angular/core';
import { Component, Input, ViewChild, ElementRef, TemplateRef } from '@angular/core';
import { BsModalService, BsModalRef } from 'ngx-bootstrap/modal';
import { ButtonAction } from '../../../common/interfaces';
import { PonyTownGame } from '../../../client/game';
@@ -16,7 +16,7 @@ import { faCog } from '../../../client/icons';
})
export class ActionBar {
@ViewChild('scroller', { static: true }) scroller!: ElementRef;
@ViewChild('actionsModal', { static: true }) actionsModal!: ElementRef;
@ViewChild('actionsModal', { static: true }) actionsModal!: TemplateRef<any>;
@Input() blurred = false;
readonly cogIcon = faCog;
activeAction: ButtonAction | undefined = undefined;
@@ -68,7 +68,7 @@ export class ActionBar {
const settings = { ...this.settings.account, actions: serializeActions(this.actions) };
this.settings.saveAccountSettings(settings);
}
scroll(e: MouseWheelEvent) {
scroll(e: WheelEvent) {
if (e.deltaY) {
const delta = e.deltaY > 0 ? 1 : -1;
this.scroller.nativeElement.scrollLeft += delta * 20;
@@ -2,7 +2,7 @@ import { Component, Input } from '@angular/core';
import { fill } from 'lodash';
import { PonyInfo } from '../../../common/interfaces';
import { CM_SIZE } from '../../../common/constants';
import { faTrash, faEraser, faPaintBrush, faEyeDropper } from '../../../client/icons';
import { faTrash, faEraser, faPaintbrush, faEyeDropper } from '../../../client/icons';
export interface ButtMarkEditorState {
brushType: string;
@@ -17,7 +17,7 @@ export class ButtMarkEditor {
readonly trashIcon = faTrash;
readonly eraserIcon = faEraser;
readonly eyeDropperIcon = faEyeDropper;
readonly paintBrushIcon = faPaintBrush;
readonly paintBrushIcon = faPaintbrush;
readonly cmSize = CM_SIZE;
@Input() info!: PonyInfo;
@Input() state = {
@@ -18,12 +18,12 @@ export interface AgDragOptions {
export function handleDrag(element: HTMLElement, emit: (event: AgDragEvent) => void, options: AgDragOptions = {}) {
// typeof PointerEvent !== 'undefined'
const eventSets = window.navigator.pointerEnabled ? [
const eventSets = 'pointerEnabled' in window.navigator && (window.navigator as any).pointerEnabled ? [
{ down: 'pointerdown', move: 'pointermove', up: 'pointerup' }, // , up2: 'pointercancel' },
] : [
{ down: 'mousedown', move: 'mousemove', up: 'mouseup' },
{ down: 'touchstart', move: 'touchmove', up: 'touchend', up2: 'touchcancel' },
];
{ down: 'mousedown', move: 'mousemove', up: 'mouseup' },
{ down: 'touchstart', move: 'touchmove', up: 'touchend', up2: 'touchcancel' },
];
const emptyRect = { left: 0, top: 0 };
let rect = emptyRect;
let scrollLeft = 0;
@@ -156,7 +156,7 @@ export class PlayBox implements OnInit {
this.gameService.leave('Cancelled joining');
}
reload() {
location.reload(true);
location.reload();
}
hardReload() {
hardReload();