mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
added getWidth() and getHeight() methods to Label
This commit is contained in:
@@ -37,13 +37,18 @@
|
||||
Kinetic.Group.call(this, config);
|
||||
this.setText(new Kinetic.Text(config.text));
|
||||
this.setRect(new Kinetic.Plugins.LabelRect(config.rect));
|
||||
this.getRect().text = this.getText();
|
||||
this.innerGroup.add(this.getRect());
|
||||
this.innerGroup.add(this.getText());
|
||||
this.add(this.innerGroup);
|
||||
|
||||
this._setGroupOffset();
|
||||
},
|
||||
getWidth: function() {
|
||||
return this.getText().getWidth();
|
||||
},
|
||||
getHeight: function() {
|
||||
return this.getText().getHeight();
|
||||
},
|
||||
_setGroupOffset: function() {
|
||||
var text = this.getText(),
|
||||
width = text.getWidth(),
|
||||
@@ -97,9 +102,10 @@
|
||||
this._setDrawFuncs();
|
||||
},
|
||||
drawFunc: function(canvas) {
|
||||
var context = canvas.getContext(),
|
||||
width = this.text.getWidth(),
|
||||
height = this.text.getHeight(),
|
||||
var label = this.getParent().getParent(),
|
||||
context = canvas.getContext(),
|
||||
width = label.getWidth(),
|
||||
height = label.getHeight(),
|
||||
pointerDirection = this.getPointerDirection(),
|
||||
pointerWidth = this.getPointerWidth(),
|
||||
pointerHeight = this.getPointerHeight(),
|
||||
|
@@ -1,5 +1,5 @@
|
||||
Test.Modules.LABEL = {
|
||||
'add label': function(containerId) {
|
||||
'*add label': function(containerId) {
|
||||
var stage = new Kinetic.Stage({
|
||||
container: containerId,
|
||||
width: 578,
|
||||
|
Reference in New Issue
Block a user