Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed #575 (Improvement of text palette) #578

Merged
merged 6 commits into from
Jan 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions activities/Fototoon.activity/js/toon.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,17 +573,21 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct
var bold = box.getSelectedGlobe().getTextViewer().toggleBold();
if (bold) {
editor.style.fontWeight = 'bold';
document.getElementById("text-set-bold").style.backgroundColor = "grey";
} else {
editor.style.fontWeight = 'normal';
document.getElementById("text-set-bold").style.backgroundColor = "";
};
});

this._textpalette.italicTextBtn.addEventListener('click', function(e) {
var italic = box.getSelectedGlobe().getTextViewer().toggleItalic();
if (italic) {
editor.style.fontStyle = 'italic';
document.getElementById("text-set-italic").style.backgroundColor = "grey";
} else {
editor.style.fontStyle = 'normal';
document.getElementById("text-set-italic").style.backgroundColor = "";
};
});

Expand Down Expand Up @@ -837,6 +841,19 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct
};

this.setColor = function(color) {
let color_class = document.getElementsByClassName("color-picker");
for(let index=0; index<=9; index++)
{
if(color_class[index].value == this._color)
{
color_class[index].style.border = "2px solid white";
}
if(color_class[index].value == color)
{
color_class[index].style.border = "5px solid #696969";
}

}
this._color = color;
this.update();
return this._color;
Expand Down Expand Up @@ -875,15 +892,32 @@ define(["easel","sugar-web/datastore","sugar-web/env","webL10n","humane"], funct
// (used when a globe is selected)
editor.style.fontSize = this._size + 'px';
editor.style.color = this._color;
let color_class = document.getElementsByClassName("color-picker");
for(let index=0; index<=9; index++)
{
if(color_class[index].value == this._color)
{
color_class[index].style.border = "5px solid #696969";
}
else
{
color_class[index].style.border = "2px solid white";
}

}
if (this._italic) {
editor.style.fontStyle = 'italic';
document.getElementById("text-set-italic").style.backgroundColor = "grey";
} else {
editor.style.fontStyle = 'normal';
document.getElementById("text-set-italic").style.backgroundColor = "";
};
if (this._bold) {
editor.style.fontWeight = 'bold';
document.getElementById("text-set-bold").style.backgroundColor = "grey";
} else {
editor.style.fontWeight = 'normal';
document.getElementById("text-set-bold").style.backgroundColor = "";
};
};

Expand Down