custom procedure caller block when drag it works not as expect

57 views
Skip to first unread message

m lz

unread,
Jun 25, 2024, 6:00:34 AM (4 days ago) Jun 25
to Blockly
hi,guys,
     when I put custom procedure caller blocker at top position of workspace it works not as expect,but if I put bottom of workspace when drag the whole block it works fine 
I capture actions  as a gif file and the whole demo as a codepen link,bellow is the resource link.and I check the console did not see any issue,any advise is pfeferred.

action gif
https://cloud-minapp-40829.cloud.ifanrusercontent.com/1sLCYICB1Mc8R9y3.gif
codepen link

Christopher Allen

unread,
Jun 25, 2024, 6:41:46 AM (4 days ago) Jun 25
to blo...@googlegroups.com
Hi Frederick,

The gif is surprising; the behaviour observed playing around with a similar set of blocks in your codepen is even more so.

Unfortunately there's so much custom code loaded in your codepen that it's very hard to say what might be happening.

If you are able to find a way to reproduce the behaviour in the Blockly playground or with a truly minimal codepen (one that only loads Blockly and a very small amount of custom JS) then we'd really appreciate it if you would open a bug report against Blockly.


Best wishes,

Christopher

Eric.M

unread,
Jun 27, 2024, 8:27:12 PM (2 days ago) Jun 27
to blo...@googlegroups.com
I locate the problem code at  line 4377(https://codepen.io/mlzboy/pen/wvbjGNB ),this code was in field colour validator(in procedure def block which is the green block with statement input, and use a filed colour as a return type picker. If change procedure def 's return type it will find all procedure callers and change each caller output type and color.If I remove this code when drag and move blocks it works fine, but I didn't know the reason did I need some reconnect block code?
'Christopher Allen' via Blockly <blo...@googlegroups.com> 于2024年6月25日周二 18:41写道:
--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/YV9PNhaxT4k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/CAN0w5ebi%2BrWEUbQbzGc5nzZSHHLW%3D9iL37ML_18tbgS%2BOBSmKA%40mail.gmail.com.

m lz

unread,
Jun 28, 2024, 4:51:06 AM (yesterday) Jun 28
to Blockly
make a mistake the line NO. is 4733 not 4377

Christopher Allen

unread,
Jun 28, 2024, 5:09:41 AM (yesterday) Jun 28
to blo...@googlegroups.com
Hi Frederick / Eric,

I locate the problem code at  line 4377(https://codepen.io/mlzboy/pen/wvbjGNB

make a mistake the line NO. is 4733 not 4377

Ha ha: I was looking at line 4377 and feeling confused when your correction arrived.  I must admit, though, that it's not obvious why line 4733 would be the cause either.
 
),this code was in field colour validator(in procedure def block which is the green block with statement input, and use a filed colour as a return type picker.

I did not notice the colour field at all and I am completely surprised to discover it is there!
 
If change procedure def 's return type it will find all procedure callers and change each caller output type and color.If I remove this code when drag and move blocks it works fine, but I didn't know the reason did I need some reconnect block code?

As far as I can tell from your codepen, the blocks are not being disconnected—they're just being rendered in the wrong location.

I am  not sure why the call to .updateReturnType(…) might cause that because I don't know what that method does.  (It does not appear in our currently-published version of Blockly or the block-shareable-procedures plugin.)  Might be worth finding the definition in your codepen and seeing how it is implemented.


Good luck,

Christopher

m lz

unread,
Jun 28, 2024, 9:04:40 PM (19 hours ago) Jun 28
to Blockly
sorry ,I rewrite whole case with clear code at https://codepen.io/mlzboy/pen/PovvOqr

if click load1 button drag and move block it work not ok 
but if click load2 button drag and move block it works fine.

actions gif 

m lz

unread,
Jun 28, 2024, 11:54:48 PM (16 hours ago) Jun 28
to Blockly
here is my thinking my `def` block has a field_colour as a return type when dragging block it will always find `caller` block changing it's output type(code at line NO. 62) ,this behavior make `caller` block not moving follow other block after drag end still stay at original position.
but I don't know how to solve it.

m lz

unread,
4:16 AM (12 hours ago) 4:16 AM
to Blockly
I detect BLOCK_DRAG event  when drag start I set def block RETURN filed validator to null ,after BLOCK_DRAG end  reset validator to original function seems solve this problem,here is the link  https://codepen.io/mlzboy/pen/WNBBMdq
still want to know any other better way
Reply all
Reply to author
Forward
0 new messages