Adjust text conversion

This commit is contained in:
ziajka 2018-12-13 10:17:02 +01:00
parent 2a859e6329
commit b733d94fbe
3 changed files with 9 additions and 5 deletions

View File

@ -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));
});

View File

@ -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) {

View File

@ -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) => {