Skip to content

Commit bca9d76

Browse files
committed
add ban class scenario
1 parent e06f449 commit bca9d76

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

app/entry_offline.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
}
5050
</script>
5151
<script type='text/javascript' src='./bower_components/entryjs/src/workspace/block_entry.js'></script>
52+
<script type='text/javascript' src='./bower_components/entryjs/src/workspace/block_entry_mini.js'></script>
5253
<script type='text/javascript' src='./src/context.js'></script>
5354
<script type="text/javascript" src="./src/filters.js"></script>
5455
<script type="text/javascript" src="./lang/pictures.js"></script>

app/src/workspace.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,21 +222,32 @@ angular.module('workspace').controller("WorkspaceController", ['$scope', '$rootS
222222

223223
var lastHwConnected = false;
224224
$scope.hwChanged = function() {
225-
if (Entry.hw.connected === lastHwConnected || !isMiniMode) {
225+
if ((Entry.hw.connected && Entry.hw.hwModule && lastHwConnected) || !isMiniMode) {
226226
return;
227227
}
228228
if (Entry.hw.connected && Entry.hw.hwModule) {
229-
hwCategoryList.forEach(function(categoryName) {
230-
Entry.playground.blockMenu.unbanCategory(categoryName);
231-
});
232-
Entry.playground.blockMenu.banCategory('hw_robot');
229+
if(EntryStatic.hwMiniSupportList.indexOf(Entry.hw.hwModule.name) > -1) {
230+
hwCategoryList.forEach(function(categoryName) {
231+
Entry.playground.blockMenu.unbanCategory(categoryName);
232+
});
233+
Entry.playground.blockMenu.banCategory('arduino');
234+
Entry.playground.blockMenu.banCategory('hw_robot');
235+
} else {
236+
hwCategoryList.forEach(function(categoryName) {
237+
Entry.playground.blockMenu.banCategory(categoryName);
238+
});
239+
Entry.playground.blockMenu.banCategory('hw_robot');
240+
Entry.playground.blockMenu.unbanCategory('arduino');
241+
}
242+
lastHwConnected = true;
233243
} else {
234244
hwCategoryList.forEach(function(categoryName) {
235245
Entry.playground.blockMenu.banCategory(categoryName);
236246
});
247+
Entry.playground.blockMenu.banCategory('arduino');
237248
Entry.playground.blockMenu.unbanCategory('hw_robot');
249+
lastHwConnected = false;
238250
}
239-
lastHwConnected = Entry.hw.connected;
240251
}
241252

242253
$scope.setOfflineHW = function() {

0 commit comments

Comments
 (0)