MCPcopy
hub / github.com/clauderic/dnd-kit / constructor

Method constructor

packages/dom/src/core/plugins/cursor/Cursor.ts:15–37  ·  view source on GitHub ↗
(
    public manager: DragDropManager,
    options?: CursorPluginOptions
  )

Source from the content-addressed store, hash-verified

13
14export class Cursor extends Plugin<DragDropManager> {
15 constructor(
16 public manager: DragDropManager,
17 options?: CursorPluginOptions
18 ) {
19 super(manager, options);
20
21 const {cursor = 'grabbing'} = options ?? {};
22 const styleInjector = manager.registry.plugins.get(
23 StyleInjector as any
24 ) as StyleInjector | undefined;
25
26 const unregisterStyles = styleInjector?.register(
27 `* { cursor: ${cursor} !important; }`
28 );
29
30 if (unregisterStyles) {
31 const originalDestroy = this.destroy.bind(this);
32 this.destroy = () => {
33 unregisterStyles();
34 originalDestroy();
35 };
36 }
37 }
38}

Callers

nothing calls this directly

Calls 3

registerMethod · 0.65
getMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected