Skip to content

Commit f2f00bd

Browse files
authored
DogeisCut Extensions: Remove unused constants (#512)
* remove unused constants * doin it right * actually doin it right
1 parent ddf580b commit f2f00bd

File tree

2 files changed

+34
-40
lines changed

2 files changed

+34
-40
lines changed

static/extensions/DogeisCut/dogeiscutObject.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@
1010
throw new Error('\'Objects\' must run unsandboxed!')
1111
}
1212

13-
const BlockType = Scratch.BlockType
14-
const BlockShape = Scratch.BlockShape
15-
const ArgumentType = Scratch.ArgumentType
16-
const TargetType = Scratch.TargetType
1713
const Cast = Scratch.Cast
1814
const vm = Scratch.vm
19-
const runtime = Scratch.vm.runtime
20-
const SB = ScratchBlocks
2115

2216
/**
2317
* @param {number} x

static/extensions/DogeisCut/dogeiscutRegularExpressions.js

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,43 @@
1111
}
1212

1313
const BlockType = Scratch.BlockType
14-
const BlockShape = Scratch.BlockShape
1514
const ArgumentType = Scratch.ArgumentType
16-
const TargetType = Scratch.TargetType
1715
const Cast = Scratch.Cast
1816
const vm = Scratch.vm;
19-
const runtime = Scratch.vm.runtime;
20-
const SB = ScratchBlocks;
21-
22-
SB.BlockSvg.registerCustomShape(
23-
"dogeiscutRegularExpressions-RegularExpression", {
24-
emptyInputPath: "m 16 0 h 16 h 32 l -16 32 h -16 h -16 h -16 z",
25-
emptyInputWidth: 16 * ScratchBlocks.BlockSvg.GRID_UNIT,
26-
leftPath: (block) => {
27-
const scale = block.height / 2;
28-
const s = scale / 16;
29-
return [
30-
`h ${-16 * s}`,
31-
];
32-
},
33-
rightPath: (block) => {
34-
const scale = block.edgeShapeWidth_;
35-
const s = scale / 16;
36-
return [
37-
`h ${16 * s}`,
38-
`l ${-16 * s} ${32 * s}`,
39-
`h 0`,
40-
`h ${-16 * s}`,
41-
];
42-
},
43-
blockPaddingStart: (_, _2, _3, _4, row) => {
44-
return (row.height - 16) / 2;
45-
},
46-
blockPaddingEnd: (_, _2, _3, _4, row) => {
47-
return (row.height - 16) / 2;
48-
}
49-
}
50-
);
17+
18+
if (Scratch.gui) {
19+
Scratch.gui.getBlockly().then(ScratchBlocks => {
20+
ScratchBlocks.BlockSvg.registerCustomShape(
21+
"dogeiscutRegularExpressions-RegularExpression",{
22+
emptyInputPath: "m 16 0 h 16 h 32 l -16 32 h -16 h -16 h -16 z",
23+
emptyInputWidth: 16 * ScratchBlocks.BlockSvg.GRID_UNIT,
24+
leftPath: (block) => {
25+
const scale = block.height / 2;
26+
const s = scale / 16;
27+
return [
28+
`h ${-16 * s}`,
29+
];
30+
},
31+
rightPath: (block) => {
32+
const scale = block.edgeShapeWidth_;
33+
const s = scale / 16;
34+
return [
35+
`h ${16 * s}`,
36+
`l ${-16 * s} ${32 * s}`,
37+
`h 0`,
38+
`h ${-16 * s}`,
39+
];
40+
},
41+
blockPaddingStart: (_, _2, _3, _4, row) => {
42+
return (row.height - 16) / 2;
43+
},
44+
blockPaddingEnd: (_, _2, _3, _4, row) => {
45+
return (row.height - 16) / 2;
46+
}
47+
}
48+
);
49+
})
50+
}
5151

5252
function span(text) {
5353
let el = document.createElement('span')

0 commit comments

Comments
 (0)