@@ -126,6 +126,13 @@ const COLLAPSIBLES = [
126126 */
127127const NOHIT = [ "hidden" , "hiddennoflow" ] ;
128128
129+ /**
130+ * List of blocks that behave like argument blocks even though they are not
131+ * strictly classified as arg/value blocks.
132+ * @type {string[] }
133+ */
134+ const ARG_LIKE_BLOCKS = [ "doArg" , "calcArg" , "namedcalcArg" , "makeblock" ] ;
135+
129136/**
130137 * List of special input types.
131138 * @type {string[] }
@@ -797,10 +804,14 @@ class Block {
797804 * @returns {void }
798805 */
799806 const _postProcess = that => {
800- that . collapseButtonBitmap . scaleX = that . collapseButtonBitmap . scaleY = that . collapseButtonBitmap . scale =
801- scale / 3 ;
802- that . expandButtonBitmap . scaleX = that . expandButtonBitmap . scaleY = that . expandButtonBitmap . scale =
803- scale / 3 ;
807+ that . collapseButtonBitmap . scaleX =
808+ that . collapseButtonBitmap . scaleY =
809+ that . collapseButtonBitmap . scale =
810+ scale / 3 ;
811+ that . expandButtonBitmap . scaleX =
812+ that . expandButtonBitmap . scaleY =
813+ that . expandButtonBitmap . scale =
814+ scale / 3 ;
804815 that . updateCache ( ) ;
805816 that . _calculateBlockHitArea ( ) ;
806817 } ;
@@ -1510,8 +1521,10 @@ class Block {
15101521 const image = new Image ( ) ;
15111522 image . onload = ( ) => {
15121523 that . collapseButtonBitmap = new createjs . Bitmap ( image ) ;
1513- that . collapseButtonBitmap . scaleX = that . collapseButtonBitmap . scaleY = that . collapseButtonBitmap . scale =
1514- that . protoblock . scale / 3 ;
1524+ that . collapseButtonBitmap . scaleX =
1525+ that . collapseButtonBitmap . scaleY =
1526+ that . collapseButtonBitmap . scale =
1527+ that . protoblock . scale / 3 ;
15151528 that . container . addChild ( that . collapseButtonBitmap ) ;
15161529 that . collapseButtonBitmap . x = 2 * that . protoblock . scale ;
15171530 if ( that . isInlineCollapsible ( ) ) {
@@ -1538,8 +1551,10 @@ class Block {
15381551 const image = new Image ( ) ;
15391552 image . onload = ( ) => {
15401553 that . expandButtonBitmap = new createjs . Bitmap ( image ) ;
1541- that . expandButtonBitmap . scaleX = that . expandButtonBitmap . scaleY = that . expandButtonBitmap . scale =
1542- that . protoblock . scale / 3 ;
1554+ that . expandButtonBitmap . scaleX =
1555+ that . expandButtonBitmap . scaleY =
1556+ that . expandButtonBitmap . scale =
1557+ that . protoblock . scale / 3 ;
15431558
15441559 that . container . addChild ( that . expandButtonBitmap ) ;
15451560 that . expandButtonBitmap . visible = that . collapsed ;
@@ -1930,6 +1945,17 @@ class Block {
19301945 return this . protoblock . style === "value" || this . protoblock . style === "arg" ;
19311946 }
19321947
1948+ /**
1949+ * Checks if the block behaves like an argument block.
1950+ * Some blocks (e.g., doArg, calcArg, namedcalcArg, makeblock) are not styled
1951+ * strictly as arg/value blocks but are treated as argument blocks in
1952+ * certain contexts.
1953+ * @returns {boolean } - True if the block is argument-like, false otherwise.
1954+ */
1955+ isArgumentLikeBlock ( ) {
1956+ return this . isArgBlock ( ) || ARG_LIKE_BLOCKS . includes ( this . name ) ;
1957+ }
1958+
19331959 /**
19341960 * Checks if the block is a two-argument block.
19351961 * @returns {boolean } - True if the block is a two-argument block, false otherwise.
@@ -2747,11 +2773,15 @@ class Block {
27472773 */
27482774 _positionMedia ( bitmap , width , height , blockScale ) {
27492775 if ( width > height ) {
2750- bitmap . scaleX = bitmap . scaleY = bitmap . scale =
2751- ( ( MEDIASAFEAREA [ 2 ] / width ) * blockScale ) / 2 ;
2776+ bitmap . scaleX =
2777+ bitmap . scaleY =
2778+ bitmap . scale =
2779+ ( ( MEDIASAFEAREA [ 2 ] / width ) * blockScale ) / 2 ;
27522780 } else {
2753- bitmap . scaleX = bitmap . scaleY = bitmap . scale =
2754- ( ( MEDIASAFEAREA [ 3 ] / height ) * blockScale ) / 2 ;
2781+ bitmap . scaleX =
2782+ bitmap . scaleY =
2783+ bitmap . scale =
2784+ ( ( MEDIASAFEAREA [ 3 ] / height ) * blockScale ) / 2 ;
27552785 }
27562786 bitmap . x = ( ( MEDIASAFEAREA [ 0 ] - 10 ) * blockScale ) / 2 ;
27572787 bitmap . y = ( MEDIASAFEAREA [ 1 ] * blockScale ) / 2 ;
@@ -4182,7 +4212,6 @@ class Block {
41824212 return new Date ( ) . getTime ( ) - this . _piemenuExitTime > 200 ;
41834213 }
41844214
4185-
41864215 /**
41874216 * Checks and reinitializes widget windows if their labels are changed.
41884217 * @param {boolean } closeInput - Flag indicating whether to close input.
0 commit comments