Case 21704 - marketplace button formatting fixes

This commit is contained in:
Roxanne Skelly 2019-03-13 15:03:29 -07:00
parent 822e5ceb98
commit 42bf812019
2 changed files with 11 additions and 1 deletions

View file

@ -143,6 +143,16 @@ Original.Button {
horizontalAlignment: Text.AlignHCenter
text: control.text
Component.onCompleted: {
setTextPosition();
}
onTextChanged: {
setTextPosition();
}
function setTextPosition() {
// force TextMetrics to re-evaluate the text field and glyph sizes
// as for some reason it's not automatically being done.
buttonGlyphTextMetrics.text = buttonGlyph.text;
buttonTextMetrics.text = text;
if (control.buttonGlyph !== "") {
buttonText.x = buttonContentItem.width/2 - buttonTextMetrics.width/2 + (buttonGlyphTextMetrics.width + control.buttonGlyphRightMargin)/2;
} else {

View file

@ -298,7 +298,7 @@ Rectangle {
property bool isFreeSpecial: isStocking || isUpdate
enabled: isFreeSpecial || (availability === 'available')
buttonGlyph: (enabled && !isUpdate && (price > 0)) ? hifi.glyphs.hfc : ""
text: isUpdate ? "UPDATE FOR FREE" : (isStocking ? "FREE STOCK" : (enabled ? (price || "FREE") : availability))
text: isUpdate ? "UPDATE" : (isStocking ? "FREE STOCK" : (enabled ? (price || "FREE") : availability))
color: hifi.buttons.blue
buttonGlyphSize: 24