Blame view

天文台pc/tianwentai-ui/node_modules/react-dnd/dist/internals/DropTargetMonitorImpl.js 2.16 KB
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  import { invariant } from '@react-dnd/invariant';
  let isCallingCanDrop = false;
  export class DropTargetMonitorImpl {
      receiveHandlerId(targetId) {
          this.targetId = targetId;
      }
      getHandlerId() {
          return this.targetId;
      }
      subscribeToStateChange(listener, options) {
          return this.internalMonitor.subscribeToStateChange(listener, options);
      }
      canDrop() {
          // Cut out early if the target id has not been set. This should prevent errors
          // where the user has an older version of dnd-core like in
          // https://github.com/react-dnd/react-dnd/issues/1310
          if (!this.targetId) {
              return false;
          }
          invariant(!isCallingCanDrop, 'You may not call monitor.canDrop() inside your canDrop() implementation. ' + 'Read more: http://react-dnd.github.io/react-dnd/docs/api/drop-target-monitor');
          try {
              isCallingCanDrop = true;
              return this.internalMonitor.canDropOnTarget(this.targetId);
          } finally{
              isCallingCanDrop = false;
          }
      }
      isOver(options) {
          if (!this.targetId) {
              return false;
          }
          return this.internalMonitor.isOverTarget(this.targetId, options);
      }
      getItemType() {
          return this.internalMonitor.getItemType();
      }
      getItem() {
          return this.internalMonitor.getItem();
      }
      getDropResult() {
          return this.internalMonitor.getDropResult();
      }
      didDrop() {
          return this.internalMonitor.didDrop();
      }
      getInitialClientOffset() {
          return this.internalMonitor.getInitialClientOffset();
      }
      getInitialSourceClientOffset() {
          return this.internalMonitor.getInitialSourceClientOffset();
      }
      getSourceClientOffset() {
          return this.internalMonitor.getSourceClientOffset();
      }
      getClientOffset() {
          return this.internalMonitor.getClientOffset();
      }
      getDifferenceFromInitialOffset() {
          return this.internalMonitor.getDifferenceFromInitialOffset();
      }
      constructor(manager){
          this.targetId = null;
          this.internalMonitor = manager.getMonitor();
      }
  }
  
  //# sourceMappingURL=DropTargetMonitorImpl.js.map