mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-20 17:52:46 +00:00
Adjust text conversion
This commit is contained in:
parent
2a859e6329
commit
b733d94fbe
@ -174,7 +174,6 @@ export class DraggableSelectionComponent implements OnInit, OnDestroy {
|
||||
if (isParentNodeSelected) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.linksEventSource.interfaceDragged.emit(new DraggedDataEvent<MapLinkNode>(label, evt.dx, evt.dy));
|
||||
});
|
||||
|
||||
|
@ -4,16 +4,22 @@ import { Converter } from "../converter";
|
||||
import { Label } from "../../models/label";
|
||||
import { MapLabel } from "../../models/map/map-label";
|
||||
import { FontBBoxCalculator } from '../../helpers/font-bbox-calculator';
|
||||
import { CssFixer } from '../../helpers/css-fixer';
|
||||
import { FontFixer } from '../../helpers/font-fixer';
|
||||
|
||||
|
||||
@Injectable()
|
||||
export class MapLabelToLabelConverter implements Converter<MapLabel, Label> {
|
||||
constructor(
|
||||
private fontBBoxCalculator: FontBBoxCalculator
|
||||
private fontBBoxCalculator: FontBBoxCalculator,
|
||||
private cssFixer: CssFixer,
|
||||
private fontFixer: FontFixer
|
||||
) {}
|
||||
|
||||
convert(mapLabel: MapLabel) {
|
||||
const box = this.fontBBoxCalculator.calculate(mapLabel.text, mapLabel.style);
|
||||
const fixedCss = this.cssFixer.fix(mapLabel.style);
|
||||
const fixedFont = this.fontFixer.fixStyles(fixedCss);
|
||||
const box = this.fontBBoxCalculator.calculate(mapLabel.text, fixedFont);
|
||||
|
||||
const label = new Label();
|
||||
label.rotation = mapLabel.rotation;
|
||||
@ -23,7 +29,7 @@ export class MapLabelToLabelConverter implements Converter<MapLabel, Label> {
|
||||
label.y = mapLabel.y;
|
||||
|
||||
if (label.x !== null) {
|
||||
label.x += 3;
|
||||
label.x -= 3;
|
||||
}
|
||||
|
||||
if (label.y !== null) {
|
||||
|
@ -64,7 +64,6 @@ export class Draggable<GElement extends DraggedElementBaseType, Datum> {
|
||||
evt.dy = event.sourceEvent.clientY - lastY;
|
||||
lastX = event.sourceEvent.clientX;
|
||||
lastY = event.sourceEvent.clientY;
|
||||
|
||||
this.drag.emit(evt);
|
||||
})
|
||||
.on('end', (datum: Datum) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user