mirror of
https://github.com/konvajs/konva.git
synced 2025-12-05 03:24:23 +08:00
Kinetic.Line detection type is now defaulted to pixel since this is the expected detection strategy
This commit is contained in:
@@ -11,7 +11,8 @@ Kinetic.Line = function(config) {
|
||||
this.setDefaultAttrs({
|
||||
points: [],
|
||||
lineCap: 'butt',
|
||||
dashArray: []
|
||||
dashArray: [],
|
||||
detectionType: 'pixel'
|
||||
});
|
||||
|
||||
this.shapeType = "Line";
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user