TextPage.vue 23 KB

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