From 56d5f166de1adce68513b4fdaf8b62d89ce6ab07 Mon Sep 17 00:00:00 2001 From: Mehdi Yeganeh Date: Sat, 8 Dec 2018 16:16:59 +0330 Subject: [PATCH 1/2] #172, Fixed [Edge, IE] Zoom control mouseover is not clipped --- core/css.js | 6 ++-- core/zoom_controls.js | 66 +++++++++++++++++++++++++++++-------------- 2 files changed, 48 insertions(+), 24 deletions(-) diff --git a/core/css.js b/core/css.js index 0043be9f3..94a75f723 100644 --- a/core/css.js +++ b/core/css.js @@ -531,15 +531,15 @@ Blockly.Css.CONTENT = [ 'fill: #bbb;', '}', - '.blocklyZoom>image {', + '.blocklyZoom>image, .blocklyZoom>svg>image {', 'opacity: .4;', '}', - '.blocklyZoom>image:hover {', + '.blocklyZoom>image:hover, .blocklyZoom>svg>image:hover {', 'opacity: .6;', '}', - '.blocklyZoom>image:active {', + '.blocklyZoom>image:active, .blocklyZoom>svg>image:active {', 'opacity: .8;', '}', diff --git a/core/zoom_controls.js b/core/zoom_controls.js index 09ffe934c..b06c24e32 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -171,18 +171,27 @@ Blockly.ZoomControls.prototype.position = function() { */ Blockly.ZoomControls.prototype.createZoomOutSvg_ = function(rnd) { /* This markup will be generated and added to the "blocklyZoom" group: - - - - + + + + + + */ var ws = this.workspace_; + + var svgHolder = Blockly.utils.createSvgElement('svg', + { + "id": "svg" + rnd + }, + this.svgGroup_); + var clip = Blockly.utils.createSvgElement('clipPath', { 'id': 'blocklyZoomoutClipPath' + rnd }, - this.svgGroup_); + svgHolder); Blockly.utils.createSvgElement('rect', { 'width': 32, @@ -197,7 +206,7 @@ Blockly.ZoomControls.prototype.createZoomOutSvg_ = function(rnd) { 'y': -15, 'clip-path': 'url(#blocklyZoomoutClipPath' + rnd + ')' }, - this.svgGroup_); + svgHolder); zoomoutSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', ws.options.pathToMedia + Blockly.SPRITE.url); @@ -220,18 +229,26 @@ Blockly.ZoomControls.prototype.createZoomOutSvg_ = function(rnd) { */ Blockly.ZoomControls.prototype.createZoomInSvg_ = function(rnd) { /* This markup will be generated and added to the "blocklyZoom" group: - - - - + + + + + + */ + var ws = this.workspace_; + var svgHolder = Blockly.utils.createSvgElement('svg', + { + 'y': 0 + }, + this.svgGroup_); var clip = Blockly.utils.createSvgElement('clipPath', { 'id': 'blocklyZoominClipPath' + rnd }, - this.svgGroup_); + svgHolder); Blockly.utils.createSvgElement('rect', { 'width': 32, @@ -247,7 +264,7 @@ Blockly.ZoomControls.prototype.createZoomInSvg_ = function(rnd) { 'y': -49, 'clip-path': 'url(#blocklyZoominClipPath' + rnd + ')' }, - this.svgGroup_); + svgHolder); zoominSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', ws.options.pathToMedia + Blockly.SPRITE.url); @@ -270,18 +287,25 @@ Blockly.ZoomControls.prototype.createZoomInSvg_ = function(rnd) { */ Blockly.ZoomControls.prototype.createZoomResetSvg_ = function(rnd) { /* This markup will be generated and added to the "blocklyZoom" group: - - - - + + + + + + */ var ws = this.workspace_; + var svgHolder = Blockly.utils.createSvgElement('svg', + { + "id": "svg" + rnd + }, + this.svgGroup_); var clip = Blockly.utils.createSvgElement('clipPath', { 'id': 'blocklyZoomresetClipPath' + rnd }, - this.svgGroup_); + svgHolder); Blockly.utils.createSvgElement('rect', { 'width': 32, @@ -294,7 +318,7 @@ Blockly.ZoomControls.prototype.createZoomResetSvg_ = function(rnd) { 'height': Blockly.SPRITE.height, 'y': -92, 'clip-path': 'url(#blocklyZoomresetClipPath' + rnd + ')' }, - this.svgGroup_); + svgHolder); zoomresetSvg.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', ws.options.pathToMedia + Blockly.SPRITE.url); From fc47878f2af0a7fddc1571a5876b0fd9ab723ab9 Mon Sep 17 00:00:00 2001 From: Mehdi Yeganeh Date: Sat, 8 Dec 2018 16:37:03 +0330 Subject: [PATCH 2/2] #172, Fixed [Edge, IE] Zoom control mouseover is not clipped --- core/zoom_controls.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/zoom_controls.js b/core/zoom_controls.js index b06c24e32..3c8dd8a52 100644 --- a/core/zoom_controls.js +++ b/core/zoom_controls.js @@ -241,7 +241,7 @@ Blockly.ZoomControls.prototype.createZoomInSvg_ = function(rnd) { var ws = this.workspace_; var svgHolder = Blockly.utils.createSvgElement('svg', { - 'y': 0 + "id": "svg" + rnd }, this.svgGroup_); var clip = Blockly.utils.createSvgElement('clipPath',