removed width+height from Part
This commit is contained in:
parent
39eecd54c6
commit
48c9c1a87d
@ -12,23 +12,15 @@ export abstract class Part {
|
||||
|
||||
y: number;
|
||||
|
||||
readonly w: number;
|
||||
|
||||
readonly h: number;
|
||||
|
||||
protected constructor(
|
||||
readonly circuit: Circuit,
|
||||
readonly type: PartType,
|
||||
readonly name: string,
|
||||
rasterX: number,
|
||||
rasterY: number,
|
||||
rasterW: number = 1,
|
||||
rasterH: number = 1,
|
||||
) {
|
||||
this.x = Math.round(rasterX * 3) * RASTER;
|
||||
this.y = Math.round(rasterY * 3) * RASTER;
|
||||
this.w = Math.round(rasterW * 3) * RASTER;
|
||||
this.h = Math.round(rasterH * 3) * RASTER;
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
|
||||
@ -3,8 +3,8 @@
|
||||
*ngFor="let part of parts.circuit.parts"
|
||||
[attr.x]="part.x + 'px'"
|
||||
[attr.y]="part.y + 'px'"
|
||||
[attr.width]="part.w + 'px'"
|
||||
[attr.height]="part.h + 'px'"
|
||||
[attr.width]="RASTER * 3 + 'px'"
|
||||
[attr.height]="RASTER * 3 + 'px'"
|
||||
[class.partDrag]="parts.isDragged(part)"
|
||||
(mousedown)="parts.mouseDown(part, $event)"
|
||||
>
|
||||
|
||||
|
Before Width: | Height: | Size: 824 B After Width: | Height: | Size: 832 B |
@ -1,5 +1,5 @@
|
||||
import {Component, Input} from '@angular/core';
|
||||
import {Part} from './Part';
|
||||
import {Part, RASTER} from './Part';
|
||||
import {Battery} from './battery/Battery';
|
||||
import {Light} from './light/Light';
|
||||
import {BatteryComponent} from './battery/battery.component';
|
||||
@ -70,4 +70,5 @@ export class PartComponent {
|
||||
return part instanceof Switch;
|
||||
}
|
||||
|
||||
protected readonly RASTER = RASTER;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user