TextPage.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. <template>
  2. <div ref="main" class="main">
  3. <div v-show="activeCanvas" class="layout">
  4. <div v-html="page1"></div>
  5. </div>
  6. <div v-show="!activeCanvas" class="layout">
  7. <div v-html="page2"></div>
  8. </div>
  9. <div v-show="showStatusBar" ref="statusBar" class="layout">
  10. <div v-html="statusBar"></div>
  11. </div>
  12. <div ref="layoutEvents" class="layout events" @mousedown.prevent.stop="onMouseDown" @mouseup.prevent.stop="onMouseUp"
  13. @wheel.prevent.stop="onMouseWheel"
  14. @touchstart.stop="onTouchStart" @touchend.stop="onTouchEnd" @touchcancel.prevent.stop="onTouchCancel"
  15. oncontextmenu="return false;">
  16. <div v-show="showStatusBar" v-html="statusBarClickable" @mousedown.prevent.stop @touchstart.stop
  17. @click.prevent.stop="onStatusBarClick"></div>
  18. <div v-show="fontsLoading" ref="fontsLoading"></div>
  19. </div>
  20. <canvas ref="offscreenCanvas" style="display: none"></canvas>
  21. </div>
  22. </template>
  23. <script>
  24. //-----------------------------------------------------------------------------
  25. import Vue from 'vue';
  26. import Component from 'vue-class-component';
  27. import {loadCSS} from 'fg-loadcss';
  28. import _ from 'lodash';
  29. import {sleep} from '../../../share/utils';
  30. import bookManager from '../share/bookManager';
  31. import DrawHelper from './DrawHelper';
  32. export default @Component({
  33. watch: {
  34. bookPos: function(newValue) {
  35. this.debouncedEmitPosChange(newValue);
  36. this.draw();
  37. },
  38. },
  39. })
  40. class TextPage extends Vue {
  41. activeCanvas = false;
  42. showStatusBar = false;
  43. page1 = null;
  44. page2 = null;
  45. statusBar = null;
  46. statusBarClickable = null;
  47. fontsLoading = null;
  48. lastBook = null;
  49. bookPos = 0;
  50. fontStyle = null;
  51. fontSize = null;
  52. fontName = null;
  53. meta = null;
  54. created() {
  55. this.drawHelper = new DrawHelper();
  56. this.commit = this.$store.commit;
  57. this.dispatch = this.$store.dispatch;
  58. this.config = this.$store.state.config;
  59. this.reader = this.$store.state.reader;
  60. this.debouncedEmitPosChange = _.debounce((newValue) => {
  61. this.$emit('book-pos-changed', {bookPos: newValue});
  62. }, 1000);
  63. this.debouncedStartClickRepeat = _.debounce((x, y) => {
  64. this.startClickRepeat(x, y);
  65. }, 800);
  66. this.debouncedPrepareNextPage = _.debounce(() => {
  67. this.prepareNextPage();
  68. }, 100);
  69. this.debouncedDrawStatusBar = _.throttle(() => {
  70. this.drawStatusBar();
  71. }, 60);
  72. this.$root.$on('resize', () => {this.$nextTick(this.onResize)});
  73. this.mobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/i.test(navigator.userAgent);
  74. }
  75. mounted() {
  76. this.context = this.$refs.offscreenCanvas.getContext('2d');
  77. }
  78. hex2rgba(hex, alpha = 1) {
  79. const [r, g, b] = hex.match(/\w\w/g).map(x => parseInt(x, 16));
  80. return `rgba(${r},${g},${b},${alpha})`;
  81. }
  82. async calcDrawProps() {
  83. //preloaded fonts
  84. this.fontShifts = {//%
  85. ReaderDefault: 0,
  86. Roboto: 0,
  87. OpenSans: 0
  88. }
  89. if (!this.fontShifts.hasOwnProperty(this.fontName))
  90. this.fontShifts[this.fontName] = 0;
  91. this.fontList = [];
  92. for (let fontName in this.fontShifts)
  93. this.fontList.push(`12px ${fontName}`);
  94. //widths
  95. this.realWidth = this.$refs.main.clientWidth;
  96. this.realHeight = this.$refs.main.clientHeight;
  97. this.$refs.layoutEvents.style.width = this.realWidth + 'px';
  98. this.$refs.layoutEvents.style.height = this.realHeight + 'px';
  99. this.activeCanvas = false;
  100. this.w = this.realWidth - 2*this.indent;
  101. this.h = this.realHeight - (this.showStatusBar ? this.statusBarHeight : 0);
  102. this.lineHeight = this.fontSize + this.lineInterval;
  103. this.pageLineCount = Math.floor(this.h/this.lineHeight);
  104. if (this.parsed) {
  105. this.parsed.p = this.p;
  106. this.parsed.w = this.w;// px, ширина текста
  107. this.parsed.font = this.font;
  108. this.parsed.wordWrap = this.wordWrap;
  109. this.parsed.measureText = this.measureText;
  110. }
  111. //сообщение "Загрузка шрифтов..."
  112. const flText = 'Загрузка шрифтов...';
  113. this.$refs.fontsLoading.innerHTML = flText;
  114. const fontsLoadingStyle = this.$refs.fontsLoading.style;
  115. fontsLoadingStyle.position = 'absolute';
  116. fontsLoadingStyle.fontSize = this.fontSize + 'px';
  117. fontsLoadingStyle.top = (this.realHeight/2 - 2*this.fontSize) + 'px';
  118. fontsLoadingStyle.left = (this.realWidth - this.measureText(flText, {}))/2 + 'px';
  119. //stuff
  120. this.statusBarColor = this.hex2rgba(this.textColor, this.statusBarColorAlpha);
  121. this.currentTransition = '';
  122. this.pageChangeDirectionDown = true;
  123. this.fontShift = (this.fontShifts[this.fontName] ? this.fontShifts[this.fontName] : 0)/100;
  124. //drawHelper
  125. this.drawHelper.realWidth = this.realWidth;
  126. this.drawHelper.realHeight = this.realHeight;
  127. this.drawHelper.backgroundColor = this.backgroundColor;
  128. this.drawHelper.statusBarColor = this.statusBarColor;
  129. this.drawHelper.fontName = this.fontName;
  130. this.drawHelper.fontShift = this.fontShift;
  131. this.drawHelper.measureText = this.measureText;
  132. this.drawHelper.measureTextFont = this.measureTextFont;
  133. this.$refs.statusBar.style.left = '0px';
  134. this.$refs.statusBar.style.top = (this.statusBarTop ? 1 : this.realHeight - this.statusBarHeight) + 'px';
  135. this.statusBarClickable = this.drawHelper.statusBarClickable(this.statusBarTop, this.statusBarHeight);
  136. }
  137. measureText(text, style) {// eslint-disable-line no-unused-vars
  138. this.context.font = this.fontByStyle(style);
  139. return this.context.measureText(text).width;
  140. }
  141. measureTextFont(text, font) {// eslint-disable-line no-unused-vars
  142. this.context.font = font;
  143. return this.context.measureText(text).width;
  144. }
  145. async loadFonts() {
  146. let loaded = await Promise.all(this.fontList.map(font => document.fonts.check(font)));
  147. if (loaded.some(r => !r)) {
  148. loaded = await Promise.all(this.fontList.map(font => document.fonts.load(font)));
  149. await document.fonts.ready;
  150. if (loaded.some(r => !r.length))
  151. throw new Error('some font not loaded');
  152. }
  153. }
  154. showBook() {
  155. this.$refs.main.focus();
  156. this.book = null;
  157. this.meta = null;
  158. this.fb2 = null;
  159. this.parsed = null;
  160. this.linesUp = null;
  161. this.linesDown = null;
  162. //default draw props
  163. this.textColor = '#000000';
  164. this.backgroundColor = '#478355';
  165. this.fontStyle = '';// 'bold','italic'
  166. this.fontSize = 33;// px
  167. this.fontName = 'Archivo';
  168. this.fontCssUrl = '';
  169. this.lineInterval = 7;// px, межстрочный интервал
  170. this.textAlignJustify = true;// выравнивание по ширине
  171. this.p = 50;// px, отступ параграфа
  172. this.indent = 15;// px, отступ всего текста слева и справа
  173. this.wordWrap = true;
  174. this.keepLastToFirst = true;// перенос последней строки в первую при листании
  175. this.showStatusBar = true;
  176. this.statusBarTop = false;// top, bottom
  177. this.statusBarHeight = 19;// px
  178. this.statusBarColorAlpha = 0.4;
  179. this.pageChangeTransition = '';// '' - нет, downShift, rightShift, thaw - протаивание, blink - мерцание
  180. this.pageChangeTransitionSpeed = 50; //0-100%
  181. this.calcDrawProps();
  182. this.draw(true);// пока не загрузили, очистим канвас
  183. if (this.lastBook) {
  184. (async() => {
  185. const isParsed = await bookManager.hasBookParsed(this.lastBook);
  186. if (!isParsed) {
  187. return;
  188. }
  189. this.book = await bookManager.getBook(this.lastBook);
  190. this.meta = bookManager.metaOnly(this.book);
  191. this.fb2 = this.meta.fb2;
  192. const authorName = _.compact([
  193. this.fb2.lastName,
  194. this.fb2.firstName,
  195. this.fb2.middleName
  196. ]).join(' ');
  197. this.title = _.compact([
  198. authorName,
  199. this.fb2.bookTitle
  200. ]).join(' - ');
  201. this.$root.$emit('set-app-title', this.title);
  202. const parsed = this.book.parsed;
  203. this.parsed = parsed;
  204. this.calcDrawProps();
  205. //загрузка дин.шрифта
  206. if (this.fontCssUrl)
  207. loadCSS(this.fontCssUrl);
  208. const waitingTime = 10*1000;
  209. const delay = 100;
  210. let i = 0;
  211. this.fontsLoading = true;
  212. //ждем шрифты
  213. while (i < waitingTime/delay) {
  214. i++;
  215. try {
  216. await this.loadFonts();
  217. i = waitingTime;
  218. } catch (e) {
  219. await sleep(delay);
  220. }
  221. }
  222. this.fontsLoading = false;
  223. if (i !== waitingTime) {
  224. this.$notify.error({
  225. title: 'Ошибка загрузки',
  226. message: 'Некоторые шрифты не удалось загрузить'
  227. });
  228. }
  229. this.draw();
  230. this.refreshTime();
  231. })();
  232. }
  233. }
  234. onResize() {
  235. this.calcDrawProps();
  236. this.draw(true);
  237. }
  238. get font() {
  239. return `${this.fontStyle} ${this.fontSize}px ${this.fontName}`;
  240. }
  241. fontByStyle(style) {
  242. return `${style.italic ? 'italic' : ''} ${style.bold ? 'bold' : ''} ${this.fontSize}px ${this.fontName}`;
  243. }
  244. draw(immediate) {
  245. if (this.book && this.bookPos > 0 && this.bookPos >= this.parsed.textLength) {
  246. this.doEnd();
  247. return;
  248. }
  249. this.activeCanvas = !this.activeCanvas;
  250. if (immediate) {
  251. if (this.activeCanvas)
  252. this.page1 = this.drawPage(this.bookPos);
  253. else
  254. this.page2 = this.drawPage(this.bookPos);
  255. } else {
  256. if (this.pageChangeDirectionDown && this.pagePrepared && this.bookPos == this.bookPosPrepared) {
  257. this.linesDown = this.linesDownNext;
  258. this.linesUp = this.linesUpNext;
  259. this.pagePrepared = false;
  260. this.debouncedPrepareNextPage();
  261. } else {
  262. if (this.activeCanvas)
  263. this.page1 = this.drawPage(this.bookPos);
  264. else
  265. this.page2 = this.drawPage(this.bookPos);
  266. this.pagePrepared = false;
  267. this.debouncedPrepareNextPage();
  268. }
  269. if (this.currentTransition) {
  270. //this.currentTransition
  271. //this.pageChangeTransitionSpeed
  272. //this.pageChangeDirectionDown
  273. //curr to next transition
  274. //пока заглушка
  275. }
  276. this.currentTransition = '';
  277. this.pageChangeDirectionDown = false;//true только если PgDown
  278. }
  279. this.debouncedDrawStatusBar();
  280. }
  281. drawPage(bookPos, nextChangeLines) {
  282. if (!this.lastBook)
  283. return;
  284. let out = `<div class="layout" style="width: ${this.realWidth}px; height: ${this.realHeight}px;` +
  285. ` color: ${this.textColor}; background-color: ${this.backgroundColor}">`;
  286. if (!this.book || !this.parsed.textLength) {
  287. out += '</div>';
  288. return out;
  289. }
  290. const spaceWidth = this.measureText(' ', {});
  291. const lines = this.parsed.getLines(bookPos, 2*this.pageLineCount);
  292. if (!nextChangeLines) {
  293. this.linesDown = lines;
  294. this.linesUp = this.parsed.getLines(bookPos, -2*this.pageLineCount);
  295. } else {
  296. this.linesDownNext = lines;
  297. this.linesUpNext = this.parsed.getLines(bookPos, -2*this.pageLineCount);
  298. }
  299. let y = -this.lineInterval/2 + (this.h - this.pageLineCount*this.lineHeight)/2 + this.fontSize*this.fontShift;
  300. if (this.showStatusBar)
  301. y += this.statusBarHeight*(this.statusBarTop ? 1 : 0);
  302. let len = lines.length;
  303. len = (len > this.pageLineCount ? len = this.pageLineCount : len);
  304. for (let i = 0; i < len; i++) {
  305. const line = lines[i];
  306. /* line:
  307. {
  308. begin: Number,
  309. end: Number,
  310. first: Boolean,
  311. last: Boolean,
  312. parts: array of {
  313. style: {bold: Boolean, italic: Boolean, center: Boolean}
  314. text: String,
  315. }
  316. }*/
  317. let indent = this.indent + (line.first ? this.p : 0);
  318. let lineText = '';
  319. let center = false;
  320. let centerStyle = {};
  321. for (const part of line.parts) {
  322. lineText += part.text;
  323. center = center || part.style.center;
  324. if (part.style.center)
  325. centerStyle = part.style.center;
  326. }
  327. let filled = false;
  328. // если выравнивание по ширине включено
  329. if (this.textAlignJustify && !line.last && !center) {
  330. const words = lineText.split(' ');
  331. if (words.length > 1) {
  332. const spaceCount = words.length - 1;
  333. const space = (this.w - line.width + spaceWidth*spaceCount)/spaceCount;
  334. let x = indent;
  335. for (const part of line.parts) {
  336. const font = this.fontByStyle(part.style);
  337. let partWords = part.text.split(' ');
  338. for (let i = 0; i < partWords.length; i++) {
  339. let word = partWords[i];
  340. out += this.drawHelper.fillText(word, x, y, font);
  341. x += this.measureText(word, part.style) + (i < partWords.length - 1 ? space : 0);
  342. }
  343. }
  344. filled = true;
  345. }
  346. }
  347. // просто выводим текст
  348. if (!filled) {
  349. let x = indent;
  350. x = (center ? this.indent + (this.w - this.measureText(lineText, centerStyle))/2 : x);
  351. for (const part of line.parts) {
  352. let text = part.text;
  353. const font = this.fontByStyle(part.style);
  354. out += this.drawHelper.fillText(text, x, y, font);
  355. x += this.measureText(text, part.style);
  356. }
  357. }
  358. y += this.lineHeight;
  359. }
  360. out += '</div>';
  361. return out;
  362. }
  363. drawStatusBar() {
  364. if (this.showStatusBar && this.linesDown) {
  365. const lines = this.linesDown;
  366. let i = this.pageLineCount;
  367. if (this.keepLastToFirst)
  368. i--;
  369. i = (i > lines.length - 1 ? lines.length - 1 : i);
  370. this.statusBar = this.drawHelper.drawStatusBar(this.statusBarTop, this.statusBarHeight,
  371. lines[i].end, this.parsed.textLength, this.title);
  372. }
  373. }
  374. async refreshTime() {
  375. if (!this.timeRefreshing) {
  376. this.timeRefreshing = true;
  377. await sleep(60*1000);
  378. if (this.book && this.parsed.textLength) {
  379. this.debouncedDrawStatusBar();
  380. }
  381. this.timeRefreshing = false;
  382. this.refreshTime();
  383. }
  384. }
  385. prepareNextPage() {
  386. // подготовка следующей страницы заранее
  387. if (!this.book || !this.parsed.textLength || !this.linesDown)
  388. return;
  389. if (!this.preparing) {
  390. this.preparing = true;
  391. (async() => {
  392. await sleep(100);
  393. if (this.cancelPrepare) {
  394. this.preparing = false;
  395. return;
  396. }
  397. let i = this.pageLineCount;
  398. if (this.keepLastToFirst)
  399. i--;
  400. if (i >= 0 && this.linesDown.length > i) {
  401. this.bookPosPrepared = this.linesDown[i].begin;
  402. if (this.activeCanvas)
  403. this.page2 = this.drawPage(this.bookPosPrepared, true);//наоборот
  404. else
  405. this.page1 = this.drawPage(this.bookPosPrepared, true);
  406. this.pagePrepared = true;
  407. }
  408. this.preparing = false;
  409. })();
  410. }
  411. }
  412. doDown() {
  413. if (this.linesDown && this.linesDown.length > this.pageLineCount) {
  414. this.bookPos = this.linesDown[1].begin;
  415. }
  416. }
  417. doUp() {
  418. if (this.linesUp && this.linesUp.length > 1) {
  419. this.bookPos = this.linesUp[1].begin;
  420. }
  421. }
  422. doPageDown() {
  423. if (this.linesDown) {
  424. let i = this.pageLineCount;
  425. if (this.keepLastToFirst)
  426. i--;
  427. if (i >= 0 && this.linesDown.length >= 2*i) {
  428. this.currentTransition = this.pageChangeTransition;
  429. this.pageChangeDirectionDown = true;
  430. this.bookPos = this.linesDown[i].begin;
  431. } else
  432. this.doEnd();
  433. }
  434. }
  435. doPageUp() {
  436. if (this.linesUp) {
  437. let i = this.pageLineCount;
  438. if (this.keepLastToFirst)
  439. i--;
  440. i = (i > this.linesUp.length - 1 ? this.linesUp.length - 1 : i);
  441. if (i >= 0 && this.linesUp.length > i) {
  442. this.currentTransition = this.pageChangeTransition;
  443. this.pageChangeDirectionDown = false;
  444. this.bookPos = this.linesUp[i].begin;
  445. }
  446. }
  447. }
  448. doHome() {
  449. this.bookPos = 0;
  450. }
  451. doEnd() {
  452. if (this.parsed.para.length) {
  453. let i = this.parsed.para.length - 1;
  454. let lastPos = this.parsed.para[i].offset + this.parsed.para[i].length - 1;
  455. const lines = this.parsed.getLines(lastPos, -this.pageLineCount);
  456. i = this.pageLineCount - 1;
  457. i = (i > lines.length - 1 ? lines.length - 1 : i);
  458. this.bookPos = lines[i].begin;
  459. }
  460. }
  461. doToolBarToggle() {
  462. this.$emit('tool-bar-toggle');
  463. }
  464. keyHook(event) {
  465. if (event.type == 'keydown') {
  466. switch (event.code) {
  467. case 'ArrowDown':
  468. this.doDown();
  469. break;
  470. case 'ArrowUp':
  471. this.doUp();
  472. break;
  473. case 'PageDown':
  474. case 'ArrowRight':
  475. case 'Enter':
  476. case 'Space':
  477. this.doPageDown();
  478. break;
  479. case 'PageUp':
  480. case 'ArrowLeft':
  481. case 'Backspace':
  482. this.doPageUp();
  483. break;
  484. case 'Home':
  485. this.doHome();
  486. break;
  487. case 'End':
  488. this.doEnd();
  489. break;
  490. }
  491. }
  492. }
  493. async startClickRepeat(pointX, pointY) {
  494. this.repX = pointX;
  495. this.repY = pointY;
  496. if (!this.repInit && this.repDoing) {
  497. this.repInit = true;
  498. let delay = 400;
  499. while (this.repDoing) {
  500. this.handleClick(pointX, pointY);
  501. await sleep(delay);
  502. if (delay > 15)
  503. delay *= 0.8;
  504. }
  505. this.repInit = false;
  506. }
  507. }
  508. endClickRepeat() {
  509. this.repDoing = false;
  510. }
  511. onTouchStart(event) {
  512. if (!this.mobile)
  513. return;
  514. this.endClickRepeat();
  515. if (event.touches.length == 1) {
  516. const touch = event.touches[0];
  517. const rect = event.target.getBoundingClientRect();
  518. const x = touch.pageX - rect.left;
  519. const y = touch.pageY - rect.top;
  520. if (this.handleClick(x, y)) {
  521. this.repDoing = true;
  522. this.debouncedStartClickRepeat(x, y);
  523. }
  524. }
  525. }
  526. onTouchEnd() {
  527. if (!this.mobile)
  528. return;
  529. this.endClickRepeat();
  530. }
  531. onTouchCancel() {
  532. if (!this.mobile)
  533. return;
  534. this.endClickRepeat();
  535. }
  536. onMouseDown(event) {
  537. if (this.mobile)
  538. return;
  539. this.endClickRepeat();
  540. if (event.button == 0) {
  541. if (this.handleClick(event.offsetX, event.offsetY)) {
  542. this.repDoing = true;
  543. this.debouncedStartClickRepeat(event.offsetX, event.offsetY);
  544. }
  545. } else if (event.button == 2) {
  546. this.doToolBarToggle();
  547. }
  548. }
  549. onMouseUp() {
  550. if (this.mobile)
  551. return;
  552. this.endClickRepeat();
  553. }
  554. onMouseWheel(event) {
  555. if (this.mobile)
  556. return;
  557. if (event.deltaY > 0) {
  558. this.doDown();
  559. } else if (event.deltaY < 0) {
  560. this.doUp();
  561. }
  562. }
  563. onStatusBarClick() {
  564. window.open(this.meta.url, '_blank');
  565. }
  566. handleClick(pointX, pointY) {
  567. const mouseLegend = {
  568. 40: {30: 'PgUp', 100: 'PgDown'},
  569. 60: {40: 'Up', 60: 'Menu', 100: 'Down'},
  570. 100: {30: 'PgUp', 100: 'PgDown'}
  571. };
  572. const w = pointX/this.realWidth*100;
  573. const h = pointY/this.realHeight*100;
  574. let action = '';
  575. loops: {
  576. for (const x in mouseLegend) {
  577. for (const y in mouseLegend[x]) {
  578. if (w < x && h < y) {
  579. action = mouseLegend[x][y];
  580. break loops;
  581. }
  582. }
  583. }
  584. }
  585. switch (action) {
  586. case 'Down' ://Down
  587. this.doDown();
  588. break;
  589. case 'Up' ://Up
  590. this.doUp();
  591. break;
  592. case 'PgDown' ://PgDown
  593. this.doPageDown();
  594. break;
  595. case 'PgUp' ://PgUp
  596. this.doPageUp();
  597. break;
  598. case 'Menu' :
  599. this.doToolBarToggle();
  600. break;
  601. default :
  602. // Nothing
  603. }
  604. return (action && action != 'Menu');
  605. }
  606. }
  607. //-----------------------------------------------------------------------------
  608. </script>
  609. <style scoped>
  610. .main {
  611. flex: 1;
  612. margin: 0;
  613. padding: 0;
  614. overflow: hidden;
  615. position: relative;
  616. }
  617. .layout {
  618. margin: 0;
  619. padding: 0;
  620. position: absolute;
  621. z-index: 10;
  622. }
  623. .events {
  624. z-index: 20;
  625. background-color: rgba(0,0,0,0);
  626. }
  627. </style>