diff --git a/css/_tools-menu.scss b/css/_tools-menu.scss index 687f98e..60cc23a 100644 --- a/css/_tools-menu.scss +++ b/css/_tools-menu.scss @@ -144,7 +144,7 @@ background-color: $basehover; color:$basetext; font-size:14px; - width:20%; + width:22%; border-radius:0 5px 5px 5px; img { diff --git a/images/ToolTutorials/eyedropper-tutorial.gif b/images/ToolTutorials/eyedropper-tutorial.gif new file mode 100644 index 0000000..3fed0db Binary files /dev/null and b/images/ToolTutorials/eyedropper-tutorial.gif differ diff --git a/images/ToolTutorials/fill-tutorial.gif b/images/ToolTutorials/fill-tutorial.gif new file mode 100644 index 0000000..d56286d Binary files /dev/null and b/images/ToolTutorials/fill-tutorial.gif differ diff --git a/images/ToolTutorials/lassoselect-tutorial.gif b/images/ToolTutorials/lassoselect-tutorial.gif new file mode 100644 index 0000000..b33243a Binary files /dev/null and b/images/ToolTutorials/lassoselect-tutorial.gif differ diff --git a/images/ToolTutorials/magicwand-tutorial.gif b/images/ToolTutorials/magicwand-tutorial.gif new file mode 100644 index 0000000..4a00f48 Binary files /dev/null and b/images/ToolTutorials/magicwand-tutorial.gif differ diff --git a/images/ToolTutorials/pan-tutorial.gif b/images/ToolTutorials/pan-tutorial.gif new file mode 100644 index 0000000..080e6a0 Binary files /dev/null and b/images/ToolTutorials/pan-tutorial.gif differ diff --git a/images/ToolTutorials/rectselect-tutorial.gif b/images/ToolTutorials/rectselect-tutorial.gif new file mode 100644 index 0000000..89eef92 Binary files /dev/null and b/images/ToolTutorials/rectselect-tutorial.gif differ diff --git a/js/Tool.js b/js/Tool.js index 0558b57..647cf77 100644 --- a/js/Tool.js +++ b/js/Tool.js @@ -41,6 +41,7 @@ class Tool { if (this.mainButton != undefined) { // Timer to show the tutorial Events.on("mouseenter", this.mainButton, function(){ + this.setTutorial(); this.tutorialTimer = setTimeout(this.showTutorial.bind(this), 750) }.bind(this)); @@ -57,8 +58,19 @@ class Tool { } showTutorial() { - this.setTutorial(); - this.toolTutorial.style.top = this.mainButton.getBoundingClientRect().top - 48 + "px"; + let tutorialRect = this.toolTutorial.getBoundingClientRect(); + + console.log("Top button: " + (this.mainButton.getBoundingClientRect().top - 48 + (tutorialRect.bottom - tutorialRect.top))); + console.log("Tutorial height: " + (tutorialRect.bottom - tutorialRect.top)); + console.log("Screen height: " + window.innerHeight); + + if ((this.mainButton.getBoundingClientRect().top - 48 + (tutorialRect.bottom - tutorialRect.top)) > window.innerHeight) { + console.log("YO"); + this.toolTutorial.style.top = window.innerHeight - 48 - (tutorialRect.bottom - tutorialRect.top) + "px"; + } + else { + this.toolTutorial.style.top = this.mainButton.getBoundingClientRect().top - 48 + "px"; + } this.toolTutorial.className = "fade-in"; } hideTutorial() { diff --git a/js/tools/EllipseTool.js b/js/tools/EllipseTool.js index f5710ec..c0d4208 100644 --- a/js/tools/EllipseTool.js +++ b/js/tools/EllipseTool.js @@ -1,3 +1,6 @@ +/** TODO + * - Increase the sensibility of the tool depending on the width / height ratio to avoid holes + */ class EllipseTool extends ResizableTool { // Saving the empty rect svg emptyEllipseSVG = document.getElementById("ellipse-empty-button-svg"); diff --git a/js/tools/EyeDropperTool.js b/js/tools/EyeDropperTool.js index d28f829..ef9ceef 100644 --- a/js/tools/EyeDropperTool.js +++ b/js/tools/EyeDropperTool.js @@ -6,6 +6,15 @@ class EyeDropperTool extends Tool { super(name, options); Events.on('click', this.mainButton, switchFunction, this); + + this.resetTutorial(); + this.addTutorialTitle("Eyedropper tool"); + this.addTutorialKey("E", " to select the lasso selection tool"); + this.addTutorialKey("Left drag", " to preview the picked colour"); + this.addTutorialKey("Aòt + left drag", " to preview the picked colour"); + this.addTutorialKey("Left click", " to select a colour"); + this.addTutorialKey("Alt + click", " to select a colour"); + this.addTutorialImg("eyedropper-tutorial.gif"); } onStart(mousePos, target) { diff --git a/js/tools/FillTool.js b/js/tools/FillTool.js index 26cc1be..0043f66 100644 --- a/js/tools/FillTool.js +++ b/js/tools/FillTool.js @@ -3,6 +3,12 @@ class FillTool extends DrawingTool { super(name, options); Events.on('click', this.mainButton, switchFunction, this); + + this.resetTutorial(); + this.addTutorialTitle("Fill tool"); + this.addTutorialKey("F", " to select the fill tool"); + this.addTutorialKey("Left click", " to fill a contiguous area"); + this.addTutorialImg("fill-tutorial.gif"); } onStart(mousePos, target) { diff --git a/js/tools/LassoSelectionTool.js b/js/tools/LassoSelectionTool.js index 9a35ed0..9be1f6e 100644 --- a/js/tools/LassoSelectionTool.js +++ b/js/tools/LassoSelectionTool.js @@ -1,9 +1,24 @@ +/** TODO + * - Move the selection only if the user started dragging inside of it + */ class LassoSelectionTool extends SelectionTool { currentPixels = []; constructor (name, options, switchFunc, moveTool) { super(name, options, switchFunc, moveTool); Events.on('click', this.mainButton, switchFunc, this); + + this.resetTutorial(); + this.addTutorialTitle("Lasso selection tool"); + this.addTutorialKey("Q", " to select the lasso selection tool"); + this.addTutorialKey("Left drag", " to select an area"); + this.addTutorialKey("Left drag", " to move a selection"); + this.addTutorialKey("Esc", " to cancel a selection") + this.addTutorialKey("Click", " outside the selection to cancel it") + this.addTutorialKey("CTRL+C", " to copy a selection") + this.addTutorialKey("CTRL+V", " to paste a selection") + this.addTutorialKey("CTRL+X", " to cut a selection") + this.addTutorialImg("lassoselect-tutorial.gif"); } onStart(mousePos, mouseTarget) { diff --git a/js/tools/MagicWandTool.js b/js/tools/MagicWandTool.js index 78f714d..d695ada 100644 --- a/js/tools/MagicWandTool.js +++ b/js/tools/MagicWandTool.js @@ -3,6 +3,17 @@ class MagicWandTool extends SelectionTool { constructor (name, options, switchFunc, moveTool) { super(name, options, switchFunc, moveTool); Events.on('click', this.mainButton, switchFunc, this); + + this.resetTutorial(); + this.addTutorialTitle("Magic wand tool"); + this.addTutorialKey("W", " to select the magic wand tool"); + this.addTutorialKey("Left click", " to select a contiguous area"); + this.addTutorialKey("Esc", " to cancel a selection"); + this.addTutorialKey("Click", " outside the selection to cancel it"); + this.addTutorialKey("CTRL+C", " to copy a selection"); + this.addTutorialKey("CTRL+V", " to paste a selection"); + this.addTutorialKey("CTRL+X", " to cut a selection"); + this.addTutorialImg("magicwand-tutorial.gif"); } onEnd(mousePos, mouseTarget) { diff --git a/js/tools/PanTool.js b/js/tools/PanTool.js index 628de71..1a952a0 100644 --- a/js/tools/PanTool.js +++ b/js/tools/PanTool.js @@ -4,6 +4,13 @@ class PanTool extends Tool { super(name, options); Events.on('click', this.mainButton, switchFunction, this); + + this.resetTutorial(); + this.addTutorialTitle("Pan tool"); + this.addTutorialKey("P", " to select the lasso selection tool"); + this.addTutorialKey("Left drag", " to move the viewport"); + this.addTutorialKey("Space + drag", " to move the viewport"); + this.addTutorialImg("pan-tutorial.gif"); } onStart(mousePos, target) { diff --git a/js/tools/RectangularSelectionTool.js b/js/tools/RectangularSelectionTool.js index 9dafadb..7f0040f 100644 --- a/js/tools/RectangularSelectionTool.js +++ b/js/tools/RectangularSelectionTool.js @@ -3,6 +3,18 @@ class RectangularSelectionTool extends SelectionTool { constructor (name, options, switchFunc, moveTool) { super(name, options, switchFunc, moveTool); Events.on('click', this.mainButton, switchFunc, this); + + this.resetTutorial(); + this.addTutorialTitle("Rectangular selection tool"); + this.addTutorialKey("M", " to select the rectangular selection tool"); + this.addTutorialKey("Left drag", " to select a rectangular area"); + this.addTutorialKey("Left drag", " to move a selection"); + this.addTutorialKey("Esc", " to cancel a selection"); + this.addTutorialKey("Click", " outside the selection to cancel it"); + this.addTutorialKey("CTRL+C", " to copy a selection"); + this.addTutorialKey("CTRL+V", " to paste a selection"); + this.addTutorialKey("CTRL+X", " to cut a selection"); + this.addTutorialImg("rectselect-tutorial.gif"); } onStart(mousePos, mouseTarget) {