Commit graph

286 commits

Author SHA1 Message Date
DD Liu
62e7dde84e Put back deprecated function to not break gui 2021-04-01 18:28:15 -04:00
DD Liu
e5560b067b Merge branch 'develop' into removev2SvgAdapter 2021-03-16 16:53:40 -04:00
DD Liu
627e62a339 Remove v2SvgAdapter 2021-03-04 15:32:14 -05:00
DD Liu
04b6963788 Pass on event type from CDM 2020-10-15 19:56:24 -04:00
chrisgarrity
5adf5ba8fc
Merge pull request #2252 from chrisgarrity/custom-mimetype
Add custom mime-type to exported sb3 and sprite
2019-08-13 15:22:10 -04:00
Chris Garrity
40be416c9f Add custom mime-type to exported sb3 and sprite 2019-08-07 13:52:30 +01:00
Karishma Chadha
9af2e4c086
Merge pull request #2161 from LLK/e16n
Supporting VM changes for extensionification
2019-06-18 18:53:20 -04:00
Eric Rosenbaum
8243d0f53a Update sound sampleCount and rate 2019-06-05 17:06:27 -04:00
Paul Kaplan
5e626eb7e9 Initial prototype of configurable scratch link socket 2019-05-24 12:51:58 -04:00
Karishma Chadha
92a73fef55 Add a runtime event to track when the toolbox extension blocks need updating. 2019-04-24 11:28:02 -04:00
Christopher Willis-Ford
bd1aaecdf3 add category info to extension add & update events 2019-04-19 16:06:11 -07:00
Katie Broida
eedc0b16e0
Merge pull request #2041 from ktbee/use-empty-bitmap-size
Set height and width to zero for the canvas and costume size if bitmap's sourceHeight or sourceWidth are zero
2019-04-16 14:50:42 -04:00
Karishma Chadha
0e710ba3d9 Allow loading extensions synchronously. Add example extension to list of known internal extensions. 2019-03-22 12:20:06 -04:00
Michael "Z" Goddard
882a83db9a
do not evaluate text-encoding until it is needed
text-encoding has about ~700KB of data that is great to skip decoding
for systems that have a browser provided TextDecoder.
2019-03-06 11:11:44 -05:00
Michael "Z" Goddard
bc5605cf80
lazy evaluate project loading related code 2019-03-06 11:11:44 -05:00
Katie Broida
aeea9c1a51 Use bitmap source width 2019-03-05 16:05:07 -05:00
Michael "Z" Goddard
146e93e4ec
start loading sb2 sounds before handling sb2 data 2019-02-15 17:43:55 -05:00
Karishma Chadha
59f58b0284
Merge pull request #1933 from ErikMejerHansen/feature/field_type_support
Feature/field type support
2019-02-12 09:59:22 -05:00
Paul Kaplan
6deab79903
Merge pull request #1979 from paulkaplan/share-blocks-new-ids
Add a utility for giving blocks new IDs, use it for sharing blocks.
2019-02-07 08:31:25 -05:00
Paul Kaplan
31fbcfa4d7 Add a utility for giving blocks new IDs, use it for sharing blocks. 2019-02-06 10:16:22 -05:00
Karishma Chadha
13e69bad7b Code cleanup -- move out duplicate .then statements after the next .then (at the higher level) 2019-01-30 16:45:38 -05:00
Karishma Chadha
dfcd09fedc Stop emitting project changes within 'runtime._step()'. Emit project changes in scenarios that were previously taking advantage of runtime._step() 2019-01-30 10:59:25 -05:00
Karishma Chadha
a9cf509a55
Merge pull request #1941 from kchadha/add-runtime-to-blocks
Add reference for `runtime` to blocks container
2019-01-30 10:57:45 -05:00
Karishma Chadha
0bf5d8ab90 Update VM getPlaygroundData function to remove circular dependency in blockContainer. It wasn't being used by the tests or the playground and it is not an issue with actual project serialization. Update test to stop passing in runtime to blocklyListen function. 2019-01-24 15:26:16 -05:00
Karishma Chadha
e5723e299a Add runtime to blocks container since it was getting passed in everywhere where it was being referenced. Update calls to blocks constructor. 2019-01-23 18:18:38 -05:00
Erik Mejer Hansen
ceaa3c7857 Add support extensions to define custom field types.
This is done by adding a new element "customFieldTypes" to the extension info structure. Ex:
```
customFieldTypes: {
   angleField: {
      implementation: { fromJson: options => new AngleField(options) },
      output: 'number',
      outputShape: 2,
   }
}
```
Field types are defined by an implementation that has to match what is expected by ScratchBlocks.Field.register and its output and shape.

src/engine/runtime.js has been updated to handle the new "customFieldTypes"-field:
- Existing (global) field types cannot be overridden
- New fields are "namespaced" to the extension in the same way as opcodes are.

Once the custom field type has been picked up by scratch-vm a "EXTENSION_FIELD_ADDED" event is emitted.
It is then up to the hosting app to call ScratchBlocks.Field.register to register the field type with ScratchBlocks. Ex:
```
vm.addListener('EXTENSION_FIELD_ADDED', fieldInfo => {
   this.ScratchBlocks.Field.register(fieldInfo.name, fieldInfo.implementation);
});
```
2019-01-20 21:24:32 +01:00
Evelyn Eastmond
7831256044 Change event names to be more descriptive. Fix some typos. 2019-01-16 20:17:19 -05:00
Evelyn Eastmond
156b1bc21a Adding new runtime event for intentional peripheral disconnects. 2019-01-16 15:22:58 -05:00
Karishma Chadha
59a865ef47 Create a new addTarget function on the runtime which populates the targets list as well as the executable targets list. 2019-01-14 11:48:11 -05:00
Karishma Chadha
fbee37e915 Populate executable targets when runtime.targets is populated so that scripts don't run before they are supposed to (e.g. before targets are done getting installed). 2019-01-11 14:52:34 -05:00
Karishma Chadha
4ad101f5d4
Apply suggestions from code review
Co-Authored-By: mzgoddard <mzgoddard@gmail.com>
2018-12-20 14:12:33 -05:00
Karishma Chadha
f1a24e3296
Update src/virtual-machine.js
Co-Authored-By: mzgoddard <mzgoddard@gmail.com>
2018-12-20 14:11:58 -05:00
Michael "Z" Goddard
5593b28984
try handling as a Scratch 1 file after scratch-parser validation fails 2018-12-20 13:55:49 -05:00
Michael "Z" Goddard
a92f33960f
fix: use ValidationError to determine if an SB1File error should throw 2018-12-20 13:32:30 -05:00
Michael "Z" Goddard
f43163fc73
depend on scratch-sb1-converter and convert sb1 files to sb2 2018-12-20 12:09:58 -05:00
DD Liu
fe375fa672
Merge pull request #1849 from fsih/addCostumeFromLibrary
Add addCostumeFromLibrary
2018-12-18 12:12:18 -05:00
DD
a4744f5ac9 Add addCostumeFromLibrary 2018-12-14 14:20:42 -05:00
picklesrus
ebe06a97d9
Merge pull request #1818 from picklesrus/monitor-vars-project-load
Clear out the blocks in dispose. Fixes #1758 where old monitored vari…
2018-12-07 15:08:09 -05:00
picklesrus
3f3c34b43a Given the bug found with the old approach, fix this by going and deleting all of the monitor blocks for each sprite and the global variables. 2018-12-06 18:59:58 -05:00
Paul Kaplan
8405ff00d4
Merge pull request #1825 from paulkaplan/emit-start-publicly
Emit PROJECT_START event publicly on green flag click.
2018-12-06 15:38:05 -05:00
Paul Kaplan
56c062eee3 re-emit the PROJECT_START event publicly, add unit test 2018-12-06 11:47:09 -05:00
Karishma Chadha
dc4fd15197 Make a cloud device requestVariableUpdate when setting a variable through the vm's top level setVariableValue API. Add unit test for new functionality. 2018-12-05 22:38:06 -05:00
Paul Kaplan
7e96ef2985 Serialize Infinity and NaN to 0 2018-12-04 10:52:49 -05:00
Karishma Chadha
ff2566fec4
Merge pull request #1778 from kchadha/emit-cloud-data-update
Emit cloud data update
2018-11-28 17:23:29 -05:00
Karishma Chadha
86d61a4c20 Emit event tracking when the project's hasCloudData status changes. Cloud var creation now happens regardless of connectivity to the provider. 2018-11-28 15:03:19 -05:00
picklesrus
f214d3a191 VM changes for the sensing_of block. This handles lists properly (by ignoring them like Scratch2 and makes the attribute menu update based on what was chosen in the target menu. 2018-11-28 10:35:35 -05:00
Chris Willis-Ford
05979e2e93
Merge pull request #1784 from cwillisf/setLocale-always-refreshBlocks
Make setLocale consistently refresh blocks
2018-11-27 19:19:41 -08:00
Paul Kaplan
ffb02c607d
Merge pull request #1783 from paulkaplan/emit-start-event
Emit a RUNTIME_STARTED event to track if the vm has been started
2018-11-27 16:38:27 -05:00
Christopher Willis-Ford
4256f86ac3 Make setLocale consistently refresh blocks
This change makes the VM's `setLocale` method call `refreshBlocks` even
when not changing the language, though it still skips an unnecessary
call to `formatMessage.setup` in this case.
2018-11-27 10:26:04 -08:00
Paul Kaplan
cc4751228e Emit a RUNTIME_STARTED event to track if the vm has been started 2018-11-27 11:37:01 -05:00