Skip to content

Commit

Permalink
Build fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Nov 17, 2024
1 parent b583158 commit ca715e1
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
9 changes: 4 additions & 5 deletions src/wireframes/renderer/NavigateAdorner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import * as React from 'react';
import { Engine, HitEvent, Listener } from '@app/wireframes/engine';
import { Engine, EngineHitEvent, Listener } from '@app/wireframes/engine';
import { DiagramItem } from '@app/wireframes/model';

export interface NavigateAdornerProps {
Expand All @@ -26,19 +26,18 @@ export class NavigateAdorner extends React.PureComponent<NavigateAdornerProps> i
this.props.engine.unsubscribe(this);
}

public onClick(event: HitEvent, next: (event: HitEvent) => void) {
public onClick(event: EngineHitEvent, next: (event: EngineHitEvent) => void) {
const target = getShapeWithLink(event);

if (target) {
this.props.onNavigate(target.shape, target.link);
}

next(event);

return false;
}

public onMouseMove(event: HitEvent, next: (event: HitEvent) => void) {
public onMouseMove(event: EngineHitEvent, next: (event: EngineHitEvent) => void) {
if (getShapeWithLink(event)) {
document.body.style.cursor = 'pointer';
} else {
Expand All @@ -53,7 +52,7 @@ export class NavigateAdorner extends React.PureComponent<NavigateAdornerProps> i
}
}

function getShapeWithLink(event: HitEvent) {
function getShapeWithLink(event: EngineHitEvent) {
const link = event.item?.link;

if (link) {
Expand Down
4 changes: 2 additions & 2 deletions src/wireframes/renderer/TextAdorner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import * as React from 'react';
import { Keys, sizeInPx } from '@app/core';
import { Engine, HitEvent, Listener } from '@app/wireframes/engine';
import { Engine, EngineHitEvent, Listener } from '@app/wireframes/engine';
import { DefaultAppearance } from '@app/wireframes/interface';
import { Diagram, DiagramItem, DiagramItemSet } from '@app/wireframes/model';
import './TextAdorner.scss';
Expand Down Expand Up @@ -67,7 +67,7 @@ export class TextAdorner extends React.PureComponent<TextAdornerProps> implement
}
};

public onDoubleClick(event: HitEvent) {
public onDoubleClick(event: EngineHitEvent) {
if (event.item && !event.item.isLocked && this.textareaElement) {
if (event.item.textDisabled) {
return;
Expand Down
4 changes: 2 additions & 2 deletions src/wireframes/renderer/TransformAdorner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import * as React from 'react';
import { isMiddleMouse, Rotation, Subscription, Timer, Vec2 } from '@app/core';
import { Engine, EngineLayer, EngineMouseEvent, EngineRect, Listener } from '@app/wireframes/engine';
import { Engine, EngineHitEvent, EngineLayer, EngineMouseEvent, EngineRect, Listener } from '@app/wireframes/engine';
import { Diagram, DiagramItem, DiagramItemSet, SnapManager, SnapMode, Transform } from '@app/wireframes/model';
import { OverlayManager } from './../contexts/OverlayContext';
import { PreviewEvent } from './preview';
Expand Down Expand Up @@ -233,7 +233,7 @@ export class TransformAdorner extends React.PureComponent<TransformAdornerProps>
}
}

public onMouseDown(event: EngineMouseEvent, next: (event: EngineMouseEvent) => void) {
public onMouseDown(event: EngineHitEvent, next: (event: EngineHitEvent) => void) {
// If the manipulation with the keyboard is still in progress we do not handle the event.
if (event.source.ctrlKey || this.moveTimer || this.manipulationMode != Mode.None) {
next(event);
Expand Down
6 changes: 3 additions & 3 deletions src/wireframes/renderer/interaction-overlays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* Copyright (c) Sebastian Stehle. All rights reserved.
*/

import { Color, sizeInPx, TextMeasurer } from '@app/core/utils';
import { Color, TextMeasurer } from '@app/core/utils';
import { EngineLayer, EngineLine, EngineText } from '@app/wireframes/engine';
import { SnapLine, SnapResult, Transform } from '@app/wireframes/model';

Expand Down Expand Up @@ -112,7 +112,7 @@ export class InteractionOverlays {
this.indexLines++;
}

private renderLabel(x: number, y: number, text: string, color: string, fontSize = 16, centerX = false, centerY = false, padding = 4) {
private renderLabel(x: number, y: number, text: string, color: string, fontSize = 12, centerX = false, centerY = false, padding = 3) {
let label = this.labels[this.indexLabels];

// Reuse the rect and text if it alreadx exists to avoid creating unnecessary DOM elements.
Expand Down Expand Up @@ -153,7 +153,7 @@ export class InteractionOverlays {
label.color('white');
label.fill(color);
label.fontFamily('monospace');
label.fontSize(sizeInPx(fontSize / this.zoom));
label.fontSize(fontSize / this.zoom);
label.plot({ x, y, w, h, padding });
label.text(text);

Expand Down

0 comments on commit ca715e1

Please sign in to comment.