Skip to content

Commit

Permalink
modify line width, dashed ratio and arrow heads
Browse files Browse the repository at this point in the history
  • Loading branch information
jon gadsden committed Sep 9, 2023
1 parent bd3fabb commit 5973309
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 37 deletions.
12 changes: 6 additions & 6 deletions ThreatDragonModels/test-reports.json
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -323,7 +323,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": "5 2"
}
Expand Down Expand Up @@ -362,7 +362,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -401,7 +401,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": "5 2"
}
Expand Down Expand Up @@ -570,7 +570,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -795,7 +795,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down
20 changes: 10 additions & 10 deletions ThreatDragonModels/v2-threat-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -542,7 +542,7 @@
"line": {
"stroke": "red",
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -605,7 +605,7 @@
"line": {
"stroke": "red",
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -668,7 +668,7 @@
"line": {
"stroke": "red",
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -784,7 +784,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -848,7 +848,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": "2 2"
}
Expand Down Expand Up @@ -901,7 +901,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": "2 2"
}
Expand Down Expand Up @@ -954,7 +954,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -1007,7 +1007,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -1060,7 +1060,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down
20 changes: 10 additions & 10 deletions td.vue/src/service/demo/v2-threat-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -542,7 +542,7 @@ export default {
'line': {
'stroke': 'red',
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -605,7 +605,7 @@ export default {
'line': {
'stroke': 'red',
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -668,7 +668,7 @@ export default {
'line': {
'stroke': 'red',
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -784,7 +784,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -848,7 +848,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': '2 2'
}
Expand Down Expand Up @@ -901,7 +901,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': '2 2'
}
Expand Down Expand Up @@ -954,7 +954,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -1007,7 +1007,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down Expand Up @@ -1060,7 +1060,7 @@ export default {
'stroke': '#333333',
'strokeWidth': 1,
'targetMarker': {
'name': 'classic'
'name': 'block'
},
'strokeDasharray': null
}
Expand Down
3 changes: 2 additions & 1 deletion td.vue/src/service/x6/graph/data-changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ const edgeUpdater = (edge, color, dash, strokeWidth) => {
edge.setAttrByPath('line/stroke', color);
edge.setAttrByPath('line/strokeWidth', strokeWidth);
edge.setAttrByPath('line/strokeDasharray', dash);
edge.setAttrByPath('line/targetMarker/name', 'classic');
edge.setAttrByPath('line/targetMarker/name', 'block');
edge.setAttrByPath('line/sourceMarker/name', '');
};

const updateStyleAttrs = (cell) => {
Expand Down
6 changes: 5 additions & 1 deletion td.vue/src/service/x6/shapes/flow-stencil.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const FlowStencil = Shape.Empty.define({
],
attrs: {
boundary: {
strokeWidth: 1,
strokeWidth: 1.5,
stroke: '#333333',
fill: 'transparent',
refD: 'M 30 20 C 70 20 70 100 110 100'
Expand All @@ -33,6 +33,10 @@ export const FlowStencil = Shape.Empty.define({
text: tc('threatmodel.shapes.flowStencil'),
fill: '#333',
textVerticalAnchor: 'middle'
},
line: {
targetMarker: 'block',
sourceMarker: ''
}
},
data: defaultProperties.flow
Expand Down
2 changes: 1 addition & 1 deletion td.vue/src/service/x6/shapes/flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Flow = Shape.Edge.define({
zIndex: 10,
attrs: {
line: {
strokeWidth: 3,
strokeWidth: 1.5,
sourceMarker: null,
targetMarker: null
}
Expand Down
4 changes: 2 additions & 2 deletions td.vue/tests/e2e/fixtures/v2-model.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"stroke": "#333333",
"strokeWidth": 1,
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down Expand Up @@ -175,7 +175,7 @@
"line": {
"stroke": "red",
"targetMarker": {
"name": "classic"
"name": "block"
},
"strokeDasharray": null
}
Expand Down
10 changes: 5 additions & 5 deletions td.vue/tests/unit/service/x6/graph/data-changed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('service/x6/graph/data-changed.js', () => {
});

it('calls updateStyle', () => {
expect(cell.updateStyle).toHaveBeenCalledWith('red', '5 2', 3.0);
expect(cell.updateStyle).toHaveBeenCalledWith('red', '4 3', 2.5);
});
});

Expand All @@ -57,7 +57,7 @@ describe('service/x6/graph/data-changed.js', () => {
});

it('calls updateStyle', () => {
expect(cell.updateStyle).toHaveBeenCalledWith('#333333', null, 1.0);
expect(cell.updateStyle).toHaveBeenCalledWith('#333333', null, 1.5);
});
});

Expand All @@ -72,7 +72,7 @@ describe('service/x6/graph/data-changed.js', () => {
});

it('calls updateStyle', () => {
expect(cell.updateStyle).toHaveBeenCalledWith('#333333', null, 1.0);
expect(cell.updateStyle).toHaveBeenCalledWith('#333333', null, 1.5);
});
});

Expand Down Expand Up @@ -139,9 +139,9 @@ describe('service/x6/graph/data-changed.js', () => {
.toHaveBeenCalledWith('line/strokeDasharray', null);
});

it('sets the target marker to classic', () => {
it('sets the target marker to block', () => {
expect(cell.setAttrByPath)
.toHaveBeenCalledWith('line/targetMarker/name', 'classic');
.toHaveBeenCalledWith('line/targetMarker/name', 'block');
});
});
});
2 changes: 1 addition & 1 deletion td.vue/tests/unit/service/x6/graph/graph.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ describe('service/x6/graph/graph.js', () => {
orthogonal: true,
restricted: false,
autoScroll: true,
preserveAspectRatio: true,
preserveAspectRatio: false,
allowReverse: true
});
});
Expand Down

0 comments on commit 5973309

Please sign in to comment.