Mr-Jpelaez / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

Blockly blocks are nor rendered correctly for IE and Android #162

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The blockly which I downloaded on August 4 works fine with IE and Android.
But the current version does not work for those browsers.

What steps will reproduce the problem?
1.Start http://blockly-demo.appspot.com/static/apps/code/index.html from IE
2.Try drag and drop blocks 
3.You will see something very strange.

What is the expected output? What do you see instead?
I am expecting the current version works as like the version which I downloaded 
on August 4.

What browser are you using?
IE and Android

Original issue reported on code.google.com by jungwon....@gmail.com on 3 Sep 2013 at 3:25

Attachments:

GoogleCodeExporter commented 8 years ago
Toby, can you take a look at this?  It looks like my recent refactoring broke 
the coordinate system.

Original comment by neil.fra...@gmail.com on 3 Sep 2013 at 6:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I'm currently having a similar problem. I have tested Blockly in Android 
Browser (Android 2.3.6) and Windows Phone but i doesn't work, in particular it 
doesn't render the left menubar (so i can't even see the blocks). Has anyone 
come out with a solution? Is there a version that actually works on Android 
Browser?

Original comment by andresne...@hotmail.com on 18 Sep 2013 at 5:37

GoogleCodeExporter commented 8 years ago
IE 10 fails with SCRIPT5022: NoModificationAllowedError

Original comment by luismarianoguerra@gmail.com on 24 Sep 2013 at 8:24

GoogleCodeExporter commented 8 years ago
the offending line is this one: 
http://code.google.com/p/blockly/source/browse/trunk/core/block.js#411

if commented it works on IE 10

Original comment by luismarianoguerra@gmail.com on 25 Sep 2013 at 10:27

GoogleCodeExporter commented 8 years ago
the standard says that you can't modify the attributes of a bbox

http://www.w3.org/TR/SVG/types.html#InterfaceSVGRect

Attributes:

    x (float)
        The x coordinate of the rectangle, in user units.

        Exceptions on setting

            DOMException, code NO_MODIFICATION_ALLOWED_ERR
                Raised when the rectangle corresponds to a read only attribute or when the object itself is read only. 

Original comment by luismarianoguerra@gmail.com on 25 Sep 2013 at 10:41

GoogleCodeExporter commented 8 years ago
this seems to fix it

$ svn diff core/block.js 
Index: core/block.js
===================================================================
--- core/block.js       (revision 1380)
+++ core/block.js       (working copy)
@@ -390,7 +390,8 @@
  */
 Blockly.Block.prototype.getHeightWidth = function() {
   try {
-    var bBox = this.getSvgRoot().getBBox();
+    var bBox = this.getSvgRoot().getBBox(),
+        height = bBox.height;
   } catch (e) {
     // Firefox has trouble with hidden elements (Bug 528969).
     return {height: 0, width: 0};
@@ -401,15 +402,15 @@
      bounding box.  The render functions (below) add two 5px spacer control
      points that we need to subtract.
     */
-    bBox.height -= 10;
+    height -= 10;
     if (this.nextConnection) {
       // Bottom control point partially masked by lower tab.
-      bBox.height += 4;
+      height += 4;
     }
   }
   // Subtract one from the height due to the shadow.
-  bBox.height -= 1;
-  return bBox;
+  height -= 1;
+  return {height: height, width: bBox.width};
 };

 /**

Original comment by luismarianoguerra@gmail.com on 25 Sep 2013 at 10:49

GoogleCodeExporter commented 8 years ago
Fixed in r1389.  Thanks for the patch!

Original comment by neil.fra...@gmail.com on 30 Sep 2013 at 10:16