soiz1 commited on
Commit
6eec7fd
·
verified ·
1 Parent(s): 29c2e6d

Create userscript.js

Browse files
src/addons/addons/paint-rounded-rect-seperate/userscript.js ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ export default async function ({ addon }) {
2
+ // Wait until the paint editor is loaded
3
+ await addon.tab.traps.getPaper();
4
+
5
+ const updateToolbar = (enabled) => {
6
+ ReduxStore.dispatch({
7
+ type: 'scratch-paint/addon-util/TOGGLE_ROUNDED_RECT_MODE',
8
+ enabled: enabled
9
+ });
10
+ };
11
+
12
+ updateToolbar(true);
13
+ addon.self.addEventListener("disabled", () => {
14
+ updateToolbar(false);
15
+ });
16
+ addon.self.addEventListener("reenabled", () => {
17
+ updateToolbar(true);
18
+ });
19
+ }