Revert "Improve insertion markers"

This commit is contained in:
DD Liu 2017-11-01 14:30:13 -04:00 committed by GitHub
parent 6ae469cd0a
commit b01dcafcf8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 47 deletions

View file

@ -714,21 +714,6 @@ Blockly.BlockSvg.prototype.renderFields_ =
}
}
if (this.isInsertionMarker() && !this.getFirstStatementConnection()) {
var connection = this.workspace.currentGesture_.blockDragger_.draggedConnectionManager_.closestConnection_;
var connectionY = connection.y_;
var dragBlock = this.workspace.currentGesture_.targetBlock_;
var dragY = dragBlock.getRelativeToSurfaceXY().y;
if (connection.sourceBlock_.previousConnection === connection) {
dragY += dragBlock.height;
}
var distance = connectionY - dragY;
// 0% = touching, 100% = 3/4 block height away
var fraction = Math.min(1, Math.abs(distance / dragBlock.height * 4 / 3));
// Eyes are opaque 1/2 of the time and fading 1/2 the time
var totalOpacity = fraction < .5 ? 1 : 1 - (fraction - .5) * 2;
// Body is fading 1/2 the time and not visible 1/2 the time
var outlineOpacity = fraction > .5 ? 0 : .75 - (fraction * 3 / 2);
// add ghost eyes
if (!Blockly.insertionMarkerGhostEyes) {
var group = Blockly.utils.createSvgElement('g', {}, null);
@ -751,8 +736,6 @@ Blockly.BlockSvg.prototype.renderFields_ =
newRoot.setAttribute('transform',
'translate(' + cursorX + ', ' + cursorY + ') ' + scale
);
newRoot.children[4].setAttribute('opacity', outlineOpacity);
newRoot.setAttribute('opacity', totalOpacity);
}
return this.RTL ? -cursorX : cursorX;
}; /* eslint-enable indent */

View file

@ -234,7 +234,6 @@ Blockly.InsertionMarkerManager.prototype.update = function(dxy, deleteArea) {
this.maybeShowPreview_(candidate);
Blockly.Events.enable();
}
this.maybeUpdatePreviewGhost_(candidate);
};
/**** Begin initialization functions ****/
@ -661,33 +660,4 @@ Blockly.InsertionMarkerManager.prototype.connectMarker_ = function() {
this.markerConnection_ = imConn;
};
Blockly.InsertionMarkerManager.prototype.maybeUpdatePreviewGhost_ = function(candidate) {
// Nope, don't add a marker.
if (this.wouldDeleteBlock_) {
return;
}
var closest = candidate.closest;
var local = candidate.local;
// Nothing to connect to.
if (!closest) {
return;
}
// A drop-in block does not drop a shadow
if (this.shouldReplace_()) {
return;
}
// Something went wrong and we're trying to connect to an invalid connection.
if (closest.sourceBlock_.isInsertionMarker()) {
return;
}
var isLastInStack = this.lastOnStack_ && local == this.lastOnStack_;
var imBlock = isLastInStack ? this.lastMarker_ : this.firstMarker_;
imBlock.render();
};
/**** End insertion marker display functions ****/