Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix codigo de bloque repetir #305

Merged
merged 3 commits into from
Aug 21, 2024
Merged

Fix codigo de bloque repetir #305

merged 3 commits into from
Aug 21, 2024

Conversation

dlopezalvas
Copy link
Contributor

@dlopezalvas dlopezalvas commented Aug 1, 2024

Related #251

Repliqué el bloque que está hoy en producción, que tenga el bloquesito del valor dentro en lugar de el input de número.
La razón por la cuál no estaba andando es porque los bloques de valores tenían hardcodeado que escupan un sting vacío en lugar de un valor.
Aproveché también a cambiar algunos tipos que faltaban.

Grabacion.de.pantalla.desde.01-08-24.14_43_15.mp4

@dlopezalvas dlopezalvas requested a review from a team as a code owner August 1, 2024 17:50
Comment on lines +110 to +123
toolboxJSON: {
"kind": "block",
"type": "Repetir",
"inputs": {
"count": {
"block": {
"type": "math_number",
"fields": {
"NUM": 10
}
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esto es necesario para que en el toolbox, el bloque repetir aparezca con el bloque numérico adentro, lo que lo diferencia del repetir vacío

Comment on lines +231 to +245
categoryId: 'primitives',
toolboxJSON: {
"kind": "block",
"type": "SaltarHaciaAdelante",
"inputs": {
"longitud": {
"block": {
"type": "math_number",
"fields": {
"NUM": 100
}
}
}
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Habían otros bloques, en específico los de Mañic de dibujo, que usaban bloques que deberían aparecer en el toolbox con un bloque numérico ya conectado, los agregué

var code = '';

const loopVar = generator.nameDB_.getDistinctName(
'count', Blockly.Names.NameType.VARIABLE);
var endVar = repeats;
if (!repeats.match(/^\w+$/) && Blockly.utils.string.isNumber(repeats)) {
if (!repeats.toString().match(/^\w+$/) && Blockly.utils.string.isNumber(repeats)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No deja hacer un match con un número

Comment on lines +73 to +80
init: Blockly.Blocks['math_number'].init,
categoryId: Blockly.Blocks['math_number'].categoryId,
}

javascriptGenerator.forBlock['Numero'] = function (block: Block) {
return [`${block.getFieldValue('NUM')}`, Order.ATOMIC];
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cree el bloque "Numero" más que nada para replicar el alias que tenía en versiones viejas y que sigan andando viejas soluciones.

Copy link
Contributor

@danielferro69 danielferro69 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bravo !!!

Comment on lines +75 to +78
/**
* Some blocks, like "Repetir" need to be attached to a math_number block on toolbox, that's why they have toolboxJSON property
*/
const blockTypeToToolboxBlock = (block: BlockType): any => block.toolboxJSON ? block.toolboxJSON : { kind: "block", type: block.id }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dónde encontraste esta data ????
Excelente !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En la documentación del toolbox hay un apartado de bloques predeterminados

@dlopezalvas dlopezalvas merged commit 25e6fe1 into develop Aug 21, 2024
10 checks passed
@dlopezalvas dlopezalvas deleted the repeat-blocks branch August 21, 2024 17:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants