Skip to content

Commit

Permalink
Fixed text tool (dev/text-handler.js) colors
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Sep 24, 2018
1 parent bcf8de5 commit 31823fd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
11 changes: 11 additions & 0 deletions dev/text-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var textHandler = {
text: '',
selectedFontFamily: 'Arial',
selectedFontSize: '15',
lastFillStyle: '',
onShapeSelected: function() {
tempContext.canvas.style.cursor = 'text';
this.x = this.y = this.pageX = this.pageY = 0;
Expand Down Expand Up @@ -105,6 +106,16 @@ var textHandler = {
mouseup: function(e) {},
mousemove: function(e) {},
showOrHideTextTools: function(show) {
if (show === 'hide') {
if (this.lastFillStyle.length) {
fillStyle = this.lastFillStyle;
this.lastFillStyle = '';
}
} else if (!this.lastFillStyle.length) {
this.lastFillStyle = fillStyle;
fillStyle = 'black';
}

this.fontFamilyBox.style.display = show == 'show' ? 'block' : 'none';
this.fontSizeBox.style.display = show == 'show' ? 'block' : 'none';

Expand Down
13 changes: 12 additions & 1 deletion widget.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Last time updated: 2018-09-21 6:17:04 PM UTC
// Last time updated: 2018-09-22 5:01:57 AM UTC

// _______________
// Canvas-Designer
Expand Down Expand Up @@ -1756,6 +1756,7 @@
text: '',
selectedFontFamily: 'Arial',
selectedFontSize: '15',
lastFillStyle: '',
onShapeSelected: function() {
tempContext.canvas.style.cursor = 'text';
this.x = this.y = this.pageX = this.pageY = 0;
Expand Down Expand Up @@ -1859,6 +1860,16 @@
mouseup: function(e) {},
mousemove: function(e) {},
showOrHideTextTools: function(show) {
if (show === 'hide') {
if (this.lastFillStyle.length) {
fillStyle = this.lastFillStyle;
this.lastFillStyle = '';
}
} else if (!this.lastFillStyle.length) {
this.lastFillStyle = fillStyle;
fillStyle = 'black';
}

this.fontFamilyBox.style.display = show == 'show' ? 'block' : 'none';
this.fontSizeBox.style.display = show == 'show' ? 'block' : 'none';

Expand Down

0 comments on commit 31823fd

Please sign in to comment.