@metadev/daga 5.0.2 → 5.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +5 -0
- package/index.cjs.js +16 -6
- package/index.esm.js +16 -6
- package/package.json +1 -1
- package/src/lib/util/browser-util.d.ts +1 -0
- package/src/lib/util/canvas-util.d.ts +1 -1
package/Changelog.md
CHANGED
|
@@ -6,6 +6,11 @@ List of releases and changes.
|
|
|
6
6
|
|
|
7
7
|
## Next release Durendal
|
|
8
8
|
|
|
9
|
+
## 5.0.3
|
|
10
|
+
|
|
11
|
+
- Force location of field `<foreignObject>` tags in webkit browsers [#356](https://github.com/metadevpro/daga/pull/356)
|
|
12
|
+
- Use `<g>` instead of `<foreignObject>` for containers of diagram decorators and objects [#357](https://github.com/metadevpro/daga/pull/357)
|
|
13
|
+
|
|
9
14
|
## 5.0.2
|
|
10
15
|
|
|
11
16
|
- Found bug in ng-packagr. Fix package with revert to ng-packagr 21.0.1
|
package/index.cjs.js
CHANGED
|
@@ -231,7 +231,7 @@ const distanceBetweenPoints = (point1, point2) => {
|
|
|
231
231
|
return Math.pow(Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2), 0.5);
|
|
232
232
|
};
|
|
233
233
|
/**
|
|
234
|
-
* Checks whether the two given
|
|
234
|
+
* Checks whether the two given rectangles share at least one point.
|
|
235
235
|
* @public
|
|
236
236
|
* @param rectangle1 A rectangle.
|
|
237
237
|
* @param rectangle2 A rectangle.
|
|
@@ -7167,7 +7167,6 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7167
7167
|
this.canvas.propertyEditorChanges$.pipe(rxjs.debounceTime(2000)).subscribe(() => {
|
|
7168
7168
|
this.makeUpdateValuesAction();
|
|
7169
7169
|
});
|
|
7170
|
-
//console.log(diagramPropertiesText);
|
|
7171
7170
|
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
7172
7171
|
}
|
|
7173
7172
|
add(element) {
|
|
@@ -7419,6 +7418,9 @@ const unrotate = (width, height, orientation) => {
|
|
|
7419
7418
|
return [oldWidth, oldHeight];
|
|
7420
7419
|
};
|
|
7421
7420
|
|
|
7421
|
+
var _a;
|
|
7422
|
+
const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
|
|
7423
|
+
|
|
7422
7424
|
/**
|
|
7423
7425
|
* Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
|
|
7424
7426
|
* @private
|
|
@@ -7716,6 +7718,10 @@ class DiagramCanvas {
|
|
|
7716
7718
|
const transformAttribute = event.transform.toString();
|
|
7717
7719
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
7718
7720
|
d3__namespace.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
|
|
7721
|
+
if (isWebkit) {
|
|
7722
|
+
// force update fields to compensate for a rendering bug in webkit
|
|
7723
|
+
this.updateFieldsInView();
|
|
7724
|
+
}
|
|
7719
7725
|
this.contextMenu.close();
|
|
7720
7726
|
this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
7721
7727
|
}).on(exports.ZoomEvents.End, () => {
|
|
@@ -8675,11 +8681,15 @@ class DiagramCanvas {
|
|
|
8675
8681
|
this.secondaryButton = false;
|
|
8676
8682
|
})).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
8677
8683
|
mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === exports.VerticalAlign.Center ? 'center' : d.verticalAlign === exports.VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === exports.HorizontalAlign.Center ? 'center' : d.horizontalAlign === exports.HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br/>'));
|
|
8684
|
+
if (isWebkit) {
|
|
8685
|
+
const zoomFactor = this.zoomTransform.k;
|
|
8686
|
+
mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
|
|
8687
|
+
}
|
|
8678
8688
|
}
|
|
8679
8689
|
updateObjectsInView(...ids) {
|
|
8680
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8690
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8681
8691
|
const exitSelection = updateSelection.exit();
|
|
8682
|
-
const enterSelection = updateSelection.enter().append('
|
|
8692
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
8683
8693
|
if (ids && ids.length > 0) {
|
|
8684
8694
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8685
8695
|
}
|
|
@@ -8720,9 +8730,9 @@ class DiagramCanvas {
|
|
|
8720
8730
|
}));
|
|
8721
8731
|
}
|
|
8722
8732
|
updateDecoratorsInView(...ids) {
|
|
8723
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8733
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8724
8734
|
const exitSelection = updateSelection.exit();
|
|
8725
|
-
const enterSelection = updateSelection.enter().append('
|
|
8735
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
8726
8736
|
if (ids && ids.length > 0) {
|
|
8727
8737
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8728
8738
|
}
|
package/index.esm.js
CHANGED
|
@@ -210,7 +210,7 @@ const distanceBetweenPoints = (point1, point2) => {
|
|
|
210
210
|
return Math.pow(Math.pow(point1[0] - point2[0], 2) + Math.pow(point1[1] - point2[1], 2), 0.5);
|
|
211
211
|
};
|
|
212
212
|
/**
|
|
213
|
-
* Checks whether the two given
|
|
213
|
+
* Checks whether the two given rectangles share at least one point.
|
|
214
214
|
* @public
|
|
215
215
|
* @param rectangle1 A rectangle.
|
|
216
216
|
* @param rectangle2 A rectangle.
|
|
@@ -7146,7 +7146,6 @@ class DiagramUserSelection extends DiagramElementSet {
|
|
|
7146
7146
|
this.canvas.propertyEditorChanges$.pipe(debounceTime(2000)).subscribe(() => {
|
|
7147
7147
|
this.makeUpdateValuesAction();
|
|
7148
7148
|
});
|
|
7149
|
-
//console.log(diagramPropertiesText);
|
|
7150
7149
|
this.diagramPropertiesText = diagramPropertiesText !== undefined ? diagramPropertiesText : DIAGRAM_PROPERTIES_DEFAULT_TEXT;
|
|
7151
7150
|
}
|
|
7152
7151
|
add(element) {
|
|
@@ -7398,6 +7397,9 @@ const unrotate = (width, height, orientation) => {
|
|
|
7398
7397
|
return [oldWidth, oldHeight];
|
|
7399
7398
|
};
|
|
7400
7399
|
|
|
7400
|
+
var _a;
|
|
7401
|
+
const isWebkit = ((_a = navigator === null || navigator === void 0 ? void 0 : navigator.userAgent) === null || _a === void 0 ? void 0 : _a.indexOf('AppleWebKit')) >= 0;
|
|
7402
|
+
|
|
7401
7403
|
/**
|
|
7402
7404
|
* Thickness of the invisible path around a connection used to make it easier to click on, in diagram units.
|
|
7403
7405
|
* @private
|
|
@@ -7695,6 +7697,10 @@ class DiagramCanvas {
|
|
|
7695
7697
|
const transformAttribute = event.transform.toString();
|
|
7696
7698
|
this.selectCanvasElements().attr('transform', transformAttribute);
|
|
7697
7699
|
d3.select(`#${this.backgroundPatternId}`).attr('patternTransform', transformAttribute);
|
|
7700
|
+
if (isWebkit) {
|
|
7701
|
+
// force update fields to compensate for a rendering bug in webkit
|
|
7702
|
+
this.updateFieldsInView();
|
|
7703
|
+
}
|
|
7698
7704
|
this.contextMenu.close();
|
|
7699
7705
|
this.diagramEvent$.next(new DiagramZoomEvent([this.zoomTransform.x, this.zoomTransform.y], this.zoomTransform.k));
|
|
7700
7706
|
}).on(ZoomEvents.End, () => {
|
|
@@ -8654,11 +8660,15 @@ class DiagramCanvas {
|
|
|
8654
8660
|
this.secondaryButton = false;
|
|
8655
8661
|
})).append('xhtml:div').style('width', '100%').style('height', '100%').style('display', 'flex').append('xhtml:p').style('box-sizing', 'border-box').style('outline', 0).style('margin', 0).style('border', 0).style('padding', 0).style('user-select', 'none').style('font-kerning', 'none').style('white-space', 'nowrap');
|
|
8656
8662
|
mergeSelection.attr('x', 0).attr('y', 0).attr('width', d => `${d.width}px`).attr('height', d => `${d.height}px`).attr('transform', d => `translate(${d.coords[0]},${d.coords[1]})`).attr('opacity', d => d.removed ? 0.5 : 1).select('div').style('justify-content', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'flex-end' : 'flex-start').style('align-items', d => d.verticalAlign === VerticalAlign.Center ? 'center' : d.verticalAlign === VerticalAlign.Bottom ? 'end' : 'start').select('p').style('max-width', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[0]}px`).style('max-height', d => d.fit ? 'default' : `${unrotate(d.width, d.height, d.orientation)[1]}px`).style('overflow', d => d.fit ? 'default' : 'clip').style('text-overflow', d => d.fit ? 'default' : 'ellipsis').style('text-align', d => d.horizontalAlign === HorizontalAlign.Center ? 'center' : d.horizontalAlign === HorizontalAlign.Right ? 'end' : 'start').style('transform', d => `rotate(${d.orientation}deg)`).style('font-size', d => `${d.fontSize}px`).style('font-family', d => d.fontFamily || "'Wonder Unit Sans', sans-serif").style('font-weight', d => d.highlighted ? 600 : 400).style('color', d => d.selected ? d.selectedColor || '#000000' : d.color || '#000000').html(d => d.text.replace(/</g, '<').replace(/>/g, '>').replace(/\n/g, '<br/>'));
|
|
8663
|
+
if (isWebkit) {
|
|
8664
|
+
const zoomFactor = this.zoomTransform.k;
|
|
8665
|
+
mergeSelection.attr('width', d => `${d.width * zoomFactor}px`).attr('height', d => `${d.height * zoomFactor}px`).select('div').style('position', 'absolute').style('left', d => `${d.coords[0] * zoomFactor + this.zoomTransform.x}px`).style('top', d => `${d.coords[1] * zoomFactor + this.zoomTransform.y}px`).select('p').style('font-size', d => `${d.fontSize * zoomFactor}px`);
|
|
8666
|
+
}
|
|
8657
8667
|
}
|
|
8658
8668
|
updateObjectsInView(...ids) {
|
|
8659
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8669
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-object').data(this.model.objects.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8660
8670
|
const exitSelection = updateSelection.exit();
|
|
8661
|
-
const enterSelection = updateSelection.enter().append('
|
|
8671
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-object');
|
|
8662
8672
|
if (ids && ids.length > 0) {
|
|
8663
8673
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8664
8674
|
}
|
|
@@ -8699,9 +8709,9 @@ class DiagramCanvas {
|
|
|
8699
8709
|
}));
|
|
8700
8710
|
}
|
|
8701
8711
|
updateDecoratorsInView(...ids) {
|
|
8702
|
-
let updateSelection = this.selectCanvasElements().selectAll('
|
|
8712
|
+
let updateSelection = this.selectCanvasElements().selectAll('g.diagram-decorator').data(this.model.decorators.filter(e => this.priorityThreshold !== undefined ? e.getPriority() >= this.priorityThreshold : true), d => d.id);
|
|
8703
8713
|
const exitSelection = updateSelection.exit();
|
|
8704
|
-
const enterSelection = updateSelection.enter().append('
|
|
8714
|
+
const enterSelection = updateSelection.enter().append('g').attr('id', d => d.id).attr('class', 'diagram-decorator');
|
|
8705
8715
|
if (ids && ids.length > 0) {
|
|
8706
8716
|
updateSelection = updateSelection.filter(d => ids.includes(d.id));
|
|
8707
8717
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isWebkit: boolean;
|
|
@@ -144,7 +144,7 @@ export declare const linesOverlap: (line1: Line, line2: Line) => boolean;
|
|
|
144
144
|
*/
|
|
145
145
|
export declare const lineIntersectsRectangle: (line: Line, rectangle: Rectangle) => boolean;
|
|
146
146
|
/**
|
|
147
|
-
* Checks whether the two given
|
|
147
|
+
* Checks whether the two given rectangles share at least one point.
|
|
148
148
|
* @public
|
|
149
149
|
* @param rectangle1 A rectangle.
|
|
150
150
|
* @param rectangle2 A rectangle.
|