TextPage.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732
  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. if (loaded.some(r => !r.length))
  150. throw new Error('some font not loaded');
  151. }
  152. }
  153. showBook() {
  154. this.$refs.main.focus();
  155. this.book = null;
  156. this.meta = null;
  157. this.fb2 = null;
  158. this.parsed = null;
  159. this.linesUp = null;
  160. this.linesDown = null;
  161. //default draw props
  162. this.textColor = '#000000';
  163. this.backgroundColor = '#478355';
  164. this.fontStyle = '';// 'bold','italic'
  165. this.fontSize = 33;// px
  166. this.fontName = 'XoloniumRegular';
  167. this.fontCssUrl = 'https://fontlibrary.org/face/xolonium';
  168. this.lineInterval = 7;// px, межстрочный интервал
  169. this.textAlignJustify = true;// выравнивание по ширине
  170. this.p = 50;// px, отступ параграфа
  171. this.indent = 15;// px, отступ всего текста слева и справа
  172. this.wordWrap = true;
  173. this.keepLastToFirst = true;// перенос последней строки в первую при листании
  174. this.showStatusBar = true;
  175. this.statusBarTop = false;// top, bottom
  176. this.statusBarHeight = 19;// px
  177. this.statusBarColorAlpha = 0.4;
  178. this.pageChangeTransition = '';// '' - нет, downShift, rightShift, thaw - протаивание, blink - мерцание
  179. this.pageChangeTransitionSpeed = 50; //0-100%
  180. this.calcDrawProps();
  181. this.draw(true);// пока не загрузили, очистим канвас
  182. if (this.lastBook) {
  183. (async() => {
  184. const isParsed = await bookManager.hasBookParsed(this.lastBook);
  185. if (!isParsed) {
  186. return;
  187. }
  188. this.book = await bookManager.getBook(this.lastBook);
  189. this.meta = bookManager.metaOnly(this.book);
  190. this.fb2 = this.meta.fb2;
  191. const authorName = _.compact([
  192. this.fb2.lastName,
  193. this.fb2.firstName,
  194. this.fb2.middleName
  195. ]).join(' ');
  196. this.title = _.compact([
  197. authorName,
  198. this.fb2.bookTitle
  199. ]).join(' - ');
  200. this.$root.$emit('set-app-title', this.title);
  201. const parsed = this.book.parsed;
  202. this.parsed = parsed;
  203. this.calcDrawProps();
  204. //загрузка дин.шрифта
  205. if (this.fontCssUrl)
  206. loadCSS(this.fontCssUrl);
  207. const waitingTime = 10*1000;
  208. const delay = 100;
  209. let i = 0;
  210. this.fontsLoading = true;
  211. //ждем шрифты
  212. while (i < waitingTime/delay) {
  213. i++;
  214. try {
  215. await this.loadFonts();
  216. i = waitingTime;
  217. } catch (e) {
  218. await sleep(delay);
  219. }
  220. }
  221. this.fontsLoading = false;
  222. if (i !== waitingTime) {
  223. this.$notify.error({
  224. title: 'Ошибка загрузки',
  225. message: 'Некоторые шрифты не удалось загрузить'
  226. });
  227. }
  228. this.draw();
  229. this.refreshTime();
  230. })();
  231. }
  232. }
  233. onResize() {
  234. this.calcDrawProps();
  235. this.draw(true);
  236. }
  237. get font() {
  238. return `${this.fontStyle} ${this.fontSize}px ${this.fontName}`;
  239. }
  240. fontByStyle(style) {
  241. return `${style.italic ? 'italic' : ''} ${style.bold ? 'bold' : ''} ${this.fontSize}px ${this.fontName}`;
  242. }
  243. draw(immediate) {
  244. if (this.book && this.bookPos > 0 && this.bookPos >= this.parsed.textLength) {
  245. this.doEnd();
  246. return;
  247. }
  248. this.activeCanvas = !this.activeCanvas;
  249. if (immediate) {
  250. if (this.activeCanvas)
  251. this.page1 = this.drawPage(this.bookPos);
  252. else
  253. this.page2 = this.drawPage(this.bookPos);
  254. } else {
  255. if (this.pageChangeDirectionDown && this.pagePrepared && this.bookPos == this.bookPosPrepared) {
  256. this.linesDown = this.linesDownNext;
  257. this.linesUp = this.linesUpNext;
  258. this.pagePrepared = false;
  259. this.debouncedPrepareNextPage();
  260. } else {
  261. if (this.activeCanvas)
  262. this.page1 = this.drawPage(this.bookPos);
  263. else
  264. this.page2 = this.drawPage(this.bookPos);
  265. this.pagePrepared = false;
  266. this.debouncedPrepareNextPage();
  267. }
  268. if (this.currentTransition) {
  269. //this.currentTransition
  270. //this.pageChangeTransitionSpeed
  271. //this.pageChangeDirectionDown
  272. //curr to next transition
  273. //пока заглушка
  274. }
  275. this.currentTransition = '';
  276. this.pageChangeDirectionDown = false;//true только если PgDown
  277. }
  278. this.debouncedDrawStatusBar();
  279. }
  280. drawPage(bookPos, nextChangeLines) {
  281. if (!this.lastBook)
  282. return;
  283. let out = `<div class="layout" style="width: ${this.realWidth}px; height: ${this.realHeight}px;` +
  284. ` color: ${this.textColor}; background-color: ${this.backgroundColor}">`;
  285. if (!this.book || !this.parsed.textLength) {
  286. out += '</div>';
  287. return out;
  288. }
  289. const spaceWidth = this.measureText(' ', {});
  290. const lines = this.parsed.getLines(bookPos, 2*this.pageLineCount);
  291. if (!nextChangeLines) {
  292. this.linesDown = lines;
  293. this.linesUp = this.parsed.getLines(bookPos, -2*this.pageLineCount);
  294. } else {
  295. this.linesDownNext = lines;
  296. this.linesUpNext = this.parsed.getLines(bookPos, -2*this.pageLineCount);
  297. }
  298. let y = -this.lineInterval/2 + (this.h - this.pageLineCount*this.lineHeight)/2 + this.fontSize*this.fontShift;
  299. if (this.showStatusBar)
  300. y += this.statusBarHeight*(this.statusBarTop ? 1 : 0);
  301. let len = lines.length;
  302. len = (len > this.pageLineCount ? len = this.pageLineCount : len);
  303. for (let i = 0; i < len; i++) {
  304. const line = lines[i];
  305. /* line:
  306. {
  307. begin: Number,
  308. end: Number,
  309. first: Boolean,
  310. last: Boolean,
  311. parts: array of {
  312. style: {bold: Boolean, italic: Boolean, center: Boolean}
  313. text: String,
  314. }
  315. }*/
  316. let indent = this.indent + (line.first ? this.p : 0);
  317. let lineText = '';
  318. let center = false;
  319. let centerStyle = {};
  320. for (const part of line.parts) {
  321. lineText += part.text;
  322. center = center || part.style.center;
  323. if (part.style.center)
  324. centerStyle = part.style.center;
  325. }
  326. let filled = false;
  327. // если выравнивание по ширине включено
  328. if (this.textAlignJustify && !line.last && !center) {
  329. const words = lineText.split(' ');
  330. if (words.length > 1) {
  331. const spaceCount = words.length - 1;
  332. const space = (this.w - line.width + spaceWidth*spaceCount)/spaceCount;
  333. let x = indent;
  334. for (const part of line.parts) {
  335. const font = this.fontByStyle(part.style);
  336. let partWords = part.text.split(' ');
  337. for (let i = 0; i < partWords.length; i++) {
  338. let word = partWords[i];
  339. out += this.drawHelper.fillText(word, x, y, font);
  340. x += this.measureText(word, part.style) + (i < partWords.length - 1 ? space : 0);
  341. }
  342. }
  343. filled = true;
  344. }
  345. }
  346. // просто выводим текст
  347. if (!filled) {
  348. let x = indent;
  349. x = (center ? this.indent + (this.w - this.measureText(lineText, centerStyle))/2 : x);
  350. for (const part of line.parts) {
  351. let text = part.text;
  352. const font = this.fontByStyle(part.style);
  353. out += this.drawHelper.fillText(text, x, y, font);
  354. x += this.measureText(text, part.style);
  355. }
  356. }
  357. y += this.lineHeight;
  358. }
  359. out += '</div>';
  360. return out;
  361. }
  362. drawStatusBar() {
  363. if (this.showStatusBar && this.linesDown) {
  364. const lines = this.linesDown;
  365. let i = this.pageLineCount;
  366. if (this.keepLastToFirst)
  367. i--;
  368. i = (i > lines.length - 1 ? lines.length - 1 : i);
  369. this.statusBar = this.drawHelper.drawStatusBar(this.statusBarTop, this.statusBarHeight,
  370. lines[i].end, this.parsed.textLength, this.title);
  371. }
  372. }
  373. async refreshTime() {
  374. if (!this.timeRefreshing) {
  375. this.timeRefreshing = true;
  376. await sleep(60*1000);
  377. if (this.book && this.parsed.textLength) {
  378. this.debouncedDrawStatusBar();
  379. }
  380. this.timeRefreshing = false;
  381. this.refreshTime();
  382. }
  383. }
  384. prepareNextPage() {
  385. // подготовка следующей страницы заранее
  386. if (!this.book || !this.parsed.textLength || !this.linesDown)
  387. return;
  388. if (!this.preparing) {
  389. this.preparing = true;
  390. (async() => {
  391. await sleep(100);
  392. if (this.cancelPrepare) {
  393. this.preparing = false;
  394. return;
  395. }
  396. let i = this.pageLineCount;
  397. if (this.keepLastToFirst)
  398. i--;
  399. if (i >= 0 && this.linesDown.length > i) {
  400. this.bookPosPrepared = this.linesDown[i].begin;
  401. if (this.activeCanvas)
  402. this.page2 = this.drawPage(this.bookPosPrepared, true);//наоборот
  403. else
  404. this.page1 = this.drawPage(this.bookPosPrepared, true);
  405. this.pagePrepared = true;
  406. }
  407. this.preparing = false;
  408. })();
  409. }
  410. }
  411. doDown() {
  412. if (this.linesDown && this.linesDown.length > this.pageLineCount) {
  413. this.bookPos = this.linesDown[1].begin;
  414. }
  415. }
  416. doUp() {
  417. if (this.linesUp && this.linesUp.length > 1) {
  418. this.bookPos = this.linesUp[1].begin;
  419. }
  420. }
  421. doPageDown() {
  422. if (this.linesDown) {
  423. let i = this.pageLineCount;
  424. if (this.keepLastToFirst)
  425. i--;
  426. if (i >= 0 && this.linesDown.length >= 2*i) {
  427. this.currentTransition = this.pageChangeTransition;
  428. this.pageChangeDirectionDown = true;
  429. this.bookPos = this.linesDown[i].begin;
  430. } else
  431. this.doEnd();
  432. }
  433. }
  434. doPageUp() {
  435. if (this.linesUp) {
  436. let i = this.pageLineCount;
  437. if (this.keepLastToFirst)
  438. i--;
  439. i = (i > this.linesUp.length - 1 ? this.linesUp.length - 1 : i);
  440. if (i >= 0 && this.linesUp.length > i) {
  441. this.currentTransition = this.pageChangeTransition;
  442. this.pageChangeDirectionDown = false;
  443. this.bookPos = this.linesUp[i].begin;
  444. }
  445. }
  446. }
  447. doHome() {
  448. this.bookPos = 0;
  449. }
  450. doEnd() {
  451. if (this.parsed.para.length) {
  452. let i = this.parsed.para.length - 1;
  453. let lastPos = this.parsed.para[i].offset + this.parsed.para[i].length - 1;
  454. const lines = this.parsed.getLines(lastPos, -this.pageLineCount);
  455. i = this.pageLineCount - 1;
  456. i = (i > lines.length - 1 ? lines.length - 1 : i);
  457. this.bookPos = lines[i].begin;
  458. }
  459. }
  460. doToolBarToggle() {
  461. this.$emit('tool-bar-toggle');
  462. }
  463. keyHook(event) {
  464. if (event.type == 'keydown') {
  465. switch (event.code) {
  466. case 'ArrowDown':
  467. this.doDown();
  468. break;
  469. case 'ArrowUp':
  470. this.doUp();
  471. break;
  472. case 'PageDown':
  473. case 'ArrowRight':
  474. case 'Enter':
  475. case 'Space':
  476. this.doPageDown();
  477. break;
  478. case 'PageUp':
  479. case 'ArrowLeft':
  480. case 'Backspace':
  481. this.doPageUp();
  482. break;
  483. case 'Home':
  484. this.doHome();
  485. break;
  486. case 'End':
  487. this.doEnd();
  488. break;
  489. }
  490. }
  491. }
  492. async startClickRepeat(pointX, pointY) {
  493. this.repX = pointX;
  494. this.repY = pointY;
  495. if (!this.repInit && this.repDoing) {
  496. this.repInit = true;
  497. let delay = 400;
  498. while (this.repDoing) {
  499. this.handleClick(pointX, pointY);
  500. await sleep(delay);
  501. if (delay > 15)
  502. delay *= 0.8;
  503. }
  504. this.repInit = false;
  505. }
  506. }
  507. endClickRepeat() {
  508. this.repDoing = false;
  509. }
  510. onTouchStart(event) {
  511. if (!this.mobile)
  512. return;
  513. this.endClickRepeat();
  514. if (event.touches.length == 1) {
  515. const touch = event.touches[0];
  516. const rect = event.target.getBoundingClientRect();
  517. const x = touch.pageX - rect.left;
  518. const y = touch.pageY - rect.top;
  519. if (this.handleClick(x, y)) {
  520. this.repDoing = true;
  521. this.debouncedStartClickRepeat(x, y);
  522. }
  523. }
  524. }
  525. onTouchEnd() {
  526. if (!this.mobile)
  527. return;
  528. this.endClickRepeat();
  529. }
  530. onTouchCancel() {
  531. if (!this.mobile)
  532. return;
  533. this.endClickRepeat();
  534. }
  535. onMouseDown(event) {
  536. if (this.mobile)
  537. return;
  538. this.endClickRepeat();
  539. if (event.button == 0) {
  540. if (this.handleClick(event.offsetX, event.offsetY)) {
  541. this.repDoing = true;
  542. this.debouncedStartClickRepeat(event.offsetX, event.offsetY);
  543. }
  544. } else if (event.button == 2) {
  545. this.doToolBarToggle();
  546. }
  547. }
  548. onMouseUp() {
  549. if (this.mobile)
  550. return;
  551. this.endClickRepeat();
  552. }
  553. onMouseWheel(event) {
  554. if (this.mobile)
  555. return;
  556. if (event.deltaY > 0) {
  557. this.doDown();
  558. } else if (event.deltaY < 0) {
  559. this.doUp();
  560. }
  561. }
  562. onStatusBarClick() {
  563. window.open(this.meta.url, '_blank');
  564. }
  565. handleClick(pointX, pointY) {
  566. const mouseLegend = {
  567. 40: {30: 'PgUp', 100: 'PgDown'},
  568. 60: {40: 'Up', 60: 'Menu', 100: 'Down'},
  569. 100: {30: 'PgUp', 100: 'PgDown'}
  570. };
  571. const w = pointX/this.realWidth*100;
  572. const h = pointY/this.realHeight*100;
  573. let action = '';
  574. loops: {
  575. for (const x in mouseLegend) {
  576. for (const y in mouseLegend[x]) {
  577. if (w < x && h < y) {
  578. action = mouseLegend[x][y];
  579. break loops;
  580. }
  581. }
  582. }
  583. }
  584. switch (action) {
  585. case 'Down' ://Down
  586. this.doDown();
  587. break;
  588. case 'Up' ://Up
  589. this.doUp();
  590. break;
  591. case 'PgDown' ://PgDown
  592. this.doPageDown();
  593. break;
  594. case 'PgUp' ://PgUp
  595. this.doPageUp();
  596. break;
  597. case 'Menu' :
  598. this.doToolBarToggle();
  599. break;
  600. default :
  601. // Nothing
  602. }
  603. return (action && action != 'Menu');
  604. }
  605. }
  606. //-----------------------------------------------------------------------------
  607. </script>
  608. <style scoped>
  609. .main {
  610. flex: 1;
  611. margin: 0;
  612. padding: 0;
  613. overflow: hidden;
  614. position: relative;
  615. }
  616. .layout {
  617. margin: 0;
  618. padding: 0;
  619. position: absolute;
  620. z-index: 10;
  621. }
  622. .events {
  623. z-index: 20;
  624. background-color: rgba(0,0,0,0);
  625. }
  626. </style>