Skip to content

Commit

Permalink
fix(gesture): svg & webgl 手势事件不生效
Browse files Browse the repository at this point in the history
  • Loading branch information
zengyue committed Oct 7, 2023
1 parent 4d9815b commit 4d4f784
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/g-mobile-svg/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
"dependencies": {
"@antv/g-lite": "workspace:*",
"@antv/g-plugin-dragndrop": "workspace:*",
"@antv/g-plugin-gesture": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
"@antv/g-plugin-svg-picker": "workspace:*",
"@antv/g-plugin-svg-renderer": "workspace:*",
Expand Down
15 changes: 13 additions & 2 deletions packages/g-mobile-svg/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as DragDropEvent from '@antv/g-plugin-dragndrop';
import * as MobileInteraction from '@antv/g-plugin-mobile-interaction';
import * as SVGPicker from '@antv/g-plugin-svg-picker';
import * as SVGRenderer from '@antv/g-plugin-svg-renderer';
import * as GesturePlugin from '@antv/g-plugin-gesture';
import { isNil } from '@antv/util';
import { ContextRegisterPlugin } from './ContextRegisterPlugin';

Expand All @@ -27,8 +28,12 @@ export class Renderer extends AbstractRenderer {
this.registerPlugin(new SVGPicker.Plugin());
this.registerPlugin(
new DragDropEvent.Plugin({
isDocumentDraggable: isNil(config?.isDocumentDraggable) ? true : config.isDocumentDraggable,
isDocumentDroppable: isNil(config?.isDocumentDroppable) ? true : config.isDocumentDroppable,
isDocumentDraggable: isNil(config?.isDocumentDraggable)
? true
: config.isDocumentDraggable,
isDocumentDroppable: isNil(config?.isDocumentDroppable)
? true
: config.isDocumentDroppable,
dragstartDistanceThreshold: isNil(config?.dragstartDistanceThreshold)
? 10
: config.dragstartDistanceThreshold,
Expand All @@ -37,5 +42,11 @@ export class Renderer extends AbstractRenderer {
: config.dragstartTimeThreshold,
}),
);

this.registerPlugin(
new GesturePlugin.Plugin({
isDocumentGestureEnabled: true,
}),
);
}
}
1 change: 1 addition & 0 deletions packages/g-mobile-webgl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"@antv/g-lite": "workspace:*",
"@antv/g-plugin-device-renderer": "workspace:*",
"@antv/g-plugin-dragndrop": "workspace:*",
"@antv/g-plugin-gesture": "workspace:*",
"@antv/g-plugin-html-renderer": "workspace:*",
"@antv/g-plugin-image-loader": "workspace:*",
"@antv/g-plugin-mobile-interaction": "workspace:*",
Expand Down
7 changes: 7 additions & 0 deletions packages/g-mobile-webgl/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as DragDropEvent from '@antv/g-plugin-dragndrop';
import * as HTMLRenderer from '@antv/g-plugin-html-renderer';
import * as ImageLoader from '@antv/g-plugin-image-loader';
import * as DomInteraction from '@antv/g-plugin-mobile-interaction';
import * as GesturePlugin from '@antv/g-plugin-gesture';
import { isNil } from '@antv/util';
import { ContextRegisterPlugin } from './ContextRegisterPlugin';

Expand Down Expand Up @@ -52,5 +53,11 @@ export class Renderer extends AbstractRenderer {
: config.dragstartTimeThreshold,
}),
);

this.registerPlugin(
new GesturePlugin.Plugin({
isDocumentGestureEnabled: true,
}),
);
}
}

0 comments on commit 4d4f784

Please sign in to comment.