gobstones-blockly 0.29.0 → 0.29.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e5463872ab87a752ec1f0061775e4e9dddb1943a1497ca1696ec82338e9eb3b7
4
- data.tar.gz: ef29461291eff352fcfc20632d047c8d894c9478fab08e90e1587d8c40474f48
3
+ metadata.gz: 535de373bc92627bf98a2b3c90f9d00ab61e074ef94b99a9e8f15bc6c7b248d3
4
+ data.tar.gz: 5f72b025962136ab74f71f23e10884cae99d8fa944ae752fa7a6309f1deb1d6b
5
5
  SHA512:
6
- metadata.gz: 901c46fb4bf1d2011b99646d7c11498edc7012a3f55675cac812a74a413c9aeddd06be90f7f31980c67c75ce444c58b0a501eb7fa5fac943c1bc9d5e730f44ce
7
- data.tar.gz: c56fc598356c69a59b9474b87156969fa4dae66c873221e7a038dc2d632c941562272726a1543ab7f616e639ad839412d9f0b8160a8eed6e4f59ba0f4c962aa0
6
+ metadata.gz: adfb423ee734fcad637dfc359a0623a6c680b28f0b5998d15d7d9f7d5ad5ef4a4bb2d1afc4c66687504103f2cd1dbd04ff295019b23ec9cb4cab5b0fab3c9876
7
+ data.tar.gz: b671355f1238b308c49b913ba0d5dd596c23b09da204c1a0f17d376d3ff910587a6378b757bbcb1fbdc9912b172ea10dd60932f67efb8b1b06210b31a7e9339e
@@ -3413,11 +3413,23 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
3413
3413
  xmlBlock.setAttribute('type', 'variables_get');
3414
3414
 
3415
3415
  var callback = Blockly.ContextMenu.callbackFactory(procedureBlock, xmlBlock);
3416
-
3416
+
3417
3417
  return function() {
3418
3418
  var block = callback();
3419
3419
  block.$parent = procedureBlock.id;
3420
- block.moveBy(procedureBlock.width, -14);
3420
+
3421
+ try {
3422
+ Blockly.Events.disabled_ = 1;
3423
+ const posParent = procedureBlock.getRelativeToSurfaceXY();
3424
+ const pos = block.getRelativeToSurfaceXY();
3425
+ let width = procedureBlock.width;
3426
+ const returnBlock = procedureBlock.inputList.find((it) => it.name === "RETURN");
3427
+ if (returnBlock) width -= returnBlock.renderWidth - 8;
3428
+
3429
+ block.moveBy(posParent.x - pos.x + width + 16, posParent.y - pos.y + 6);
3430
+ } finally {
3431
+ Blockly.Events.disabled_ = 0;
3432
+ }
3421
3433
  };
3422
3434
  };
3423
3435
 
@@ -3485,7 +3497,7 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
3485
3497
  newName = getAvailableName(self, newName);
3486
3498
 
3487
3499
  self.arguments_[i] = newName;
3488
-
3500
+
3489
3501
  var blocks = self.workspace.getAllBlocks();
3490
3502
  for (block of blocks) {
3491
3503
  if (block.type === self.callType_ && block.getProcedureCall() === self.getProcedureDef()[0]) {
@@ -3512,7 +3524,7 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
3512
3524
  .appendField(nameField, 'ARG' + i)
3513
3525
  .appendField(createCallButton)
3514
3526
  .appendField(removeParameterButton);
3515
-
3527
+
3516
3528
  self.moveInputBefore(id, 'STACK');
3517
3529
  };
3518
3530
 
@@ -3617,7 +3629,22 @@ window.initProcedsBlockly = function(customStatementType, initialize = () => {})
3617
3629
  var xmlBlock = goog.dom.createDom('block', null, xmlMutation);
3618
3630
  xmlBlock.setAttribute('type', self.callType_);
3619
3631
 
3620
- Blockly.ContextMenu.callbackFactory(self, xmlBlock)();
3632
+ const block = Blockly.ContextMenu.callbackFactory(self, xmlBlock)();
3633
+
3634
+ try {
3635
+ const procedureBlock = self;
3636
+
3637
+ Blockly.Events.disabled_ = 1;
3638
+ const posParent = procedureBlock.getRelativeToSurfaceXY();
3639
+ const pos = block.getRelativeToSurfaceXY();
3640
+ let width = procedureBlock.width;
3641
+ const returnBlock = procedureBlock.inputList.find((it) => it.name === "RETURN");
3642
+ if (returnBlock) width -= returnBlock.renderWidth - 8;
3643
+
3644
+ block.moveBy(posParent.x - pos.x + width + 16, posParent.y - pos.y + 6);
3645
+ } finally {
3646
+ Blockly.Events.disabled_ = 0;
3647
+ }
3621
3648
  }
3622
3649
  );
3623
3650
  input.appendField(createCallButton);
@@ -4175,6 +4202,15 @@ Blockly.CUSTOM_COLORS = {"globalHsvSaturation":0.45,"globalHsvValue":0.65,"primi
4175
4202
  Blockly.AVAILABLE_ICONS = ["bool-false.svg","bool-true.svg","clean.png","color-azul.svg","color-negro.svg","color-rojo.svg","color-verde.svg","direccion-este.svg","direccion-norte.svg","direccion-oeste.svg","direccion-sur.svg","hand.png","minus.png","plus.png"];
4176
4203
  const EMPTY_GIF = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
4177
4204
 
4205
+ const ATOMICALLY = (action) => {
4206
+ try {
4207
+ Blockly.Events.disabled_ = 1;
4208
+ action();
4209
+ } finally {
4210
+ Blockly.Events.disabled_ = 0;
4211
+ }
4212
+ }
4213
+
4178
4214
  const getOptions = (block) => {
4179
4215
  const parentWorkspace = block.workspace.options.parentWorkspace;
4180
4216
  return parentWorkspace && parentWorkspace.options || block.workspace.options
@@ -4202,11 +4238,12 @@ Blockly.createBlockSvg = function(workspace, name, f) {
4202
4238
  const createVariable = (parent, name) => {
4203
4239
  const workspace = parent.workspace;
4204
4240
  Blockly.createBlockSvg(workspace, 'variables_get', b => {
4205
- b.setFieldValue(name, 'VAR');
4206
-
4207
- const posParent = parent.getRelativeToSurfaceXY();
4208
- const pos = b.getRelativeToSurfaceXY();
4209
- b.moveBy(posParent.x - pos.x + parent.width + 16, posParent.y - pos.y + b.height + 6);
4241
+ ATOMICALLY(() => {
4242
+ b.setFieldValue(name, 'VAR');
4243
+ const posParent = parent.getRelativeToSurfaceXY();
4244
+ const pos = b.getRelativeToSurfaceXY();
4245
+ b.moveBy(posParent.x - pos.x + parent.width + 16, posParent.y - pos.y + b.height + 6);
4246
+ });
4210
4247
  });
4211
4248
  }
4212
4249
 
@@ -1,5 +1,5 @@
1
1
  module Gobstones
2
2
  module Blockly
3
- VERSION = "0.29.0"
3
+ VERSION = "0.29.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gobstones-blockly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso