various typing fixes
This commit is contained in:
parent
e6cf490be2
commit
f76a407027
@ -152,9 +152,10 @@ export class FieldBrickButtons extends Blockly.FieldDropdown implements Blockly.
|
||||
* Callback for when the drop-down is hidden.
|
||||
*/
|
||||
private onHide_ = function () {
|
||||
Blockly.DropDownDiv.content_.removeAttribute('role');
|
||||
Blockly.DropDownDiv.content_.removeAttribute('aria-haspopup');
|
||||
Blockly.DropDownDiv.content_.removeAttribute('aria-activedescendant');
|
||||
Blockly.DropDownDiv.getContentDiv().style.width = '';
|
||||
const content = Blockly.DropDownDiv.getContentDiv();
|
||||
content.removeAttribute('role');
|
||||
content.removeAttribute('aria-haspopup');
|
||||
content.removeAttribute('aria-activedescendant');
|
||||
content.style.width = '';
|
||||
};
|
||||
}
|
@ -53,7 +53,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
this.arrow_.setAttributeNS('http://www.w3.org/1999/xlink',
|
||||
'xlink:href', (Blockly.FieldDropdown as any).DROPDOWN_SVG_DATAURI);
|
||||
|
||||
this.arrow2_ = Blockly.utils.createSvgElement('image', {
|
||||
this.arrow2_ = <SVGImageElement>Blockly.utils.createSvgElement('image', {
|
||||
'height': (this as any).arrowSize_ + 'px',
|
||||
'width': (this as any).arrowSize_ + 'px'
|
||||
});
|
||||
@ -79,7 +79,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
},
|
||||
this.fieldGroup_);
|
||||
fieldX += 10; // size of first group.
|
||||
this.textElement2_ = Blockly.utils.createSvgElement('text',
|
||||
this.textElement2_ = <SVGTextElement>Blockly.utils.createSvgElement('text',
|
||||
{
|
||||
'class': (this as any).className_,
|
||||
'x': fieldX,
|
||||
@ -89,7 +89,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
this.fieldGroup_);
|
||||
|
||||
this.updateEditable();
|
||||
this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
|
||||
(this.sourceBlock_ as Blockly.BlockSvg).getSvgRoot().appendChild(this.fieldGroup_);
|
||||
// Force a render.
|
||||
this.render_();
|
||||
this.size_.width = 0;
|
||||
@ -99,7 +99,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
|
||||
// Add second dropdown
|
||||
if (this.shouldShowRect_()) {
|
||||
this.box_ = Blockly.utils.createSvgElement('rect', {
|
||||
this.box_ = <SVGRectElement>Blockly.utils.createSvgElement('rect', {
|
||||
'rx': (Blockly.BlockSvg as any).CORNER_RADIUS,
|
||||
'ry': (Blockly.BlockSvg as any).CORNER_RADIUS,
|
||||
'x': 0,
|
||||
@ -112,7 +112,7 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
'fill-opacity': 1
|
||||
}, null);
|
||||
this.fieldGroup_.insertBefore(this.box_, this.textElement_);
|
||||
this.box2_ = Blockly.utils.createSvgElement('rect', {
|
||||
this.box2_ = <SVGRectElement>Blockly.utils.createSvgElement('rect', {
|
||||
'rx': (Blockly.BlockSvg as any).CORNER_RADIUS,
|
||||
'ry': (Blockly.BlockSvg as any).CORNER_RADIUS,
|
||||
'x': 0,
|
||||
@ -233,8 +233,8 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
if (this.textElement2_) {
|
||||
this.textElement2_.parentNode.appendChild(this.arrow2_);
|
||||
}
|
||||
if (this.sourceBlock_ && this.sourceBlock_.rendered) {
|
||||
this.sourceBlock_.render();
|
||||
if (this.sourceBlock_ && (<Blockly.BlockSvg>this.sourceBlock_).rendered) {
|
||||
(<Blockly.BlockSvg>this.sourceBlock_).render();
|
||||
this.sourceBlock_.bumpNeighbours_();
|
||||
}
|
||||
}
|
||||
@ -311,12 +311,12 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
|
||||
// First dropdown
|
||||
// Use one of the following options, medium motor, large motor or large motors (translated)
|
||||
const textNode1 = document.createTextNode(this.getFirstValueI11n(this.value_));
|
||||
const textNode1 = document.createTextNode(this.getFirstValueI11n(<string>this.value_));
|
||||
this.textElement_.appendChild(textNode1);
|
||||
|
||||
// Second dropdown, no need to translate. Only port numbers
|
||||
if (this.textElement2_) {
|
||||
const textNode2 = document.createTextNode(this.getSecondValue(this.value_));
|
||||
const textNode2 = document.createTextNode(this.getSecondValue(<string>this.value_));
|
||||
this.textElement2_.appendChild(textNode2);
|
||||
}
|
||||
this.updateWidth();
|
||||
@ -433,8 +433,8 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
vals[text] = value;
|
||||
}
|
||||
|
||||
const currentFirst = this.getFirstValue(this.value_);
|
||||
const currentSecond = this.getSecondValue(this.value_);
|
||||
const currentFirst = this.getFirstValue(<string>this.value_);
|
||||
const currentSecond = this.getSecondValue(<string>this.value_);
|
||||
|
||||
if (!this.isFirst_) {
|
||||
options = opts[currentFirst];
|
||||
@ -561,10 +561,11 @@ export class FieldMotors extends Blockly.FieldDropdown implements Blockly.FieldC
|
||||
* Callback for when the drop-down is hidden.
|
||||
*/
|
||||
protected onHide_() {
|
||||
Blockly.DropDownDiv.content_.removeAttribute('role');
|
||||
Blockly.DropDownDiv.content_.removeAttribute('aria-haspopup');
|
||||
Blockly.DropDownDiv.content_.removeAttribute('aria-activedescendant');
|
||||
Blockly.DropDownDiv.getContentDiv().style.width = '';
|
||||
const content = Blockly.DropDownDiv.getContentDiv();
|
||||
content.removeAttribute('role');
|
||||
content.removeAttribute('aria-haspopup');
|
||||
content.removeAttribute('aria-activedescendant');
|
||||
content.style.width = '';
|
||||
if (this.isFirst_ && this.box_) {
|
||||
this.box_.setAttribute('fill', this.sourceBlock_.getColour());
|
||||
} else if (!this.isFirst_ && this.box2_) {
|
||||
|
Loading…
Reference in New Issue
Block a user