Kinetic.Line detection type is now defaulted to pixel since this is the expected detection strategy

This commit is contained in:
Eric Rowell
2012-05-12 15:45:04 -07:00
parent 51258531bf
commit 502115fad7
5 changed files with 30 additions and 48 deletions

View File

@@ -11,7 +11,8 @@ Kinetic.Line = function(config) {
this.setDefaultAttrs({
points: [],
lineCap: 'butt',
dashArray: []
dashArray: [],
detectionType: 'pixel'
});
this.shapeType = "Line";

View File

@@ -234,17 +234,17 @@ Kinetic.Text.prototype = {
*/
getTextSize: function() {
var context = this.getContext();
/**
* if the text hasn't been added a layer yet there
* will be no associated context. Will have to create
* a dummy context
*/
if (!context) {
var dummyCanvas = document.createElement('canvas');
context = dummyCanvas.getContext('2d');
if(!context) {
var dummyCanvas = document.createElement('canvas');
context = dummyCanvas.getContext('2d');
}
context.save();
context.font = this.attrs.fontStyle + ' ' + this.attrs.fontSize + 'pt ' + this.attrs.fontFamily;
var metrics = context.measureText(this.attrs.text);