Reader.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. <template>
  2. <el-container>
  3. <el-header v-show="toolBarActive" height='50px'>
  4. <div class="header">
  5. <el-tooltip content="Загрузить книгу" :open-delay="1000" effect="light">
  6. <el-button ref="loader" class="tool-button" :class="buttonActiveClass('loader')" @click="buttonClick('loader')"><i class="el-icon-back"></i></el-button>
  7. </el-tooltip>
  8. <div>
  9. <el-tooltip content="Действие назад" :open-delay="1000" effect="light">
  10. <el-button ref="undoAction" class="tool-button" :class="buttonActiveClass('undoAction')" @click="buttonClick('undoAction')" ><i class="el-icon-arrow-left"></i></el-button>
  11. </el-tooltip>
  12. <el-tooltip content="Действие вперед" :open-delay="1000" effect="light">
  13. <el-button ref="redoAction" class="tool-button" :class="buttonActiveClass('redoAction')" @click="buttonClick('redoAction')" ><i class="el-icon-arrow-right"></i></el-button>
  14. </el-tooltip>
  15. <div class="space"></div>
  16. <el-tooltip content="На весь экран" :open-delay="1000" effect="light">
  17. <el-button ref="fullScreen" class="tool-button" :class="buttonActiveClass('fullScreen')" @click="buttonClick('fullScreen')"><i class="el-icon-rank"></i></el-button>
  18. </el-tooltip>
  19. <el-tooltip content="Плавный скроллинг" :open-delay="1000" effect="light">
  20. <el-button ref="scrolling" class="tool-button" :class="buttonActiveClass('scrolling')" @click="buttonClick('scrolling')"><i class="el-icon-sort"></i></el-button>
  21. </el-tooltip>
  22. <el-tooltip content="Прокрутка книги" :open-delay="1000" effect="light">
  23. <el-button ref="setPosition" class="tool-button" :class="buttonActiveClass('setPosition')" @click="buttonClick('setPosition')"><i class="el-icon-d-arrow-right"></i></el-button>
  24. </el-tooltip>
  25. <el-tooltip content="Найти в тексте" :open-delay="1000" effect="light">
  26. <el-button ref="search" class="tool-button" :class="buttonActiveClass('search')" @click="buttonClick('search')"><i class="el-icon-search"></i></el-button>
  27. </el-tooltip>
  28. <el-tooltip content="Скопировать текст со страницы" :open-delay="1000" effect="light">
  29. <el-button ref="copyText" class="tool-button" :class="buttonActiveClass('copyText')" @click="buttonClick('copyText')"><i class="el-icon-edit-outline"></i></el-button>
  30. </el-tooltip>
  31. <el-tooltip content="Принудительно обновить книгу в обход кеша" :open-delay="1000" effect="light">
  32. <el-button ref="refresh" class="tool-button" :class="buttonActiveClass('refresh')" @click="buttonClick('refresh')">
  33. <i class="el-icon-refresh" :class="{clear: !showRefreshIcon}"></i>
  34. </el-button>
  35. </el-tooltip>
  36. <div class="space"></div>
  37. <el-tooltip content="Открыть недавние" :open-delay="1000" effect="light">
  38. <el-button ref="history" class="tool-button" :class="buttonActiveClass('history')" @click="buttonClick('history')"><i class="el-icon-document"></i></el-button>
  39. </el-tooltip>
  40. </div>
  41. <el-tooltip content="Настроить" :open-delay="1000" effect="light">
  42. <el-button ref="settings" class="tool-button" :class="buttonActiveClass('settings')" @click="buttonClick('settings')"><i class="el-icon-setting"></i></el-button>
  43. </el-tooltip>
  44. </div>
  45. </el-header>
  46. <el-main>
  47. <keep-alive>
  48. <component ref="page" :is="activePage"
  49. @load-book="loadBook"
  50. @book-pos-changed="bookPosChanged"
  51. @tool-bar-toggle="toolBarToggle"
  52. @full-screen-toogle="fullScreenToggle"
  53. @stop-scrolling="stopScrolling"
  54. @scrolling-toggle="scrollingToggle"
  55. ></component>
  56. </keep-alive>
  57. <SetPositionPage v-if="setPositionActive" ref="setPositionPage" @set-position-toggle="setPositionToggle" @book-pos-changed="bookPosChanged"></SetPositionPage>
  58. <SearchPage v-show="searchActive" ref="searchPage"
  59. @search-toggle="searchToggle"
  60. @book-pos-changed="bookPosChanged"
  61. @start-text-search="startTextSearch"
  62. @stop-text-search="stopTextSearch">
  63. </SearchPage>
  64. <HistoryPage v-if="historyActive" ref="historyPage" @load-book="loadBook" @history-toggle="historyToggle"></HistoryPage>
  65. <SettingsPage v-if="settingsActive" ref="settingsPage" @settings-toggle="settingsToggle"></SettingsPage>
  66. </el-main>
  67. </el-container>
  68. </template>
  69. <script>
  70. //-----------------------------------------------------------------------------
  71. import Vue from 'vue';
  72. import Component from 'vue-class-component';
  73. import LoaderPage from './LoaderPage/LoaderPage.vue';
  74. import TextPage from './TextPage/TextPage.vue';
  75. import ProgressPage from './ProgressPage/ProgressPage.vue';
  76. import SetPositionPage from './SetPositionPage/SetPositionPage.vue';
  77. import SearchPage from './SearchPage/SearchPage.vue';
  78. import HistoryPage from './HistoryPage/HistoryPage.vue';
  79. import SettingsPage from './SettingsPage/SettingsPage.vue';
  80. import bookManager from './share/bookManager';
  81. import readerApi from '../../api/reader';
  82. import _ from 'lodash';
  83. import {sleep} from '../../share/utils';
  84. export default @Component({
  85. components: {
  86. LoaderPage,
  87. TextPage,
  88. ProgressPage,
  89. SetPositionPage,
  90. SearchPage,
  91. HistoryPage,
  92. SettingsPage,
  93. },
  94. watch: {
  95. bookPos: function(newValue) {
  96. if (newValue !== undefined && this.activePage == 'TextPage') {
  97. const textPage = this.$refs.page;
  98. if (textPage.bookPos != newValue) {
  99. textPage.bookPos = newValue;
  100. }
  101. this.debouncedCommitOpenedBook(newValue);
  102. }
  103. },
  104. routeParamPos: function(newValue) {
  105. if (newValue !== undefined && newValue != this.bookPos) {
  106. this.bookPos = newValue;
  107. }
  108. },
  109. routeParamUrl: function(newValue) {
  110. if (newValue !== '' && newValue !== this.lastOpenedBook.url) {
  111. this.loadBook({url: newValue, bookPos: this.routeParamPos});
  112. }
  113. },
  114. settings: function(newValue) {
  115. this.allowUrlParamBookPos = newValue.allowUrlParamBookPos;
  116. this.updateRoute();
  117. },
  118. },
  119. })
  120. class Reader extends Vue {
  121. loaderActive = false;
  122. progressActive = false;
  123. fullScreenActive = false;
  124. scrollingActive = false;
  125. setPositionActive = false;
  126. searchActive = false;
  127. copyTextActive = false;
  128. historyActive = false;
  129. settingsActive = false;
  130. bookPos = null;
  131. allowUrlParamBookPos = false;
  132. showRefreshIcon = true;
  133. created() {
  134. this.commit = this.$store.commit;
  135. this.dispatch = this.$store.dispatch;
  136. this.reader = this.$store.state.reader;
  137. this.$root.addKeyHook(this.keyHook);
  138. this.lastActivePage = false;
  139. this.debouncedUpdateRoute = _.debounce(() => {
  140. this.updateRoute();
  141. }, 1000);
  142. this.debouncedCommitOpenedBook = _.debounce((newValue) => {
  143. if (this.lastOpenedBook && this.lastOpenedBook.bookPos != newValue) {
  144. this.commit('reader/setOpenedBook', Object.assign({}, this.lastOpenedBook, {bookPos: newValue, bookPosSeen: this.bookPosSeen}));
  145. }
  146. }, 500);
  147. document.addEventListener('fullscreenchange', () => {
  148. this.fullScreenActive = (document.fullscreenElement !== null);
  149. });
  150. this.allowUrlParamBookPos = this.settings.allowUrlParamBookPos;
  151. }
  152. mounted() {
  153. /*while (this.lastOpenedBook) {
  154. this.commit('reader/delOpenedBook', this.lastOpenedBook);
  155. }*/
  156. if (this.$root.rootRoute == '/reader') {
  157. if (this.routeParamUrl) {
  158. this.loadBook({url: this.routeParamUrl, bookPos: this.routeParamPos});
  159. } else if (this.lastOpenedBook) {
  160. this.loadBook({url: this.lastOpenedBook.url});
  161. } else {
  162. this.loaderActive = true;
  163. }
  164. }
  165. }
  166. get routeParamPos() {
  167. let result = undefined;
  168. const q = this.$route.query;
  169. if (q['__p']) {
  170. result = q['__p'];
  171. if (Array.isArray(result))
  172. result = result[0];
  173. }
  174. return (result ? parseInt(result, 10) || 0 : result);
  175. }
  176. updateRoute(isNewRoute) {
  177. const pos = (this.bookPos != undefined && this.allowUrlParamBookPos ? `__p=${this.bookPos}&` : '');
  178. if (isNewRoute)
  179. this.$router.push(`/reader?${pos}url=${this.lastOpenedBook.url}`);
  180. else
  181. this.$router.replace(`/reader?${pos}url=${this.lastOpenedBook.url}`);
  182. }
  183. get routeParamUrl() {
  184. let result = '';
  185. const path = this.$route.fullPath;
  186. const i = path.indexOf('url=');
  187. if (i >= 0) {
  188. result = path.substr(i + 4);
  189. }
  190. return decodeURIComponent(result);
  191. }
  192. bookPosChanged(event) {
  193. if (event.bookPosSeen !== undefined)
  194. this.bookPosSeen = event.bookPosSeen;
  195. this.bookPos = event.bookPos;
  196. this.debouncedUpdateRoute();
  197. }
  198. get toolBarActive() {
  199. return this.reader.toolBarActive;
  200. }
  201. get lastOpenedBook() {
  202. const result = this.$store.getters['reader/lastOpenedBook'];
  203. if (!result)
  204. this.closeAllTextPages();
  205. return result;
  206. }
  207. get settings() {
  208. return this.$store.state.reader.settings;
  209. }
  210. toolBarToggle() {
  211. this.commit('reader/setToolBarActive', !this.toolBarActive);
  212. this.$root.$emit('resize');
  213. }
  214. fullScreenToggle() {
  215. this.fullScreenActive = !this.fullScreenActive;
  216. if (this.fullScreenActive) {
  217. const element = document.documentElement;
  218. if (element.requestFullscreen) {
  219. element.requestFullscreen();
  220. } else if (element.webkitrequestFullscreen) {
  221. element.webkitRequestFullscreen();
  222. } else if (element.mozRequestFullscreen) {
  223. element.mozRequestFullScreen();
  224. }
  225. } else {
  226. if (document.cancelFullScreen) {
  227. document.cancelFullScreen();
  228. } else if (document.mozCancelFullScreen) {
  229. document.mozCancelFullScreen();
  230. } else if (document.webkitCancelFullScreen) {
  231. document.webkitCancelFullScreen();
  232. }
  233. }
  234. }
  235. closeAllTextPages() {
  236. this.setPositionActive = false;
  237. this.historyActive = false;
  238. this.settingsActive = false;
  239. this.stopScrolling();
  240. this.stopSearch();
  241. }
  242. loaderToggle() {
  243. this.loaderActive = !this.loaderActive;
  244. if (this.loaderActive) {
  245. this.closeAllTextPages();
  246. }
  247. }
  248. setPositionToggle() {
  249. this.setPositionActive = !this.setPositionActive;
  250. if (this.setPositionActive && this.activePage == 'TextPage' && this.lastOpenedBook) {
  251. this.closeAllTextPages();
  252. this.setPositionActive = true;
  253. this.$nextTick(() => {
  254. this.$refs.setPositionPage.sliderMax = this.lastOpenedBook.textLength - 1;
  255. this.$refs.setPositionPage.sliderValue = this.lastOpenedBook.bookPos;
  256. });
  257. } else {
  258. this.setPositionActive = false;
  259. }
  260. }
  261. stopScrolling() {
  262. if (this.scrollingActive)
  263. this.scrollingToggle();
  264. }
  265. scrollingToggle() {
  266. this.scrollingActive = !this.scrollingActive;
  267. if (this.activePage == 'TextPage') {
  268. const page = this.$refs.page;
  269. if (this.scrollingActive) {
  270. page.startTextScrolling();
  271. } else {
  272. page.stopTextScrolling();
  273. }
  274. }
  275. }
  276. stopSearch() {
  277. if (this.searchActive)
  278. this.searchToggle();
  279. }
  280. startTextSearch(opts) {
  281. if (this.activePage == 'TextPage')
  282. this.$refs.page.startSearch(opts.needle);
  283. }
  284. stopTextSearch() {
  285. if (this.activePage == 'TextPage')
  286. this.$refs.page.stopSearch();
  287. }
  288. searchToggle() {
  289. this.searchActive = !this.searchActive;
  290. const page = this.$refs.page;
  291. if (this.searchActive && this.activePage == 'TextPage' && page.parsed && this.lastOpenedBook) {
  292. this.closeAllTextPages();
  293. this.searchActive = true;
  294. this.$nextTick(() => {
  295. this.$refs.searchPage.init(page.parsed);
  296. });
  297. } else {
  298. this.stopTextSearch();
  299. this.searchActive = false;
  300. }
  301. }
  302. historyToggle() {
  303. this.historyActive = !this.historyActive;
  304. if (this.historyActive) {
  305. this.closeAllTextPages();
  306. this.historyActive = true;
  307. } else {
  308. this.historyActive = false;
  309. }
  310. }
  311. settingsToggle() {
  312. this.settingsActive = !this.settingsActive;
  313. if (this.settingsActive) {
  314. this.closeAllTextPages();
  315. this.settingsActive = true;
  316. } else {
  317. this.settingsActive = false;
  318. }
  319. }
  320. buttonClick(button) {
  321. switch (button) {
  322. case 'loader':
  323. this.loaderToggle();
  324. break;
  325. case 'fullScreen':
  326. this.fullScreenToggle();
  327. break;
  328. case 'setPosition':
  329. this.setPositionToggle();
  330. break;
  331. case 'scrolling':
  332. this.scrollingToggle();
  333. break;
  334. case 'search':
  335. this.searchToggle();
  336. break;
  337. case 'history':
  338. this.historyToggle();
  339. break;
  340. case 'refresh':
  341. if (this.lastOpenedBook) {
  342. this.loadBook({url: this.lastOpenedBook.url, force: true});
  343. }
  344. break;
  345. case 'settings':
  346. this.settingsToggle();
  347. break;
  348. }
  349. this.$refs[button].$el.blur();
  350. }
  351. buttonActiveClass(button) {
  352. const classActive = { 'tool-button-active': true, 'tool-button-active:hover': true };
  353. const classDisabled = { 'tool-button-disabled': true, 'tool-button-disabled:hover': true };
  354. let classResult = {};
  355. switch (button) {
  356. case 'loader':
  357. case 'fullScreen':
  358. case 'setPosition':
  359. case 'scrolling':
  360. case 'search':
  361. case 'copyText':
  362. case 'history':
  363. case 'settings':
  364. if (this[`${button}Active`])
  365. classResult = classActive;
  366. break;
  367. }
  368. if (this.activePage == 'LoaderPage' || !this.lastOpenedBook) {
  369. switch (button) {
  370. case 'undoAction':
  371. case 'redoAction':
  372. case 'setPosition':
  373. case 'scrolling':
  374. case 'search':
  375. case 'copyText':
  376. classResult = classDisabled;
  377. break;
  378. case 'history':
  379. case 'refresh':
  380. if (!this.lastOpenedBook)
  381. classResult = classDisabled;
  382. break;
  383. }
  384. }
  385. return classResult;
  386. }
  387. get activePage() {
  388. let result = '';
  389. if (this.progressActive)
  390. result = 'ProgressPage';
  391. else if (this.loaderActive)
  392. result = 'LoaderPage';
  393. else if (this.lastOpenedBook)
  394. result = 'TextPage';
  395. if (!result) {
  396. this.loaderActive = true;
  397. result = 'LoaderPage';
  398. }
  399. if (result != 'TextPage') {
  400. this.$root.$emit('set-app-title');
  401. }
  402. if (this.lastActivePage != result && result == 'TextPage') {
  403. //акивируем страницу с текстом
  404. this.$nextTick(async() => {
  405. const last = this.lastOpenedBook;
  406. const isParsed = await bookManager.hasBookParsed(last);
  407. if (!isParsed) {
  408. this.$root.$emit('set-app-title');
  409. return;
  410. }
  411. this.updateRoute();
  412. const textPage = this.$refs.page;
  413. if (textPage.showBook) {
  414. textPage.lastBook = last;
  415. textPage.bookPos = (last.bookPos !== undefined ? last.bookPos : 0);
  416. textPage.showBook();
  417. }
  418. });
  419. }
  420. this.lastActivePage = result;
  421. return result;
  422. }
  423. loadBook(opts) {
  424. this.closeAllTextPages();
  425. this.progressActive = true;
  426. this.$nextTick(async() => {
  427. const progress = this.$refs.page;
  428. try {
  429. progress.show();
  430. progress.setState({state: 'parse'});
  431. // есть ли среди истории OpenedBook
  432. const key = bookManager.keyFromUrl(opts.url);
  433. let wasOpened = this.reader.openedBook[key];
  434. wasOpened = (wasOpened ? wasOpened : {});
  435. const bookPos = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPos);
  436. const bookPosSeen = (opts.bookPos !== undefined ? opts.bookPos : wasOpened.bookPosSeen);
  437. let book = null;
  438. if (!opts.force) {
  439. // пытаемся загрузить и распарсить книгу в менеджере из локального кеша
  440. const bookParsed = await bookManager.getBook({url: opts.url}, (prog) => {
  441. progress.setState({progress: prog});
  442. });
  443. // если есть в локальном кеше
  444. if (bookParsed) {
  445. this.commit('reader/setOpenedBook', Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(bookParsed)));
  446. this.loaderActive = false;
  447. progress.hide(); this.progressActive = false;
  448. this.blinkCachedLoadMessage();
  449. return;
  450. }
  451. // иначе идем на сервер
  452. // пытаемся загрузить готовый файл с сервера
  453. if (wasOpened.path) {
  454. try {
  455. const resp = await readerApi.loadCachedBook(wasOpened.path, (state) => {
  456. progress.setState(state);
  457. });
  458. book = Object.assign({}, wasOpened, {data: resp.data});
  459. } catch (e) {
  460. //молчим
  461. }
  462. }
  463. }
  464. progress.setState({totalSteps: 5});
  465. // не удалось, скачиваем книгу полностью с конвертацией
  466. let loadCached = true;
  467. if (!book) {
  468. book = await readerApi.loadBook(opts.url, (state) => {
  469. progress.setState(state);
  470. });
  471. loadCached = false;
  472. }
  473. // добавляем в bookManager
  474. progress.setState({state: 'parse', step: 5});
  475. const addedBook = await bookManager.addBook(book, (prog) => {
  476. progress.setState({progress: prog});
  477. });
  478. // добавляем в историю
  479. this.commit('reader/setOpenedBook', Object.assign({bookPos, bookPosSeen}, bookManager.metaOnly(addedBook)));
  480. this.updateRoute(true);
  481. this.loaderActive = false;
  482. progress.hide(); this.progressActive = false;
  483. if (loadCached) {
  484. this.blinkCachedLoadMessage();
  485. } else
  486. this.stopBlink = true;
  487. } catch (e) {
  488. progress.hide(); this.progressActive = false;
  489. this.loaderActive = true;
  490. this.$alert(e.message, 'Ошибка', {type: 'error'});
  491. }
  492. });
  493. }
  494. blinkCachedLoadMessage() {
  495. this.blinkCount = 30;
  496. if (!this.inBlink) {
  497. this.inBlink = true;
  498. this.stopBlink = false;
  499. this.$nextTick(async() => {
  500. let page = this.$refs.page;
  501. while (this.blinkCount) {
  502. this.showRefreshIcon = !this.showRefreshIcon;
  503. if (page.blinkCachedLoadMessage)
  504. page.blinkCachedLoadMessage(this.showRefreshIcon);
  505. await sleep(500);
  506. if (this.stopBlink)
  507. break;
  508. this.blinkCount--;
  509. page = this.$refs.page;
  510. }
  511. this.showRefreshIcon = true;
  512. this.inBlink = false;
  513. if (page.blinkCachedLoadMessage)
  514. page.blinkCachedLoadMessage('finish');
  515. });
  516. }
  517. }
  518. keyHook(event) {
  519. if (this.$root.rootRoute == '/reader') {
  520. let handled = false;
  521. if (!handled && this.settingsActive)
  522. handled = this.$refs.settingsPage.keyHook(event);
  523. if (!handled && this.historyActive)
  524. handled = this.$refs.historyPage.keyHook(event);
  525. if (!handled && this.setPositionActive)
  526. handled = this.$refs.setPositionPage.keyHook(event);
  527. if (!handled && this.searchActive)
  528. handled = this.$refs.searchPage.keyHook(event);
  529. if (!handled && this.$refs.page && this.$refs.page.keyHook)
  530. handled = this.$refs.page.keyHook(event);
  531. if (!handled && event.type == 'keydown') {
  532. if (event.code == 'Escape')
  533. this.loaderToggle();
  534. if (this.activePage == 'TextPage') {
  535. switch (event.code) {
  536. case 'KeyP':
  537. this.setPositionToggle();
  538. break;
  539. case 'KeyF':
  540. if (event.ctrlKey) {
  541. this.searchToggle();
  542. event.preventDefault();
  543. event.stopPropagation();
  544. }
  545. break;
  546. case 'KeyZ':
  547. this.scrollingToggle();
  548. break;
  549. case 'KeyH':
  550. this.historyToggle();
  551. break;
  552. case 'KeyS':
  553. this.settingsToggle();
  554. break;
  555. }
  556. }
  557. }
  558. }
  559. }
  560. }
  561. //-----------------------------------------------------------------------------
  562. </script>
  563. <style scoped>
  564. .el-container {
  565. padding: 0;
  566. margin: 0;
  567. height: 100%;
  568. }
  569. .el-header {
  570. padding-left: 5px;
  571. padding-right: 5px;
  572. background-color: #1B695F;
  573. color: #000;
  574. overflow-x: auto;
  575. overflow-y: hidden;
  576. }
  577. .header {
  578. display: flex;
  579. justify-content: space-between;
  580. min-width: 550px;
  581. }
  582. .el-main {
  583. position: relative;
  584. display: flex;
  585. padding: 0;
  586. margin: 0;
  587. background-color: #EBE2C9;
  588. color: #000;
  589. }
  590. .tool-button {
  591. margin: 0 2px 0 2px;
  592. padding: 0;
  593. color: #3E843E;
  594. background-color: #E6EDF4;
  595. margin-top: 5px;
  596. height: 38px;
  597. width: 38px;
  598. border: 0;
  599. box-shadow: 3px 3px 5px black;
  600. }
  601. .tool-button:hover {
  602. background-color: white;
  603. }
  604. .tool-button-active {
  605. box-shadow: 0 0 0;
  606. color: white;
  607. background-color: #8AB45F;
  608. position: relative;
  609. top: 1px;
  610. left: 1px;
  611. }
  612. .tool-button-active:hover {
  613. color: white;
  614. background-color: #81C581;
  615. }
  616. .tool-button-disabled {
  617. color: lightgray;
  618. background-color: gray;
  619. }
  620. .tool-button-disabled:hover {
  621. color: lightgray;
  622. background-color: gray;
  623. }
  624. i {
  625. font-size: 200%;
  626. }
  627. .space {
  628. width: 10px;
  629. display: inline-block;
  630. }
  631. .clear {
  632. color: rgba(0,0,0,0);
  633. }
  634. </style>