mirror of
https://github.com/konvajs/konva.git
synced 2025-08-24 01:21:47 +08:00
fixed issue with stage panning. stage node type needs to be declared before calling super constructor
This commit is contained in:
parent
a8cbc2321d
commit
e13a0b5fd8
@ -215,7 +215,7 @@
|
|||||||
context = canvas.getContext(),
|
context = canvas.getContext(),
|
||||||
drawFunc = this.getDrawFunc(),
|
drawFunc = this.getDrawFunc(),
|
||||||
applyShadow = this.hasShadow() && this.getShadowEnabled(),
|
applyShadow = this.hasShadow() && this.getShadowEnabled(),
|
||||||
applyOpacity = this.getOpacity() !== 1,
|
applyOpacity = this.getAbsoluteOpacity() !== 1,
|
||||||
stage, bufferCanvas, bufferContext;
|
stage, bufferCanvas, bufferContext;
|
||||||
|
|
||||||
if(drawFunc && this.isVisible()) {
|
if(drawFunc && this.isVisible()) {
|
||||||
|
@ -55,9 +55,9 @@
|
|||||||
|
|
||||||
Kinetic.Util.addMethods(Kinetic.Stage, {
|
Kinetic.Util.addMethods(Kinetic.Stage, {
|
||||||
___init: function(config) {
|
___init: function(config) {
|
||||||
|
this.nodeType = STAGE;
|
||||||
// call super constructor
|
// call super constructor
|
||||||
Kinetic.Container.call(this, config);
|
Kinetic.Container.call(this, config);
|
||||||
this.nodeType = STAGE;
|
|
||||||
this._id = Kinetic.idCounter++;
|
this._id = Kinetic.idCounter++;
|
||||||
this._buildDOM();
|
this._buildDOM();
|
||||||
this._bindContentEvents();
|
this._bindContentEvents();
|
||||||
|
@ -399,9 +399,17 @@ suite('DragAndDropEvents', function() {
|
|||||||
|
|
||||||
// ======================================================
|
// ======================================================
|
||||||
test('drag and drop stage', function() {
|
test('drag and drop stage', function() {
|
||||||
var stage = addStage();
|
var container = document.createElement('div'),
|
||||||
|
stage = new Kinetic.Stage({
|
||||||
|
container: container,
|
||||||
|
width: 578,
|
||||||
|
height: 200,
|
||||||
|
draggable: true
|
||||||
|
});
|
||||||
|
|
||||||
stage.setDraggable(true);
|
kineticContainer.appendChild(container);
|
||||||
|
|
||||||
|
//stage.setDraggable(true);
|
||||||
|
|
||||||
var layer = new Kinetic.Layer();
|
var layer = new Kinetic.Layer();
|
||||||
|
|
||||||
@ -424,7 +432,7 @@ suite('DragAndDropEvents', function() {
|
|||||||
* simulate drag and drop
|
* simulate drag and drop
|
||||||
*/
|
*/
|
||||||
stage._mousedown({
|
stage._mousedown({
|
||||||
clientX: 100,
|
clientX: 0,
|
||||||
clientY: 100 + top
|
clientY: 100 + top
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -440,7 +448,7 @@ suite('DragAndDropEvents', function() {
|
|||||||
});
|
});
|
||||||
Kinetic.DD._endDragAfter();
|
Kinetic.DD._endDragAfter();
|
||||||
|
|
||||||
assert.equal(stage.getX(), 200);
|
assert.equal(stage.getX(), 300);
|
||||||
assert.equal(stage.getY(), 10);
|
assert.equal(stage.getY(), 10);
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user