mirror of
https://github.com/google/blockly.git
synced 2026-01-18 22:37:09 +01:00
Fix cursor svg to work with new rendering (#2856)
This commit is contained in:
@@ -88,13 +88,6 @@ Blockly.BlockSvg.TAB_WIDTH = 8;
|
||||
* @const
|
||||
*/
|
||||
Blockly.BlockSvg.START_HAT = false;
|
||||
/**
|
||||
* SVG path for drawing a horizontal puzzle tab from top to bottom.
|
||||
* @const
|
||||
*/
|
||||
Blockly.BlockSvg.TAB_PATH_DOWN = 'v 5 c 0,10 -' + Blockly.BlockSvg.TAB_WIDTH +
|
||||
',-8 -' + Blockly.BlockSvg.TAB_WIDTH + ',7.5 s ' +
|
||||
Blockly.BlockSvg.TAB_WIDTH + ',-2.5 ' + Blockly.BlockSvg.TAB_WIDTH + ',7.5';
|
||||
|
||||
/**
|
||||
* Returns a bounding box describing the dimensions of this block
|
||||
|
||||
@@ -191,6 +191,9 @@ Blockly.CursorSvg.prototype.showWithInputOutput_ = function() {
|
||||
var connection = /** @type {Blockly.Connection} */
|
||||
(this.getCurNode().getLocation());
|
||||
this.currentCursorSvg = this.cursorInputOutput_;
|
||||
var path = Blockly.utils.svgPaths.moveTo(0,0) +
|
||||
Blockly.blockRendering.constants.PUZZLE_TAB.pathDown;
|
||||
this.cursorInputOutput_.setAttribute('d', path);
|
||||
this.setParent_(connection.getSourceBlock().getSvgRoot());
|
||||
this.positionInputOutput_(connection);
|
||||
this.showCurrent_();
|
||||
@@ -261,11 +264,6 @@ Blockly.CursorSvg.prototype.showWithStack_ = function() {
|
||||
var x = -1 * Blockly.CursorSvg.STACK_PADDING / 2;
|
||||
var y = -1 * Blockly.CursorSvg.STACK_PADDING / 2;
|
||||
|
||||
// If the block has an output connection it needs more padding.
|
||||
if (block.outputConnection) {
|
||||
x -= Blockly.BlockSvg.TAB_WIDTH;
|
||||
}
|
||||
|
||||
this.currentCursorSvg = this.cursorSvgRect_;
|
||||
this.setParent_(block.getSvgRoot());
|
||||
|
||||
@@ -416,7 +414,6 @@ Blockly.CursorSvg.prototype.createCursorSvg_ = function() {
|
||||
{
|
||||
'width': Blockly.CursorSvg.CURSOR_WIDTH,
|
||||
'height': Blockly.CursorSvg.CURSOR_HEIGHT,
|
||||
'd': 'm 0,0 ' + Blockly.BlockSvg.TAB_PATH_DOWN + ' v 5',
|
||||
'transform':'',
|
||||
'style':'display: none;',
|
||||
'fill': colour
|
||||
|
||||
@@ -66,7 +66,6 @@ function addPathAt(path, x, y) {
|
||||
|
||||
function start() {
|
||||
svgSpace = document.getElementById('workspace');
|
||||
addPathAt(Blockly.BlockSvg.TAB_PATH_DOWN, 0, 0);
|
||||
addPathAt(Blockly.BlockSvg.START_HAT_PATH, 0, 40);
|
||||
addPathAt(Blockly.BlockSvg.NOTCH_PATH_LEFT, 0, 60);
|
||||
addPathAt(Blockly.BlockSvg.NOTCH_PATH_RIGHT, 0, 70);
|
||||
|
||||
Reference in New Issue
Block a user