mirror of
https://github.com/konvajs/konva.git
synced 2026-03-03 16:58:33 +08:00
clipping regions now work correctly when device pixel ratio != 1
This commit is contained in:
@@ -46,6 +46,12 @@
|
||||
this.context = this.element.getContext(contextType);
|
||||
this.setSize(width, height);
|
||||
},
|
||||
/**
|
||||
* reset canvas context transform
|
||||
*/
|
||||
reset: function() {
|
||||
this.getContext().setTransform(1 * _pixelRatio, 0, 0, 1 * _pixelRatio, 0, 0);
|
||||
},
|
||||
/**
|
||||
* get canvas element
|
||||
* @method
|
||||
@@ -241,7 +247,9 @@
|
||||
context.beginPath();
|
||||
context.rect(clipX, clipY, clipWidth, clipHeight);
|
||||
context.clip();
|
||||
context.setTransform(1, 0, 0, 1, 0, 0);
|
||||
this.reset();
|
||||
container._drawChildren(this);
|
||||
context.restore();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user