Commit 466115d5 authored by carlosperate's avatar carlosperate

Revert DOM injection order of the zoom control images.

parent fe12aeee
...@@ -95,38 +95,40 @@ Blockly.ZoomControls.prototype.createDom = function() { ...@@ -95,38 +95,40 @@ Blockly.ZoomControls.prototype.createDom = function() {
var workspace = this.workspace_; var workspace = this.workspace_;
/* Here's the markup that will be generated: /* Here's the markup that will be generated:
<g class="blocklyZoom"> <g class="blocklyZoom">
<clippath id="blocklyZoomresetClipPath837493"> <clippath id="blocklyZoomoutClipPath837493">
<rect width="32" height="32"></rect> <rect width="32" height="32" y="77"></rect>
</clippath> </clippath>
<image width="96" height="124" y="-92" xlink:href="media/sprites.png"> <image width="96" height="124" x="-64" y="-15" xlink:href="media/sprites.png">
clip-path="url(#blocklyZoomresetClipPath837493)"></image> clip-path="url(#blocklyZoomoutClipPath837493)"></image>
<clippath id="blocklyZoominClipPath837493"> <clippath id="blocklyZoominClipPath837493">
<rect width="32" height="32" y="43"></rect> <rect width="32" height="32" y="43"></rect>
</clippath> </clippath>
<image width="96" height="124" x="-32" y="-49" xlink:href="media/sprites.png"> <image width="96" height="124" x="-32" y="-49" xlink:href="media/sprites.png">
clip-path="url(#blocklyZoominClipPath837493)"></image> clip-path="url(#blocklyZoominClipPath837493)"></image>
<clippath id="blocklyZoomoutClipPath837493"> <clippath id="blocklyZoomresetClipPath837493">
<rect width="32" height="32" y="77"></rect> <rect width="32" height="32"></rect>
</clippath> </clippath>
<image width="96" height="124" x="-64" y="-15" xlink:href="media/sprites.png"> <image width="96" height="124" y="-92" xlink:href="media/sprites.png">
clip-path="url(#blocklyZoomoutClipPath837493)"></image> clip-path="url(#blocklyZoomresetClipPath837493)"></image>
</g> </g>
*/ */
this.svgGroup_ = Blockly.createSvgElement('g', this.svgGroup_ = Blockly.createSvgElement('g',
{'class': 'blocklyZoom'}, null); {'class': 'blocklyZoom'}, null);
var rnd = String(Math.random()).substring(2); var rnd = String(Math.random()).substring(2);
var clip = Blockly.createSvgElement('clipPath', var clip = Blockly.createSvgElement('clipPath',
{'id': 'blocklyZoomresetClipPath' + rnd}, {'id': 'blocklyZoomoutClipPath' + rnd},
this.svgGroup_); this.svgGroup_);
Blockly.createSvgElement('rect', Blockly.createSvgElement('rect',
{'width': 32, 'height': 32}, {'width': 32, 'height': 32, 'y': 77},
clip); clip);
var zoomresetSvg = Blockly.createSvgElement('image', var zoomoutSvg = Blockly.createSvgElement('image',
{'width': Blockly.SPRITE.width, {'width': Blockly.SPRITE.width,
'height': Blockly.SPRITE.height, 'y': -92, 'height': Blockly.SPRITE.height, 'x': -64,
'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')'}, 'y': -15,
'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')'},
this.svgGroup_); 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); workspace.options.pathToMedia + Blockly.SPRITE.url);
var clip = Blockly.createSvgElement('clipPath', var clip = Blockly.createSvgElement('clipPath',
...@@ -146,18 +148,17 @@ Blockly.ZoomControls.prototype.createDom = function() { ...@@ -146,18 +148,17 @@ Blockly.ZoomControls.prototype.createDom = function() {
workspace.options.pathToMedia + Blockly.SPRITE.url); workspace.options.pathToMedia + Blockly.SPRITE.url);
var clip = Blockly.createSvgElement('clipPath', var clip = Blockly.createSvgElement('clipPath',
{'id': 'blocklyZoomoutClipPath' + rnd}, {'id': 'blocklyZoomresetClipPath' + rnd},
this.svgGroup_); this.svgGroup_);
Blockly.createSvgElement('rect', Blockly.createSvgElement('rect',
{'width': 32, 'height': 32, 'y': 77}, {'width': 32, 'height': 32},
clip); clip);
var zoomoutSvg = Blockly.createSvgElement('image', var zoomresetSvg = Blockly.createSvgElement('image',
{'width': Blockly.SPRITE.width, {'width': Blockly.SPRITE.width,
'height': Blockly.SPRITE.height, 'x': -64, 'height': Blockly.SPRITE.height, 'y': -92,
'y': -15, 'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')'},
'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')'},
this.svgGroup_); 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); workspace.options.pathToMedia + Blockly.SPRITE.url);
// Attach event listeners. // Attach event listeners.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment