From ef6f6580df6e8fbce913eecc1fe7e0f8caf1315b Mon Sep 17 00:00:00 2001 From: rejbasket <39080670+rejbasket@users.noreply.github.com> Date: Mon, 22 May 2023 22:33:19 +0200 Subject: Update electron version to v14.2.9 (#2214) Authored-by: rejbasket Co-authored-by: Kaalleen Co-authored-by: Lex Neva --- electron/src/renderer/App.vue | 11 -- electron/src/renderer/assets/js/simulator.js | 64 +++++---- electron/src/renderer/assets/style/simulator.css | 41 +++--- .../src/renderer/components/InstallPalettes.vue | 123 ----------------- electron/src/renderer/components/NotFound.vue | 12 ++ electron/src/renderer/components/Preferences.vue | 55 ++++---- electron/src/renderer/components/Simulator.vue | 17 ++- electron/src/renderer/main.js | 151 ++++++++------------- electron/src/renderer/router/index.js | 44 +++--- 9 files changed, 186 insertions(+), 332 deletions(-) delete mode 100644 electron/src/renderer/components/InstallPalettes.vue create mode 100644 electron/src/renderer/components/NotFound.vue (limited to 'electron/src/renderer') diff --git a/electron/src/renderer/App.vue b/electron/src/renderer/App.vue index 2e5bbb9d..b98b1399 100644 --- a/electron/src/renderer/App.vue +++ b/electron/src/renderer/App.vue @@ -9,20 +9,9 @@ - - - - - - - diff --git a/electron/src/renderer/assets/js/simulator.js b/electron/src/renderer/assets/js/simulator.js index 186e3e30..8a0423f3 100644 --- a/electron/src/renderer/assets/js/simulator.js +++ b/electron/src/renderer/assets/js/simulator.js @@ -5,19 +5,18 @@ * Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. * */ +import { inkStitch } from '../../../lib/api.js' -const inkStitch = require("../../../lib/api") -const Mousetrap = require("mousetrap") import { SVG } from '@svgdotjs/svg.js' -require('@svgdotjs/svg.panzoom.js/src/svg.panzoom.js') -require('@svgdotjs/svg.filter.js') -const svgpath = require('svgpath') +import '@svgdotjs/svg.panzoom.js' +import '@svgdotjs/svg.filter.js' +import svgpath from 'svgpath' import Loading from 'vue-loading-overlay'; import 'vue-loading-overlay/dist/vue-loading.css'; +import { reactive, toRefs } from 'vue' import VueSlider from 'vue-slider-component' -import 'vue-slider-component/theme/default.css' - -const throttle = require('lodash.throttle') +import 'vue-slider-component/theme/antd.css' +import throttle from 'lodash/throttle' function SliderMark(command, icon) { this.label = "" @@ -31,6 +30,10 @@ export default { Loading, VueSlider }, + setup() { + const data = reactive({ value: 0 }) + return toRefs(data) + }, data: function () { return { loading: false, @@ -511,15 +514,23 @@ export default { }, generatePage () { this.$refs.simulator.style.backgroundColor = this.page_specs.deskcolor + let page = this.svg.rect(this.page_specs.width, this.page_specs.height) .move(-this.stitchPlan.bounding_box[0],-this.stitchPlan.bounding_box[1]) .fill(this.page_specs.pagecolor) - .stroke({width: 1, color: 'black'}) - .filterWith(add => { - let blur = add.offset(2,2).in(add.$sourceAlpha).gaussianBlur(2) - add.blend(add.$source, blur) - }) + .stroke({width: 0.1, color: this.page_specs.bordercolor}) .back() + + if (this.page_specs.showpageshadow === "true") { + let shadow = this.svg.rect(this.page_specs.width, this.page_specs.height) + .move(-this.stitchPlan.bounding_box[0],-this.stitchPlan.bounding_box[1]) + .fill(this.page_specs.bordercolor) + .filterWith(add => { + let blur = add.offset(.5,.5).in(add.$source).gaussianBlur(.5) + }) + .back() + } + this.page_specs["bbox"] = page.bbox() }, zoomDesign () { @@ -606,29 +617,30 @@ export default { this.generateColorSections() this.generateScale() this.generateCursor() - + this.resizeCursor() + this.loading = false // v-on:keydown doesn't seem to work, maybe an Electron issue? - Mousetrap.bind("up", this.animationSpeedUp) - Mousetrap.bind("down", this.animationSlowDown) - Mousetrap.bind("left", this.animationReverse) - Mousetrap.bind("right", this.animationForward) - Mousetrap.bind("pagedown", this.animationPreviousCommand) - Mousetrap.bind("pageup", this.animationNextCommand) - Mousetrap.bind("space", this.toggleAnimation) - Mousetrap.bind("+", this.animationForwardOneStitch) - Mousetrap.bind("-", this.animationBackwardOneStitch) - Mousetrap.bind("]", this.zoomDesign) - Mousetrap.bind("[", this.zoomPage) + this.$mousetrap.bind("up", this.animationSpeedUp) + this.$mousetrap.bind("down", this.animationSlowDown) + this.$mousetrap.bind("left", this.animationReverse) + this.$mousetrap.bind("right", this.animationForward) + this.$mousetrap.bind("pagedown", this.animationPreviousCommand) + this.$mousetrap.bind("pageup", this.animationNextCommand) + this.$mousetrap.bind("space", this.toggleAnimation) + this.$mousetrap.bind("+", this.animationForwardOneStitch) + this.$mousetrap.bind("-", this.animationBackwardOneStitch) + this.$mousetrap.bind("]", this.zoomDesign) + this.$mousetrap.bind("[", this.zoomPage) this.svg.on('zoom', this.resizeCursor) - this.resizeCursor() inkStitch.get('page_specs').then(response => { this.page_specs = response.data this.generatePage() }) + this.start() }) } diff --git a/electron/src/renderer/assets/style/simulator.css b/electron/src/renderer/assets/style/simulator.css index 64047a7e..e938cbe3 100644 --- a/electron/src/renderer/assets/style/simulator.css +++ b/electron/src/renderer/assets/style/simulator.css @@ -5,11 +5,10 @@ * Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details. * */ - -* { - box-sizing: border-box; + * { + padding: 1px; + margin: 1px; } - .loading-icon { text-align: center; margin-bottom: 1rem; @@ -32,7 +31,7 @@ button { align-items: flex-start; text-align: center; cursor: default; - background-color: buttonface; + background: linear-gradient(0deg, rgba(169,169,169,1) 0%, rgba(255,255,255,1) 68%, rgba(227,227,227,1) 100%); box-sizing: border-box; padding: 2px 6px 3px; border-width: 2px; @@ -183,7 +182,7 @@ button.pressed { } .vue-slider { - height: 25px !important; + height: 10px !important; margin-bottom: 14px; } @@ -203,7 +202,7 @@ button.pressed { margin-right: 10px; } -.slider-container::v-deep .vue-slider-mark-step { +.slider-container :deep(.vue-slider-mark-step) { width: 2px; height: 20px; border-radius: 2px; @@ -212,26 +211,26 @@ button.pressed { box-shadow: inset 1px 0 1px #ffffffbd, inset -1px 0 1px black; } -.slider-container::v-deep .vue-slider-mark:first-child .vue-slider-mark-step, -.slider-container::v-deep .vue-slider-mark:last-child .vue-slider-mark-step { +.slider-container :deep(.vue-slider-mark:first-child .vue-slider-mark-step), +.slider-container :deep(.vue-slider-mark:last-child .vue-slider-mark-step) { display: block; } -.slider-container::v-deep .vue-slider-rail { +.slider-container :deep(.vue-slider-rail) { border: 1px solid #dedede; } -.slider-container::v-deep .vue-slider-process { +.slider-container :deep(.vue-slider-process) { border-radius: 0; box-shadow: inset 0px 2px 2px #ffffff80, inset 0px -2px 2px #0000002e; } -.slider-container::v-deep .vue-slider-process:first-child { +.slider-container :deep(.vue-slider-process:first-child) { border-top-left-radius: 15px; border-bottom-left-radius: 15px; } -.slider-container::v-deep .vue-slider-process:nth-last-child(3) { +.slider-container :deep(.vue-slider-process:nth-last-child(3)) { border-top-right-radius: 15px; border-bottom-right-radius: 15px; } @@ -247,20 +246,20 @@ button.pressed { } .slider-label-trim { - transform: scale(1, 0.75) translate(-50%, -9px); + transform: scale(1, 0.75) translate(-50%, -9px) !important;; } .slider-label-stop { font-size: 1.2rem; - transform: translate(-50%, 12px); + transform: translate(-50%, 12px) !important;; } .slider-label-jump { - transform: translate(-50%, -50px); + transform: translate(-50%, -50px) !important;; } .slider-label-color-change { - transform: translate(-50%, 10px); + transform: translate(-50%, 10px) !important;; } .current-stitch-input { @@ -286,23 +285,23 @@ button.pressed { /* we need ::v-deep here because the svg tag is added by svg.js and so Vue can't add the data-v-* attribute */ -div.simulator::v-deep svg.simulation { +div.simulator :deep(svg.simulation) { flex-grow: 1; flex-shrink: 1; order: -2; margin-bottom: -48px; } -div.simulator::v-deep svg.simulation-scale { +div.simulator :deep(svg.simulation-scale) { height: 50px; order: -1; margin-left: 5px; } -div.simulator::v-deep .simulation-scale-label { +div.simulator :deep(.simulation-scale-label) { font-size: 14px; } -div.simulator::v-deep .cursor { +div.simulator :deep(.cursor) { /* not sure what to add here to make it more visible */ } diff --git a/electron/src/renderer/components/InstallPalettes.vue b/electron/src/renderer/components/InstallPalettes.vue deleted file mode 100644 index 3608f858..00000000 --- a/electron/src/renderer/components/InstallPalettes.vue +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - Install Palettes - - - - Ink/Stitch can install palettes for Inkscape matching the thread colors from popular machine embroidery thread manufacturers. - - - - - - If you are not sure which file path to choose, click on install directly. In most cases Ink/Stitch will guess the correct path. - - - - - mdi-palette - Install - - - Cancel - - - - - - - Installation Completed - - - - - Inkscape palettes have been installed. Please restart Inkscape to load the new palettes. - - - - - Done - - - - - - - Installation Failed - - - - Inkscape add-on installation failed - - - {{ error }} - - - - Try again - - - Cancel - - - - - - - - - diff --git a/electron/src/renderer/components/NotFound.vue b/electron/src/renderer/components/NotFound.vue new file mode 100644 index 00000000..4accf901 --- /dev/null +++ b/electron/src/renderer/components/NotFound.vue @@ -0,0 +1,12 @@ + + + + Oops, it looks like the page you're looking for doesn't exist. + diff --git a/electron/src/renderer/components/Preferences.vue b/electron/src/renderer/components/Preferences.vue index f68c942d..101f1b8a 100644 --- a/electron/src/renderer/components/Preferences.vue +++ b/electron/src/renderer/components/Preferences.vue @@ -1,13 +1,22 @@ + + - + - + Ink/Stitch Settings - + This SVG @@ -16,16 +25,16 @@ - - + + - - Minimum jump stitch length + + Minimum jump stitch length Jump stitches smaller than this will be treated as normal stitches. @@ -45,8 +54,8 @@ - - Minimum stitch length + + Minimum stitch length Drop stitches smaller than this value. @@ -66,16 +75,16 @@ - - + + - - Default minimum jump stitch length + + Default minimum jump stitch length Used for new SVGs. @@ -90,8 +99,8 @@ - - Default minimum stitch length + + Default minimum stitch length Used for new SVGs. @@ -106,8 +115,8 @@ - - Stitch plan cache size + + Stitch plan cache size The greater the number, the more stitch plans can be cached, speeding up stitch plan calculation. Default: 100 @@ -125,8 +134,8 @@ - - + + done @@ -136,8 +145,7 @@