Skip to content

Conversation

@kchadha
Copy link
Contributor

@kchadha kchadha commented Nov 9, 2018

Resolves

Proposed Changes

Add ability to save and load monitors in 3.0 projects.
Monitors retain position and mode, and in the case of list monitors, height and width across save and load.

Make extension monitors the right color, and make the extension color the default color for monitors when a color is not specified.

Test Coverage

Manual testing.
Test instructions in scratchfoundation/scratch-vm#1686.
Testing branch: https://llk.github.io/scratch-gui/monitors/

Related PRs

This PR is dependent on scratchfoundation/scratch-vm#1686. The VM PR should be merged first.

Browser Coverage

Check the OS/browser combinations tested (At least 2)

Mac

  • Chrome
  • Firefox
  • Safari

Windows

  • Chrome
  • Firefox
  • Edge

Chromebook

  • Chrome

iPad

  • Safari

Android Tablet

  • Chrome

cc/ @picklesrus

@maomao225
Copy link

???????

@summerscar
Copy link

There is a problem, if the previous Project has variables, then load a new project(directly use loadproject function in vm with json file) ,these variables will appear in the current project(need to switch sprites and then variables will appear in variable catalog).

it may caused by monitorBlocks in runtime.js in scratch-vm. if clean the monitorBlocks in dipose function in runtime.js will solve this problem.

Copy link
Contributor

@paulkaplan paulkaplan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good, but you can resolve the TODO comment about removing state.mode as mentioned in the review comment.

const modeIndex = modes.indexOf(this.state.mode);
this.setState({mode: modes[(modeIndex + 1) % modes.length]});
const newMode = modes[(modeIndex + 1) % modes.length];
this.setState({mode: newMode});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove all of the references to "mode" stored in state and just consume it from props, since we are now updating it through the VM. So you can remove lines 36-39, 106, 113, 120, 127, and update lines 100 and 143 to use this.props.mode.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@kchadha
Copy link
Contributor Author

kchadha commented Nov 14, 2018

@summerscar, thank you for calling out that issue! Since this is an issue that already exists, I filed it as a bug in scratch-vm to be fixed separate from this pull request.

paulkaplan
paulkaplan previously approved these changes Nov 14, 2018
@kchadha kchadha removed the blocked label Nov 14, 2018
@kchadha kchadha merged commit 9469fe1 into scratchfoundation:develop Nov 14, 2018
@kchadha kchadha deleted the monitor-save-load branch November 14, 2018 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants