Skip to content

Commit e4058ad

Browse files
fix: delete marker and cursor SVG elements
1 parent 13fe067 commit e4058ad

File tree

8 files changed

+0
-238
lines changed

8 files changed

+0
-238
lines changed

core/block_svg.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1696,28 +1696,6 @@ export class BlockSvg
16961696
if (this.nextConnection) this.nextConnection.tightenEfficiently();
16971697
}
16981698

1699-
/**
1700-
* Add the cursor SVG to this block's SVG group.
1701-
*
1702-
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
1703-
* group.
1704-
* @internal
1705-
*/
1706-
setCursorSvg(cursorSvg: SVGElement) {
1707-
this.pathObject.setCursorSvg(cursorSvg);
1708-
}
1709-
1710-
/**
1711-
* Add the marker SVG to this block's SVG group.
1712-
*
1713-
* @param markerSvg The SVG root of the marker to be added to the block SVG
1714-
* group.
1715-
* @internal
1716-
*/
1717-
setMarkerSvg(markerSvg: SVGElement) {
1718-
this.pathObject.setMarkerSvg(markerSvg);
1719-
}
1720-
17211699
/**
17221700
* Returns a bounding box describing the dimensions of this block
17231701
* and any blocks stacked below it.

core/field.ts

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,6 @@ export abstract class Field<T = any>
111111
private tooltip: Tooltip.TipInfo | null = null;
112112
protected size_: Size;
113113

114-
/**
115-
* Holds the cursors svg element when the cursor is attached to the field.
116-
* This is null if there is no cursor on the field.
117-
*/
118-
private cursorSvg: SVGElement | null = null;
119-
120-
/**
121-
* Holds the markers svg element when the marker is attached to the field.
122-
* This is null if there is no marker on the field.
123-
*/
124-
private markerSvg: SVGElement | null = null;
125-
126114
/** The rendered field's SVG group element. */
127115
protected fieldGroup_: SVGGElement | null = null;
128116

@@ -1356,44 +1344,6 @@ export abstract class Field<T = any>
13561344
return false;
13571345
}
13581346

1359-
/**
1360-
* Add the cursor SVG to this fields SVG group.
1361-
*
1362-
* @param cursorSvg The SVG root of the cursor to be added to the field group.
1363-
* @internal
1364-
*/
1365-
setCursorSvg(cursorSvg: SVGElement) {
1366-
if (!cursorSvg) {
1367-
this.cursorSvg = null;
1368-
return;
1369-
}
1370-
1371-
if (!this.fieldGroup_) {
1372-
throw new Error(`The field group is ${this.fieldGroup_}.`);
1373-
}
1374-
this.fieldGroup_.appendChild(cursorSvg);
1375-
this.cursorSvg = cursorSvg;
1376-
}
1377-
1378-
/**
1379-
* Add the marker SVG to this fields SVG group.
1380-
*
1381-
* @param markerSvg The SVG root of the marker to be added to the field group.
1382-
* @internal
1383-
*/
1384-
setMarkerSvg(markerSvg: SVGElement) {
1385-
if (!markerSvg) {
1386-
this.markerSvg = null;
1387-
return;
1388-
}
1389-
1390-
if (!this.fieldGroup_) {
1391-
throw new Error(`The field group is ${this.fieldGroup_}.`);
1392-
}
1393-
this.fieldGroup_.appendChild(markerSvg);
1394-
this.markerSvg = markerSvg;
1395-
}
1396-
13971347
/** See IFocusableNode.getFocusableElement. */
13981348
getFocusableElement(): HTMLElement | SVGElement {
13991349
if (!this.fieldGroup_) {

core/flyout_button.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,6 @@ export class FlyoutButton
346346
}
347347
}
348348

349-
/**
350-
* Required by IASTNodeLocationSvg, but not used. A marker cannot be set on a
351-
* button. If the 'mark' shortcut is used on a button, its associated callback
352-
* function is triggered.
353-
*/
354-
setMarkerSvg() {
355-
throw new Error('Attempted to set a marker on a button.');
356-
}
357-
358349
/**
359350
* Do something when the button is clicked.
360351
*

core/interfaces/i_ast_node_location_svg.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,5 @@ import type {IASTNodeLocation} from './i_ast_node_location.js';
1212
* An AST node location SVG interface.
1313
*/
1414
export interface IASTNodeLocationSvg extends IASTNodeLocation {
15-
/**
16-
* Add the marker SVG to this node's SVG group.
17-
*
18-
* @param markerSvg The SVG root of the marker to be added to the SVG group.
19-
*/
20-
setMarkerSvg(markerSvg: SVGElement | null): void;
2115

22-
/**
23-
* Add the cursor SVG to this node's SVG group.
24-
*
25-
* @param cursorSvg The SVG root of the cursor to be added to the SVG group.
26-
*/
27-
setCursorSvg(cursorSvg: SVGElement | null): void;
2816
}

core/marker_manager.ts

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,9 @@ export class MarkerManager {
2525
/** The cursor. */
2626
private cursor: LineCursor | null = null;
2727

28-
/** The cursor's SVG element. */
29-
private cursorSvg: SVGElement | null = null;
30-
3128
/** The map of markers for the workspace. */
3229
private markers = new Map<string, Marker>();
3330

34-
/** The marker's SVG element. */
35-
private markerSvg: SVGElement | null = null;
36-
3731
/**
3832
* @param workspace The workspace for the marker manager.
3933
* @internal
@@ -103,47 +97,6 @@ export class MarkerManager {
10397
this.cursor = cursor;
10498
}
10599

106-
/**
107-
* Add the cursor SVG to this workspace SVG group.
108-
*
109-
* @param cursorSvg The SVG root of the cursor to be added to the workspace
110-
* SVG group.
111-
* @internal
112-
*/
113-
setCursorSvg(cursorSvg: SVGElement | null) {
114-
if (!cursorSvg) {
115-
this.cursorSvg = null;
116-
return;
117-
}
118-
119-
this.workspace.getBlockCanvas()!.appendChild(cursorSvg);
120-
this.cursorSvg = cursorSvg;
121-
}
122-
123-
/**
124-
* Add the marker SVG to this workspaces SVG group.
125-
*
126-
* @param markerSvg The SVG root of the marker to be added to the workspace
127-
* SVG group.
128-
* @internal
129-
*/
130-
setMarkerSvg(markerSvg: SVGElement | null) {
131-
if (!markerSvg) {
132-
this.markerSvg = null;
133-
return;
134-
}
135-
136-
if (this.workspace.getBlockCanvas()) {
137-
if (this.cursorSvg) {
138-
this.workspace
139-
.getBlockCanvas()!
140-
.insertBefore(markerSvg, this.cursorSvg);
141-
} else {
142-
this.workspace.getBlockCanvas()!.appendChild(markerSvg);
143-
}
144-
}
145-
}
146-
147100
/**
148101
* Dispose of the marker manager.
149102
* Go through and delete all markers associated with this marker manager.

core/renderers/common/i_path_object.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,6 @@ export interface IPathObject {
3030
/** The primary path of the block. */
3131
style: BlockStyle;
3232

33-
/**
34-
* Holds the cursors SVG element when the cursor is attached to the block.
35-
* This is null if there is no cursor on the block.
36-
*/
37-
cursorSvg: SVGElement | null;
38-
39-
/**
40-
* Holds the markers SVG element when the marker is attached to the block.
41-
* This is null if there is no marker on the block.
42-
*/
43-
markerSvg: SVGElement | null;
44-
4533
/**
4634
* Set the path generated by the renderer onto the respective SVG element.
4735
*
@@ -54,22 +42,6 @@ export interface IPathObject {
5442
*/
5543
flipRTL(): void;
5644

57-
/**
58-
* Add the cursor SVG to this block's SVG group.
59-
*
60-
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
61-
* group.
62-
*/
63-
setCursorSvg(cursorSvg: SVGElement): void;
64-
65-
/**
66-
* Add the marker SVG to this block's SVG group.
67-
*
68-
* @param markerSvg The SVG root of the marker to be added to the block SVG
69-
* group.
70-
*/
71-
setMarkerSvg(markerSvg: SVGElement): void;
72-
7345
/**
7446
* Set whether the block shows a highlight or not. Block highlighting is
7547
* often used to visually mark blocks currently being executed.

core/renderers/common/path_object.ts

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,6 @@ export class PathObject implements IPathObject {
2424
svgRoot: SVGElement;
2525
svgPath: SVGElement;
2626

27-
/**
28-
* Holds the cursors svg element when the cursor is attached to the block.
29-
* This is null if there is no cursor on the block.
30-
*/
31-
cursorSvg: SVGElement | null = null;
32-
33-
/**
34-
* Holds the markers svg element when the marker is attached to the block.
35-
* This is null if there is no marker on the block.
36-
*/
37-
markerSvg: SVGElement | null = null;
38-
3927
constants: ConstantProvider;
4028
style: BlockStyle;
4129

@@ -86,42 +74,6 @@ export class PathObject implements IPathObject {
8674
this.svgPath.setAttribute('transform', 'scale(-1 1)');
8775
}
8876

89-
/**
90-
* Add the cursor SVG to this block's SVG group.
91-
*
92-
* @param cursorSvg The SVG root of the cursor to be added to the block SVG
93-
* group.
94-
*/
95-
setCursorSvg(cursorSvg: SVGElement) {
96-
if (!cursorSvg) {
97-
this.cursorSvg = null;
98-
return;
99-
}
100-
101-
this.svgRoot.appendChild(cursorSvg);
102-
this.cursorSvg = cursorSvg;
103-
}
104-
105-
/**
106-
* Add the marker SVG to this block's SVG group.
107-
*
108-
* @param markerSvg The SVG root of the marker to be added to the block SVG
109-
* group.
110-
*/
111-
setMarkerSvg(markerSvg: SVGElement) {
112-
if (!markerSvg) {
113-
this.markerSvg = null;
114-
return;
115-
}
116-
117-
if (this.cursorSvg) {
118-
this.svgRoot.insertBefore(markerSvg, this.cursorSvg);
119-
} else {
120-
this.svgRoot.appendChild(markerSvg);
121-
}
122-
this.markerSvg = markerSvg;
123-
}
124-
12577
/**
12678
* Apply the stored colours to the block's path, taking into account whether
12779
* the paths belong to a shadow block.

core/workspace_svg.ts

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -461,28 +461,6 @@ export class WorkspaceSvg
461461
return this.componentManager;
462462
}
463463

464-
/**
465-
* Add the cursor SVG to this workspaces SVG group.
466-
*
467-
* @param cursorSvg The SVG root of the cursor to be added to the workspace
468-
* SVG group.
469-
* @internal
470-
*/
471-
setCursorSvg(cursorSvg: SVGElement) {
472-
this.markerManager.setCursorSvg(cursorSvg);
473-
}
474-
475-
/**
476-
* Add the marker SVG to this workspaces SVG group.
477-
*
478-
* @param markerSvg The SVG root of the marker to be added to the workspace
479-
* SVG group.
480-
* @internal
481-
*/
482-
setMarkerSvg(markerSvg: SVGElement) {
483-
this.markerManager.setMarkerSvg(markerSvg);
484-
}
485-
486464
/**
487465
* Get the marker with the given ID.
488466
*

0 commit comments

Comments
 (0)