Skip to content

Commit

Permalink
fix: set some function to own attrs (#3726)
Browse files Browse the repository at this point in the history
* fix: set some function to own attrs

* chore: change dnd to deps for stencil plugin
  • Loading branch information
NewByVector authored Jul 3, 2023
1 parent 78f05b6 commit 37e8c22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
6 changes: 3 additions & 3 deletions packages/x6-common/src/dom/event/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export class EventObject<
}
}

preventDefault() {
preventDefault = () => {
const e = this.originalEvent

this.isDefaultPrevented = Util.returnTrue
Expand All @@ -72,7 +72,7 @@ export class EventObject<
}
}

stopPropagation() {
stopPropagation = () => {
const e = this.originalEvent

this.isPropagationStopped = Util.returnTrue
Expand All @@ -82,7 +82,7 @@ export class EventObject<
}
}

stopImmediatePropagation() {
stopImmediatePropagation = () => {
const e = this.originalEvent

this.isImmediatePropagationStopped = Util.returnTrue
Expand Down
6 changes: 4 additions & 2 deletions packages/x6-plugin-stencil/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@
"coveralls": "rss",
"pretest": "rss"
},
"peerDependencies": {
"@antv/x6": "^2.x",
"dependencies": {
"@antv/x6-plugin-dnd": "^2.x"
},
"peerDependencies": {
"@antv/x6": "^2.x"
},
"devDependencies": {
"@antv/x6": "^2.x",
"@antv/x6-plugin-dnd": "^2.0.x"
Expand Down
11 changes: 0 additions & 11 deletions packages/x6/src/view/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,24 +418,13 @@ export namespace View {
if (touchEvt) {
// eslint-disable-next-line no-restricted-syntax
for (const key in evt) {
// copy all the properties from the input event that are not
// defined on the touch event (functions included).
if (touchEvt[key] === undefined) {
touchEvt[key] = (evt as any)[key]
}
}
normalizedEvent = touchEvt
}

// IE: evt.target could be set to SVGElementInstance for SVGUseElement
const target = normalizedEvent.target
if (target) {
const useElement = target.correspondingUseElement
if (useElement) {
normalizedEvent.target = useElement
}
}

return normalizedEvent
}
}
Expand Down

0 comments on commit 37e8c22

Please sign in to comment.