Skip to content

Commit 834a59d

Browse files
fix: delete marker and cursor SVG elements
1 parent d0d70a9 commit 834a59d

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
@@ -1698,28 +1698,6 @@ export class BlockSvg
16981698
if (this.nextConnection) this.nextConnection.tightenEfficiently();
16991699
}
17001700

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

core/field.ts

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

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

@@ -1358,44 +1346,6 @@ export abstract class Field<T = any>
13581346
return false;
13591347
}
13601348

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

core/flyout_button.ts

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

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

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
@@ -474,28 +474,6 @@ export class WorkspaceSvg
474474
return this.componentManager;
475475
}
476476

477-
/**
478-
* Add the cursor SVG to this workspaces SVG group.
479-
*
480-
* @param cursorSvg The SVG root of the cursor to be added to the workspace
481-
* SVG group.
482-
* @internal
483-
*/
484-
setCursorSvg(cursorSvg: SVGElement) {
485-
this.markerManager.setCursorSvg(cursorSvg);
486-
}
487-
488-
/**
489-
* Add the marker SVG to this workspaces SVG group.
490-
*
491-
* @param markerSvg The SVG root of the marker to be added to the workspace
492-
* SVG group.
493-
* @internal
494-
*/
495-
setMarkerSvg(markerSvg: SVGElement) {
496-
this.markerManager.setMarkerSvg(markerSvg);
497-
}
498-
499477
/**
500478
* Get the marker with the given ID.
501479
*

0 commit comments

Comments
 (0)