Skip to content

Commit

Permalink
Merge pull request #2906 from entrylabs/develop
Browse files Browse the repository at this point in the history
4.44.0
  • Loading branch information
leunge authored Jan 22, 2025
2 parents f7fa928 + a6fee77 commit 1712197
Show file tree
Hide file tree
Showing 18 changed files with 550 additions and 54 deletions.
5 changes: 5 additions & 0 deletions extern/util/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ EntryStatic.getAllBlocks = function () {
'repeat_inf',
'repeat_while_true',
'stop_repeat',
'continue_repeat',
'_if',
'if_else',
'wait_until_true',
Expand Down Expand Up @@ -486,6 +487,10 @@ EntryStatic.getAllBlocks = function () {
'get_social_disaster_guideline',
'count_safety_accident_guideline',
'get_safety_accident_guideline',
'disaster_alert_title',
'count_disaster_alert',
'get_disaster_alert',
'check_disaster_alert',
],
},
{
Expand Down
1 change: 1 addition & 0 deletions extern/util/static_mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ EntryStatic.getAllBlocks = function () {
'repeat_inf',
'repeat_while_true',
'stop_repeat',
'continue_repeat',
'_if',
'if_else',
'wait_until_true',
Expand Down
Binary file added images/hardware/disasterAlert.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/class/Expansion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import '../playground/blocks/block_expansion_festival';
import '../playground/blocks/block_expansion_behaviorconduct_disaster';
import '../playground/blocks/block_expansion_behaviorconduct_lifesafety';
import '../playground/blocks/block_expansion_emergencyActionGuidelines';
import '../playground/blocks/block_expansion_disasterAlert';

export default class Expansion {
constructor(playground) {
Expand Down
6 changes: 6 additions & 0 deletions src/class/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ Entry.Container = class Container {
border: 'solid 1px #728997',
},
onDragActionChange: (isDragging, key) => {
if (!Entry.objectEditable) {
return;
}
Entry.ContextMenu.hide();
if (isDragging) {
this.selectedObject.setObjectFold(isDragging, true);
Expand All @@ -207,6 +210,9 @@ Entry.Container = class Container {
this.isObjectDragging = isDragging;
},
onChangeList: (newIndex, oldIndex) => {
if (!Entry.objectEditable) {
return;
}
if (newIndex !== oldIndex) {
Entry.do('objectReorder', newIndex, oldIndex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/class/hw_lite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ export default class HardwareLite {
}

setFlasher() {
if (this.hwModule.firmwareFlash) {
if (this.hwModule.supportFirmwareFlash) {
this.flasher = new WebUsbFlasher();
}
}
Expand Down
46 changes: 28 additions & 18 deletions src/class/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -932,8 +932,12 @@ Entry.EntryObject = class {
this.updateCoordinateView(true);
this.updateRotationView(true);

Entry.addEventListener('run', this.setDisabled);
Entry.addEventListener('dispatchEventDidToggleStop', this.setEnabled);
if (!Entry.objectEditable) {
this.setDisabled();
} else {
Entry.addEventListener('run', this.setDisabled);
Entry.addEventListener('dispatchEventDidToggleStop', this.setEnabled);
}

return this.view_;
}
Expand All @@ -953,33 +957,40 @@ Entry.EntryObject = class {
this.rotateModeAView_ = rotateModeAView;
rotationMethodWrapper.appendChild(rotateModeAView);
rotationMethodWrapper.appendChild(rotateModeAView);
rotateModeAView.bindOnClick(
this._whenRotateEditable(() => {
Entry.do('objectUpdateRotateMethod', this.id, 'free');
}, this)
);

if (Entry.objectEditable) {
rotateModeAView.bindOnClick(
this._whenRotateEditable(() => {
Entry.do('objectUpdateRotateMethod', this.id, 'free');
}, this)
);
}

const rotateModeBView = Entry.createElement('span').addClass(
'entryObjectRotateModeWorkspace entryObjectRotateModeBWorkspace'
);
this.rotateModeBView_ = rotateModeBView;
rotationMethodWrapper.appendChild(rotateModeBView);
rotateModeBView.bindOnClick(
this._whenRotateEditable(() => {
Entry.do('objectUpdateRotateMethod', this.id, 'vertical');
}, this)
);
if (Entry.objectEditable) {
rotateModeBView.bindOnClick(
this._whenRotateEditable(() => {
Entry.do('objectUpdateRotateMethod', this.id, 'vertical');
}, this)
);
}

const rotateModeCView = Entry.createElement('span').addClass(
'entryObjectRotateModeWorkspace entryObjectRotateModeCWorkspace'
);
this.rotateModeCView_ = rotateModeCView;
rotationMethodWrapper.appendChild(rotateModeCView);
rotateModeCView.bindOnClick(
this._whenRotateEditable(() => {
Entry.do('objectUpdateRotateMethod', this.id, 'none');
}, this)
);
if (Entry.objectEditable) {
rotateModeCView.bindOnClick(
this._whenRotateEditable(() => {
Entry.do('objectUpdateRotateMethod', this.id, 'none');
}, this)
);
}

return rotationMethodWrapper;
}
Expand Down Expand Up @@ -1395,7 +1406,6 @@ Entry.EntryObject = class {
);

$(objectView).on('dragstart', (e) => {
// e.originalEvent.dataTransfer.setDragImage(canvas, 25, 25);
e.originalEvent.dataTransfer.setData('text', objectId);
});
const fragment = document.createDocumentFragment();
Expand Down
5 changes: 4 additions & 1 deletion src/playground/block_entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -2709,11 +2709,14 @@ function getBlocks() {
const sounds = sprite.parent.sounds;
const isExist = Entry.isExist(soundId, 'id', sounds);
if (isExist) {
const duration = Math.floor(
(sound.duration * 1000) / Entry.playbackRateValue
);
const instance = Entry.Utils.playSound(soundId);
Entry.Utils.addSoundInstances(instance);
setTimeout(() => {
script.playState = 0;
}, sound.duration * 1000);
}, duration);
}
return script;
} else if (script.playState === 1) {
Expand Down
4 changes: 1 addition & 3 deletions src/playground/blocks/block_calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2242,9 +2242,7 @@ module.exports = {
class: 'calc_string',
isNotFor: [],
func(sprite, script) {
const oldWord = script
.getStringValue('OLD_WORD', script)
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const oldWord = script.getStringValue('OLD_WORD', script);
const newWord = script.getStringValue('NEW_WORD', script);
const originalString = script.getStringValue('STRING', script);
return originalString.split(oldWord).join(newWord);
Expand Down
Loading

0 comments on commit 1712197

Please sign in to comment.