TheMightyFingers / mightyeditor

http://mightyeditor.mightyfingers.com
Other
279 stars 62 forks source link

Error when trying to edit the userData of an object #57

Closed jfcisco closed 8 years ago

jfcisco commented 8 years ago

I got this error when I was following the Digger game tutorial of mightyeditor. This error was thrown when I try to edit the userData of an object: Uncaught TypeError: Cannot set property length of #<CSSStyleDeclaration> which has only a getter

The source of the error seems to be traced to line 85 of the file InputHelper.js

inheritStyle: function(){

            var bounds = this.el.getBoundingClientRect();
            var style = window.getComputedStyle(this.el);
            for(var i in style){
                this.input.style[i] = style[i]; // this is line 85 (comment made by me)
            }
            this.input.style.zIndex = 10000;
            this.input.style.position = "absolute";
            this.input.style.visibility = "visible";

            this.input.style.top = bounds.top + "px";
            this.input.style.left = bounds.left + "px";
            this.input.style.width = bounds.width + 1 + "px";
            this.input.style.height = bounds.height + 1 + "px";
            this.input.style.paddingBottom = "1px";
            this.input.style.paddingRight = "1px";

            //this.input.style.cssText = 
            //this.input.style. = el.style.fontSize;

        }
jfcisco commented 8 years ago

I changed the code in line 85 to this.input.style = style; and it seems to have solved the problem of the input.

jfcisco commented 8 years ago

I think you misspelled length in keys.length.

stauzs commented 8 years ago

You are right ;) fixed