Нет описания

123456789101112131415161718192021222324252627282930313233
  1. import { EventHub } from './../../src/event/EventHub';
  2. import { WhitePage } from '../../src/board/WhitePage/index';
  3. import { SyncEvent } from '../../src/event/Event';
  4. const eventHub = new EventHub();
  5. eventHub.on('sync', (changeEv: SyncEvent) => {
  6. console.log(changeEv);
  7. });
  8. const page1 = new WhitePage(
  9. { imgEle: document.getElementById('image1') as HTMLImageElement },
  10. { eventHub }
  11. );
  12. page1.drawboard.open((dataUrl: string) => {
  13. const res = document.getElementById('resultImage') as HTMLImageElement;
  14. res.src = dataUrl;
  15. });
  16. const page2 = new WhitePage(
  17. { imgEle: document.getElementById('image2') as HTMLImageElement },
  18. {
  19. mode: 'mirror',
  20. eventHub
  21. }
  22. );
  23. page2.drawboard.open((dataUrl: string) => {
  24. const res = document.getElementById('resultImage') as HTMLImageElement;
  25. res.src = dataUrl;
  26. });