From 093327088fe2d6b14a8a0c40074d511072eb7524 Mon Sep 17 00:00:00 2001 From: Justin Hawkins Date: Sun, 3 Apr 2022 18:37:31 +0930 Subject: [PATCH] Clean up changelog and javascript --- CHANGELOG.md | 2 ++ README.md | 2 ++ web/data/editor.html | 57 ++++++++++++++++++++++++++++++++++++-------- 3 files changed, 51 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61d246f..7970e2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file. - Add preview thumbnails for each upload - Add feature to hold an image for upload, so the user can choose to upload it or not +- Add simple image editor to add text captions +- Discord server created: https://discord.gg/eErG9sntbZ ## [v0.11.2] - 2021-10-19 diff --git a/README.md b/README.md index 07246cc..b5966b7 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ This program automatically uploads new screenshots that appear in a folder on yo Point it at your Steam screenshot folder, or similar, and shortly after you hit your screenshot hotkey the screenshot will appear in your discord chat. +Need help? Join our discord: https://discord.gg/eErG9sntbZ + ## What you'll need * A folder where screenshots are stored diff --git a/web/data/editor.html b/web/data/editor.html index 9966bb6..ee2eeb9 100644 --- a/web/data/editor.html +++ b/web/data/editor.html @@ -10,7 +10,7 @@
- +
@@ -19,6 +19,7 @@
+
@@ -78,6 +79,7 @@ function editor() { return { img_data: "", scaleFactor: 0.5, toolbar: null, + crop_state: {}, colours: [ 'red', 'blue', 'green', 'white', 'yellow', 'black', 'purple'], canvas_style: "", @@ -137,16 +139,55 @@ function editor() { el.set('stroke', colour); } -//["stroke","strokeWidth","fill","fontFamily","fontSize","fontWeight","fontStyle","underline","overline","linethrough","deltaY","textBackgroundColor"] - - }); canvas.renderAll(); }, - // crop mode + // crop mode - XXX not yet implemented crop() { - + this.toolbar = 'crop'; + this.crop_state = {}; + canvas.selection = false; // disable drag drop selection so we can see the crop rect + let self = this; + this.crop_state.rectangle = new fabric.Rect({ + fill: 'transparent', + stroke: '#ccc', + strokeDashArray: [2, 2], + visible: false + }); + console.log(this.crop_state.rectangle); + var container = document.getElementById('c').getBoundingClientRect(); + canvas.add(this.crop_state.rectangle); + canvas.on("mouse:down", function(event) { + if(1) { + console.log('wow mouse is down', event.e); + self.crop_state.rectangle.width = 2; + self.crop_state.rectangle.height = 2; + self.crop_state.rectangle.left = event.e.offsetX / self.scaleFactor; + self.crop_state.rectangle.top = event.e.offsetY / self.scaleFactor; + self.crop_state.rectangle.visible = true; + self.crop_state.mouseDown = event.e; + canvas.bringToFront(self.crop_state.rectangle); + } + }); + // draw the rectangle as the mouse is moved after a down click + canvas.on("mouse:move", function(event) { + if(self.crop_state.mouseDown && 1) { + + self.crop_state.rectangle.width = event.e.offsetX / self.scaleFactor - self.crop_state.rectangle.left; + self.crop_state.rectangle.height = event.e.offsetY / self.scaleFactor - self.crop_state.rectangle.top; + canvas.renderAll(); + + } + }); + // when mouse click is released, end cropping mode + canvas.on("mouse:up", function() { + console.log('MOUSE UP'); + self.crop_state.mouseDown = null; + }); + }, + apply_crop() { + console.log(this.crop_state.rectangle.width); }, apply() { @@ -163,14 +204,10 @@ function editor() { console.log(json); window.location = '/uploads.html'; }) - }, cancel() { window.location = '/uploads.html'; }, - - - } }