Skip to content

Commit

Permalink
Typing improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
plegner committed Feb 11, 2024
1 parent 43cdaa1 commit d8f1896
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/components/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ x-icon {
.modal-background {
position: fixed;
z-index: 400;
top: 44px;
left: 0; right: 0; bottom: 0;
top: 0; left: 0; right: 0; bottom: 0;
background: rgba(black, 80%);
display: none;
transition: background .4s;
Expand Down
7 changes: 4 additions & 3 deletions src/elements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@


import {isOneOf, Obj, words} from '@mathigon/core';
import {TransformMatrix} from '@mathigon/euclid/src';
import {clamp, isBetween, nearlyEquals, roundTo} from '@mathigon/fermat';
import {CanvasDrawingOptions, drawCanvas, drawSVG, GeoElement, GeoShape, Point, Rectangle, SimplePoint, SVGDrawingOptions} from '@mathigon/euclid';
import {loadImage, loadImageDataURI} from './ajax';
Expand Down Expand Up @@ -399,7 +400,7 @@ export abstract class BaseView<T extends HTMLElement|SVGElement> {
return this.css('transform')!.replace('none', '');
}

get transformMatrix() {
get transformMatrix(): TransformMatrix {
const transform = this.transform;
if (!transform) return [[1, 0, 0], [0, 1, 0]];

Expand Down Expand Up @@ -962,8 +963,8 @@ export class SVGBaseView<T extends SVGGraphicsElement> extends BaseView<T> {

/** Finds the center of an SVG `<circle>` element. */
get center() {
const x = +this.attr(this.tagName === 'TEXT' ? 'x' : 'cx');
const y = +this.attr(this.tagName === 'TEXT' ? 'y' : 'cy');
const x = +this.attr(this.tagName === 'TEXT' ? 'x' : 'cx') || 0;
const y = +this.attr(this.tagName === 'TEXT' ? 'y' : 'cy') || 0;
return new Point(x, y);
}

Expand Down

0 comments on commit d8f1896

Please sign in to comment.