Skip to content

Commit

Permalink
zoom blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
LilyMakesThings committed Oct 9, 2024
1 parent bad9880 commit dbd5574
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 3 deletions.
75 changes: 75 additions & 0 deletions blocks_vertical/camera.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,78 @@ Blockly.Blocks['camera_yposition'] = {
});
}
};

Blockly.Blocks['camera_setzoom'] = {
/**
* Block to set the camera's zoom.
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CAMERA_SETZOOM,
"args0": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "camera.svg",
"width": 24,
"height": 24
},
{
"type": "input_value",
"name": "ZOOM"
}
],
"category": Blockly.Categories.camera,
"extensions": ["colours_camera", "shape_statement"]
});
}
};

Blockly.Blocks['camera_changezoom'] = {
/**
* Block to change the camera's zoom.
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CAMERA_CHANGEZOOM,
"args0": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "camera.svg",
"width": 24,
"height": 24
},
{
"type": "input_value",
"name": "ZOOM"
}
],
"category": Blockly.Categories.camera,
"extensions": ["colours_camera", "shape_statement"]
});
}
};

Blockly.Blocks['camera_zoom'] = {
/**
* Block to report camera's zoom.
* @this Blockly.Block
*/
init: function() {
this.jsonInit({
"message0": Blockly.Msg.CAMERA_ZOOM,
"args0": [
{
"type": "field_image",
"src": Blockly.mainWorkspace.options.pathToMedia + "camera.svg",
"width": 24,
"height": 24
}
],
"category": Blockly.Categories.camera,
"checkboxInFlyout": true,
"extensions": ["colours_camera", "output_number"]
});
}
};
2 changes: 1 addition & 1 deletion media/rotate-left.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion media/rotate-right.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion msg/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ Blockly.Msg.OPERATORS_MATHOP_10EXP = '10 ^';
// String blocks
Blockly.Msg.STRING_REVERSE = 'reverse %1'; // usb
Blockly.Msg.STRING_REPEAT = 'repeat %1 %2 times'; // usb
Blockly.Msg.STRING_REPLACE = 'replace %1 in %2 with %3'; // usb
Blockly.Msg.STRING_REPLACE = 'replace %1 with %2 in %3'; // usb
Blockly.Msg.STRING_ITEMSPLIT = 'item %1 of %2 split by %3'; // usb
Blockly.Msg.STRING_TERNARY = 'if %1 then %2 else %3'; // usb
Blockly.Msg.STRING_CONVERT = 'convert %1 to %2'; // usb
Expand Down Expand Up @@ -315,6 +315,9 @@ Blockly.Msg.CAMERA_SETY = 'set %1 y to %2';
Blockly.Msg.CAMERA_CHANGEY = 'change %1 y by %2';
Blockly.Msg.CAMERA_XPOSITION = '%1 x position';
Blockly.Msg.CAMERA_YPOSITION = '%1 y position';
Blockly.Msg.CAMERA_SETZOOM = 'set %1 zoom to %2';
Blockly.Msg.CAMERA_CHANGEZOOM = 'change %1 zoom by %2';
Blockly.Msg.CAMERA_ZOOM = '%1 zoom';

// Sound blocks
Blockly.Msg.SOUND_PLAY = 'start sound %1';
Expand Down

0 comments on commit dbd5574

Please sign in to comment.