Browse files

fix button lineHeight

  • Loading branch information...
1 parent a88c7cd commit 34cfa1650f60174ab05818b72d88d1bb3523eafc @maccman committed Apr 29, 2012
View
9 assets/javascripts/app/controllers/elements/button.module.coffee
@@ -3,11 +3,15 @@ Color = require('app/models/properties/color')
Background = require('app/models/properties/background')
class Button extends Element
- # Stub out unused methods
+ events:
+ 'resize.element': 'syncLineHeight'
+
defaults: ->
result =
width: 100
height: 40
+ textAlign: 'center'
+ lineHeight: 40
borderRadius: 5
borderWidth: 1
borderStyle: 'solid'
@@ -21,4 +25,7 @@ class Button extends Element
]
)]
+ syncLineHeight: ->
+ @set(lineHeight: @get('height'))
+
module.exports = Button
View
3 assets/javascripts/lib/jquery/ext.coffee
@@ -0,0 +1,3 @@
+# We want 'px' to be added to lineHeight,
+# for example in properties/button.module
+delete jQuery.cssNumber.lineHeight
View
12 public/assets/app/controllers/elements/button.module.js
@@ -79,11 +79,17 @@ this.require.define({"app/controllers/elements/button":function(exports, require
return Button.__super__.constructor.apply(this, arguments);
}
+ Button.prototype.events = {
+ 'resize.element': 'syncLineHeight'
+ };
+
Button.prototype.defaults = function() {
var result;
return result = {
width: 100,
height: 40,
+ textAlign: 'center',
+ lineHeight: 40,
borderRadius: 5,
borderWidth: 1,
borderStyle: 'solid',
@@ -92,6 +98,12 @@ this.require.define({"app/controllers/elements/button":function(exports, require
};
};
+ Button.prototype.syncLineHeight = function() {
+ return this.set({
+ lineHeight: this.get('height')
+ });
+ };
+
return Button;
})(Element);
View
17 public/assets/application.js
@@ -12174,6 +12174,11 @@ this.require.define({"lib/gradient_picker":function(exports, require, module){(f
}).call(this);
;}});
+(function() {
+
+ delete jQuery.cssNumber.lineHeight;
+
+}).call(this);
this.require.define({"lib/popup":function(exports, require, module){(function() {
var Popup,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
@@ -12846,11 +12851,17 @@ this.require.define({"app/controllers/elements/button":function(exports, require
return Button.__super__.constructor.apply(this, arguments);
}
+ Button.prototype.events = {
+ 'resize.element': 'syncLineHeight'
+ };
+
Button.prototype.defaults = function() {
var result;
return result = {
width: 100,
height: 40,
+ textAlign: 'center',
+ lineHeight: 40,
borderRadius: 5,
borderWidth: 1,
borderStyle: 'solid',
@@ -12859,6 +12870,12 @@ this.require.define({"app/controllers/elements/button":function(exports, require
};
};
+ Button.prototype.syncLineHeight = function() {
+ return this.set({
+ lineHeight: this.get('height')
+ });
+ };
+
return Button;
})(Element);

0 comments on commit 34cfa16

Please sign in to comment.