Closed nameszian closed 5 years ago
Like many people who use an event bus
in Vue.js
, it defines window.Event
, and it turns out that SVG.js
also uses window.Event
, so the Wrapper of the event bus must be renamed, e.g window.CustomEventBus = new Class ...
:
window.CustomEventBus = new class {
constructor() {
this.vue = new Vue();
}
commit(event, data = null) {
this.vue.$emit(event, data);
}
receive(event, callback) {
this.vue.$on(event, callback);
}
};
I will check in the next few days if this was really what caused the error, if so, I will close the issue.
window.Event
is only used when using the CustomEvent polyfill. It is a native object which should be never overwritten or changed from any library. If vue does, its not a problem with svg.js but with vue.js.
To your problem with the BLACK rectangle: There is a css file in svg.select.js and you need it!
it works, it's not about Vue.js
, it's about how people usually implement an event bus in Vue.js, as a habit. But the name of window.Event
is changed to any other (e.g. CustomEventBus
) in Vue project, Vue.js will work the same, and svg.js will not explode.
So everything is fine. Thanks.
Hello, I have installed
svg.js
andsvg.resize.js
/svg.select.js
usingnpm
, and when importing the libraries like this:Then I link
draw
with a div withid=drawing
, and I create a pink rectangle on the screen, and I make therect
object.selectize().resize();
. Up to this point everything is visually correct, the pink rectangle is on the screen (Really after adding selectize and resize it is black with the selection points in the corners):The following problem is printed by the console when you try to select / resize with selection points in the corners of the rectangle:
❓I have done something wrong?
It may be the same problem as in svg.draggable.js issue #98