Fixed container change for a stage. fix #510

This commit is contained in:
Anton Lavrenov
2019-02-19 20:43:06 -05:00
parent 0ae1f66b60
commit c4f21b67a3
6 changed files with 60 additions and 16 deletions

View File

@@ -597,8 +597,6 @@ export class SceneContext extends Context {
this.setAttr('shadowColor', 'rgba(0,0,0,0)');
}
// TODO - do we need to make like a fill function?
var hasLinearGradient = shape.getStrokeLinearGradientColorStops();
if (hasLinearGradient) {
this._strokeLinearGradient(shape);

View File

@@ -152,6 +152,10 @@ export class Stage extends Container {
}
}
this._setAttr(CONTAINER, container);
if (this.content) {
this.content.parentElement.removeChild(this.content);
container.appendChild(this.content);
}
return this;
}
shouldDrawHit() {
@@ -448,13 +452,11 @@ export class Stage extends Container {
// content event
this._fire(CONTENT_MOUSEDOWN, { evt: evt });
// always call preventDefault for desktop events because some browsers
// try to drag and drop the canvas element
// TODO: if we preventDefault() it will cancel event detection outside of window inside iframe
// but we need it for better drag&drop
// can we disable native drag&drop somehow differently?
// Do not prevent default behavior, because it will prevent listening events outside of window iframe
// we used preventDefault for disabling native drag&drop
// but userSelect = none style will do the trick
// if (evt.cancelable) {
// evt.preventDefault();
// evt.preventDefault();
// }
}
_mouseup(evt) {