mit-cml / appinventor-sources

MIT App Inventor Public Open Source
http://appinventor.mit.edu/appinventor-sources/
Apache License 2.0
1.47k stars 2.06k forks source link

Drag and drop media file to create asset helper block #2412

Open BeksOmega opened 3 years ago

BeksOmega commented 3 years ago

Describe the desired feature

Add the assets helper block to the workspace when the user drags a file from the media container (in the blocks tab, not the designer) to the blocks workspace.

Requested in this forum post.

Dependent on #2301

Give an example of how this feature would be used

Currently the only way to access the asset helper block is to open the flyout for a component that uses assets, and find the asset block there. This feature would make it easier to access the helper block (although the behavior is somewhat hidden).

Why doesn't the current App Inventor system address this use case?

App Inventor does address this use case, the feature request just makes it more convenient.

Why is this feature beneficial to App Inventor's educational mission?

This feature is not specific to App Inventor's educational mission, but would benefit all users of App Inventor (including those using it for educational purposes).

Next steps These are just the first steps that come to mind when I think about completing this project. They may be incomplete, or there may be better ways to implement things =)

1) #2301 needs to be merged before this issue can be worked on. 2) Some sort of drag-and-drop listener will need to be added to the workspace. This behavior could possibly be modeled off the logic for detecting when someone drops a .png representing exported blocks (source). 3) The assets helper block will need to be added to the workspace. The easiest way to do this is probably using the XML system, eg using blockTypeToXML, and then deserializing the resulting XML using domToWorkspace.

PeterMathijssen commented 3 years ago

What I would like is if you can drag an asset from the media pane, that when the assets block is generated the file that was dragged is the file visible in the block.