mirror of
https://github.com/google/blockly.git
synced 2026-01-10 18:37:09 +01:00
57 errors remaining
This commit is contained in:
@@ -142,11 +142,13 @@ Blockly.Field.prototype.init = function() {
|
||||
this.fieldGroup_.style.display = 'none';
|
||||
}
|
||||
this.borderRect_ = Blockly.utils.createSvgElement('rect',
|
||||
{'rx': 4,
|
||||
'ry': 4,
|
||||
'x': -Blockly.BlockSvg.SEP_SPACE_X / 2,
|
||||
'y': 0,
|
||||
'height': 16}, this.fieldGroup_);
|
||||
{
|
||||
'rx': 4,
|
||||
'ry': 4,
|
||||
'x': -Blockly.BlockSvg.SEP_SPACE_X / 2,
|
||||
'y': 0,
|
||||
'height': 16
|
||||
}, this.fieldGroup_);
|
||||
/** @type {!Element} */
|
||||
this.textElement_ = Blockly.utils.createSvgElement('text',
|
||||
{'class': 'blocklyText', 'y': this.size_.height - 12.5},
|
||||
@@ -156,7 +158,7 @@ Blockly.Field.prototype.init = function() {
|
||||
this.sourceBlock_.getSvgRoot().appendChild(this.fieldGroup_);
|
||||
this.mouseDownWrapper_ =
|
||||
Blockly.bindEventWithChecks_(this.fieldGroup_, 'mousedown', this,
|
||||
this.onMouseDown_);
|
||||
this.onMouseDown_);
|
||||
// Force a render.
|
||||
this.render_();
|
||||
};
|
||||
|
||||
@@ -560,8 +560,8 @@ Blockly.Gesture.prototype.handleRightClick = function(e) {
|
||||
*/
|
||||
Blockly.Gesture.prototype.handleWsStart = function(e, ws) {
|
||||
goog.asserts.assert(!this.hasStarted_,
|
||||
'Tried to call gesture.handleWsStart, but the gesture had already been ' +
|
||||
'started.');
|
||||
'Tried to call gesture.handleWsStart, but the gesture had already been ' +
|
||||
'started.');
|
||||
this.setStartWorkspace_(ws);
|
||||
this.mostRecentEvent_ = e;
|
||||
this.doStart(e);
|
||||
@@ -575,8 +575,8 @@ Blockly.Gesture.prototype.handleWsStart = function(e, ws) {
|
||||
*/
|
||||
Blockly.Gesture.prototype.handleFlyoutStart = function(e, flyout) {
|
||||
goog.asserts.assert(!this.hasStarted_,
|
||||
'Tried to call gesture.handleFlyoutStart, but the gesture had already been ' +
|
||||
'started.');
|
||||
'Tried to call gesture.handleFlyoutStart, but the gesture had already ' +
|
||||
'been started.');
|
||||
this.setStartFlyout_(flyout);
|
||||
this.handleWsStart(e, flyout.getWorkspace());
|
||||
};
|
||||
@@ -589,8 +589,8 @@ Blockly.Gesture.prototype.handleFlyoutStart = function(e, flyout) {
|
||||
*/
|
||||
Blockly.Gesture.prototype.handleBlockStart = function(e, block) {
|
||||
goog.asserts.assert(!this.hasStarted_,
|
||||
'Tried to call gesture.handleBlockStart, but the gesture had already been ' +
|
||||
'started.');
|
||||
'Tried to call gesture.handleBlockStart, but the gesture had already ' +
|
||||
'been started.');
|
||||
this.setStartBlock(block);
|
||||
this.mostRecentEvent_ = e;
|
||||
};
|
||||
@@ -665,8 +665,8 @@ Blockly.Gesture.prototype.bringBlockToFront_ = function() {
|
||||
*/
|
||||
Blockly.Gesture.prototype.setStartField = function(field) {
|
||||
goog.asserts.assert(!this.hasStarted_,
|
||||
'Tried to call gesture.setStartField, but the gesture had already been ' +
|
||||
'started.');
|
||||
'Tried to call gesture.setStartField, but the gesture had already been ' +
|
||||
'started.');
|
||||
if (!this.startField_) {
|
||||
this.startField_ = field;
|
||||
}
|
||||
|
||||
@@ -207,8 +207,10 @@ Blockly.Grid.createDom = function(rnd, gridOptions, defs) {
|
||||
</pattern>
|
||||
*/
|
||||
var gridPattern = Blockly.utils.createSvgElement('pattern',
|
||||
{'id': 'blocklyGridPattern' + rnd,
|
||||
'patternUnits': 'userSpaceOnUse'}, defs);
|
||||
{
|
||||
'id': 'blocklyGridPattern' + rnd,
|
||||
'patternUnits': 'userSpaceOnUse'
|
||||
}, defs);
|
||||
if (gridOptions['length'] > 0 && gridOptions['spacing'] > 0) {
|
||||
Blockly.utils.createSvgElement('line',
|
||||
{'stroke': gridOptions['colour']}, gridPattern);
|
||||
|
||||
@@ -80,7 +80,7 @@ Blockly.Icon.prototype.createIcon = function() {
|
||||
{'class': 'blocklyIconGroup'}, null);
|
||||
if (this.block_.isInFlyout) {
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.iconGroup_),
|
||||
'blocklyIconGroupReadonly');
|
||||
'blocklyIconGroupReadonly');
|
||||
}
|
||||
this.drawIcon_(this.iconGroup_);
|
||||
|
||||
|
||||
@@ -137,17 +137,34 @@ Blockly.createDom_ = function(container, options) {
|
||||
Blockly.utils.createSvgElement('feGaussianBlur',
|
||||
{'in': 'SourceAlpha', 'stdDeviation': 1, 'result': 'blur'}, embossFilter);
|
||||
var feSpecularLighting = Blockly.utils.createSvgElement('feSpecularLighting',
|
||||
{'in': 'blur', 'surfaceScale': 1, 'specularConstant': 0.5,
|
||||
'specularExponent': 10, 'lighting-color': 'white', 'result': 'specOut'},
|
||||
{
|
||||
'in': 'blur',
|
||||
'surfaceScale': 1,
|
||||
'specularConstant': 0.5,
|
||||
'specularExponent': 10,
|
||||
'lighting-color': 'white',
|
||||
'result': 'specOut'
|
||||
},
|
||||
embossFilter);
|
||||
Blockly.utils.createSvgElement('fePointLight',
|
||||
{'x': -5000, 'y': -10000, 'z': 20000}, feSpecularLighting);
|
||||
Blockly.utils.createSvgElement('feComposite',
|
||||
{'in': 'specOut', 'in2': 'SourceAlpha', 'operator': 'in',
|
||||
'result': 'specOut'}, embossFilter);
|
||||
{
|
||||
'in': 'specOut',
|
||||
'in2': 'SourceAlpha',
|
||||
'operator': 'in',
|
||||
'result': 'specOut'
|
||||
}, embossFilter);
|
||||
Blockly.utils.createSvgElement('feComposite',
|
||||
{'in': 'SourceGraphic', 'in2': 'specOut', 'operator': 'arithmetic',
|
||||
'k1': 0, 'k2': 1, 'k3': 1, 'k4': 0}, embossFilter);
|
||||
{
|
||||
'in': 'SourceGraphic',
|
||||
'in2': 'specOut',
|
||||
'operator': 'arithmetic',
|
||||
'k1': 0,
|
||||
'k2': 1,
|
||||
'k3': 1,
|
||||
'k4': 0
|
||||
}, embossFilter);
|
||||
options.embossFilterId = embossFilter.id;
|
||||
/*
|
||||
<pattern id="blocklyDisabledPattern837493" patternUnits="userSpaceOnUse"
|
||||
@@ -157,9 +174,12 @@ Blockly.createDom_ = function(container, options) {
|
||||
</pattern>
|
||||
*/
|
||||
var disabledPattern = Blockly.utils.createSvgElement('pattern',
|
||||
{'id': 'blocklyDisabledPattern' + rnd,
|
||||
'patternUnits': 'userSpaceOnUse',
|
||||
'width': 10, 'height': 10}, defs);
|
||||
{
|
||||
'id': 'blocklyDisabledPattern' + rnd,
|
||||
'patternUnits': 'userSpaceOnUse',
|
||||
'width': 10,
|
||||
'height': 10
|
||||
}, defs);
|
||||
Blockly.utils.createSvgElement('rect',
|
||||
{'width': 10, 'height': 10, 'fill': '#aaa'}, disabledPattern);
|
||||
Blockly.utils.createSvgElement('path',
|
||||
@@ -346,17 +366,23 @@ Blockly.inject.bindDocumentEvents_ = function() {
|
||||
Blockly.inject.loadSounds_ = function(pathToMedia, workspace) {
|
||||
var audioMgr = workspace.getAudioManager();
|
||||
audioMgr.load(
|
||||
[pathToMedia + 'click.mp3',
|
||||
pathToMedia + 'click.wav',
|
||||
pathToMedia + 'click.ogg'], 'click');
|
||||
[
|
||||
pathToMedia + 'click.mp3',
|
||||
pathToMedia + 'click.wav',
|
||||
pathToMedia + 'click.ogg'
|
||||
], 'click');
|
||||
audioMgr.load(
|
||||
[pathToMedia + 'disconnect.wav',
|
||||
pathToMedia + 'disconnect.mp3',
|
||||
pathToMedia + 'disconnect.ogg'], 'disconnect');
|
||||
[
|
||||
pathToMedia + 'disconnect.wav',
|
||||
pathToMedia + 'disconnect.mp3',
|
||||
pathToMedia + 'disconnect.ogg'
|
||||
], 'disconnect');
|
||||
audioMgr.load(
|
||||
[pathToMedia + 'delete.mp3',
|
||||
pathToMedia + 'delete.ogg',
|
||||
pathToMedia + 'delete.wav'], 'delete');
|
||||
[
|
||||
pathToMedia + 'delete.mp3',
|
||||
pathToMedia + 'delete.ogg',
|
||||
pathToMedia + 'delete.wav'
|
||||
], 'delete');
|
||||
|
||||
// Bind temporary hooks that preload the sounds.
|
||||
var soundBinds = [];
|
||||
|
||||
@@ -66,25 +66,30 @@ Blockly.Mutator.prototype.workspaceHeight_ = 0;
|
||||
Blockly.Mutator.prototype.drawIcon_ = function(group) {
|
||||
// Square with rounded corners.
|
||||
Blockly.utils.createSvgElement('rect',
|
||||
{'class': 'blocklyIconShape',
|
||||
'rx': '4', 'ry': '4',
|
||||
'height': '16', 'width': '16'},
|
||||
group);
|
||||
{
|
||||
'class': 'blocklyIconShape',
|
||||
'rx': '4',
|
||||
'ry': '4',
|
||||
'height': '16',
|
||||
'width': '16'
|
||||
},
|
||||
group);
|
||||
// Gear teeth.
|
||||
Blockly.utils.createSvgElement('path',
|
||||
{'class': 'blocklyIconSymbol',
|
||||
'd': 'm4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,' +
|
||||
'0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,' +
|
||||
'-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,' +
|
||||
'-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,' +
|
||||
'-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 ' +
|
||||
'-0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,' +
|
||||
'0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z'},
|
||||
group);
|
||||
{
|
||||
'class': 'blocklyIconSymbol',
|
||||
'd': 'm4.203,7.296 0,1.368 -0.92,0.677 -0.11,0.41 0.9,1.559 0.41,' +
|
||||
'0.11 1.043,-0.457 1.187,0.683 0.127,1.134 0.3,0.3 1.8,0 0.3,' +
|
||||
'-0.299 0.127,-1.138 1.185,-0.682 1.046,0.458 0.409,-0.11 0.9,' +
|
||||
'-1.559 -0.11,-0.41 -0.92,-0.677 0,-1.366 0.92,-0.677 0.11,' +
|
||||
'-0.41 -0.9,-1.559 -0.409,-0.109 -1.046,0.458 -1.185,-0.682 ' +
|
||||
'-0.127,-1.138 -0.3,-0.299 -1.8,0 -0.3,0.3 -0.126,1.135 -1.187,' +
|
||||
'0.682 -1.043,-0.457 -0.41,0.11 -0.899,1.559 0.108,0.409z'
|
||||
},
|
||||
group);
|
||||
// Axle hole.
|
||||
Blockly.utils.createSvgElement('circle',
|
||||
{'class': 'blocklyIconShape', 'r': '2.7', 'cx': '8', 'cy': '8'},
|
||||
group);
|
||||
{'class': 'blocklyIconShape', 'r': '2.7', 'cx': '8', 'cy': '8'}, group);
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -161,14 +166,14 @@ Blockly.Mutator.prototype.updateEditable = function() {
|
||||
if (this.block_.isEditable()) {
|
||||
if (this.iconGroup_) {
|
||||
Blockly.utils.removeClass(/** @type {!Element} */ (this.iconGroup_),
|
||||
'blocklyIconGroupReadonly');
|
||||
'blocklyIconGroupReadonly');
|
||||
}
|
||||
} else {
|
||||
// Close any mutator bubble. Icon is not clickable.
|
||||
this.setVisible(false);
|
||||
if (this.iconGroup_) {
|
||||
Blockly.utils.addClass(/** @type {!Element} */ (this.iconGroup_),
|
||||
'blocklyIconGroupReadonly');
|
||||
'blocklyIconGroupReadonly');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -204,7 +209,7 @@ Blockly.Mutator.prototype.resizeBubble_ = function() {
|
||||
this.workspaceHeight_ = height;
|
||||
// Resize the bubble.
|
||||
this.bubble_.setBubbleSize(width + doubleBorderWidth,
|
||||
height + doubleBorderWidth);
|
||||
height + doubleBorderWidth);
|
||||
this.svgDialog_.setAttribute('width', this.workspaceWidth_);
|
||||
this.svgDialog_.setAttribute('height', this.workspaceHeight_);
|
||||
}
|
||||
|
||||
@@ -206,10 +206,12 @@ Blockly.RenderedConnection.prototype.highlight = function() {
|
||||
var x = this.x_ - xy.x;
|
||||
var y = this.y_ - xy.y;
|
||||
Blockly.Connection.highlightedPath_ = Blockly.utils.createSvgElement('path',
|
||||
{'class': 'blocklyHighlightedConnectionPath',
|
||||
'd': steps,
|
||||
transform: 'translate(' + x + ',' + y + ')' +
|
||||
(this.sourceBlock_.RTL ? ' scale(-1 1)' : '')},
|
||||
{
|
||||
'class': 'blocklyHighlightedConnectionPath',
|
||||
'd': steps,
|
||||
transform: 'translate(' + x + ',' + y + ')' +
|
||||
(this.sourceBlock_.RTL ? ' scale(-1 1)' : '')
|
||||
},
|
||||
this.sourceBlock_.getSvgRoot());
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user