From 466115d52bcf46c49f2839c34fb78103e9855af5 Mon Sep 17 00:00:00 2001 From: carlosperate Date: Fri, 21 Aug 2015 20:51:35 +0100 Subject: [PATCH] Revert DOM injection order of the zoom control images. --- core/zoom_controls.js | 47 ++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/core/zoom_controls.js b/core/zoom_controls.js index a788d55bb..5e5077379 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -95,38 +95,40 @@ Blockly.ZoomControls.prototype.createDom = function() { var workspace = this.workspace_; /* Here's the markup that will be generated: - - - - - clip-path="url(#blocklyZoomresetClipPath837493)"> - - - - - clip-path="url(#blocklyZoominClipPath837493)"> clip-path="url(#blocklyZoomoutClipPath837493)"> + + + + + clip-path="url(#blocklyZoominClipPath837493)"> + + + + + clip-path="url(#blocklyZoomresetClipPath837493)"> */ this.svgGroup_ = Blockly.createSvgElement('g', {'class': 'blocklyZoom'}, null); var rnd = String(Math.random()).substring(2); + var clip = Blockly.createSvgElement('clipPath', - {'id': 'blocklyZoomresetClipPath' + rnd}, + {'id': 'blocklyZoomoutClipPath' + rnd}, this.svgGroup_); Blockly.createSvgElement('rect', - {'width': 32, 'height': 32}, + {'width': 32, 'height': 32, 'y': 77}, clip); - var zoomresetSvg = Blockly.createSvgElement('image', + var zoomoutSvg = Blockly.createSvgElement('image', {'width': Blockly.SPRITE.width, - 'height': Blockly.SPRITE.height, 'y': -92, - 'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')'}, + 'height': Blockly.SPRITE.height, 'x': -64, + 'y': -15, + 'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')'}, this.svgGroup_); - zoomresetSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', + zoomoutSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', workspace.options.pathToMedia + Blockly.SPRITE.url); var clip = Blockly.createSvgElement('clipPath', @@ -146,18 +148,17 @@ Blockly.ZoomControls.prototype.createDom = function() { workspace.options.pathToMedia + Blockly.SPRITE.url); var clip = Blockly.createSvgElement('clipPath', - {'id': 'blocklyZoomoutClipPath' + rnd}, + {'id': 'blocklyZoomresetClipPath' + rnd}, this.svgGroup_); Blockly.createSvgElement('rect', - {'width': 32, 'height': 32, 'y': 77}, + {'width': 32, 'height': 32}, clip); - var zoomoutSvg = Blockly.createSvgElement('image', + var zoomresetSvg = Blockly.createSvgElement('image', {'width': Blockly.SPRITE.width, - 'height': Blockly.SPRITE.height, 'x': -64, - 'y': -15, - 'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')'}, + 'height': Blockly.SPRITE.height, 'y': -92, + 'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')'}, this.svgGroup_); - zoomoutSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', + zoomresetSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', workspace.options.pathToMedia + Blockly.SPRITE.url); // Attach event listeners.