babylon.clipboardEvents.ts 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. module BABYLON {
  2. //
  3. export class ClipboardEventTypes {
  4. public static readonly COPY = 0x01; //
  5. public static readonly CUT = 0x02;
  6. public static readonly PASTE = 0x03;
  7. }
  8. export class ClipboardInfo {
  9. constructor(
  10. public type: number,
  11. public event: ClipboardEvent) {
  12. }
  13. }
  14. export class ClipboardInfoPre extends ClipboardInfo {
  15. public skipOnPointerObservables: boolean;
  16. constructor(
  17. public type: number,
  18. public event: ClipboardEvent) {
  19. super(type, event);
  20. this.skipOnPointerObservables = true;
  21. }
  22. public static getTypeFromCharacter(char: string): number {
  23. switch (char.charCodeAt(0)){
  24. case 63: return ClipboardEventTypes.COPY;
  25. case 76: return ClipboardEventTypes.PASTE;
  26. case 78: return ClipboardEventTypes.CUT;
  27. default: return -1;
  28. }
  29. }
  30. }
  31. }