Skip to content

Commit

Permalink
general little enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
vegegoku committed Nov 18, 2024
1 parent f601b7e commit 2a2c994
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -519,12 +519,12 @@ public Card appendChild(PrefixAddOn<?> prefix) {

@Override
public PostfixElement getPostfixElement() {
return PostfixElement.of(header.get().element());
return PostfixElement.of(header.get().getMainHeader().element());
}

@Override
public PrefixElement getPrefixElement() {
return PrefixElement.of(header.get().element());
return PrefixElement.of(header.get().getMainHeader().element());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ private void initTimer() {
new Timer() {
@Override
public void run() {
if (currentValue < countTo) {
currentValue += increment;
if (currentValue != countTo) {
if (countFrom < countTo) {
currentValue += increment;
} else {
currentValue -= increment;
}
notifyCount();
} else {
cancel();
Expand All @@ -82,22 +86,33 @@ public void run() {
}

private void notifyCount() {
if (currentValue <= countTo) {
countHandler.onCount(currentValue);
} else {
countHandler.onCount(countTo);
}
countHandler.onCount(currentValue);
}

/**
* Starts the counter, if the counter is already counting it will reset and start counting from
* the beginning
*/
public void startCounting() {
if (timer.isRunning()) timer.cancel();
public Counter startCounting() {
if (timer.isRunning()) {
timer.cancel();
}
this.currentValue = countFrom;
countHandler.onCount(countFrom);
timer.scheduleRepeating(interval);
return this;
}

/**
* Stops the counter if it is running
*
* @return same counter instance.
*/
public Counter stopCounting() {
if (this.timer.isRunning()) {
this.timer.cancel();
}
return this;
}

/** Use to add an implementation of a handler to be called after each count */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
align-items: center;}

.dui-btn-text {
order: var(--dui-btn-text-order);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ fieldset.dui {
order: 40;
font: var(--dui-form-field-postfix-font);
line-height: var(--dui-form-field-postfix-line-height);
display: flex;
}

.dui-form-field .dui-postfix-addon {
Expand Down Expand Up @@ -202,7 +203,7 @@ fieldset.dui {
gap: var(--dui-form-field-values-gap, var(--dui-spc-1));
border: var(--dui-form-field-input-border);
font: var(--dui-form-field-input-line-font);
line-height: var(--dui-form-field-input-line-hieght);
line-height: var(--dui-form-field-input-line-height);
overflow: var(--dui-form-input-overflow, hidden);
white-space: var(--dui-form-field-input-whitespace);
text-overflow: ellipsis;
Expand Down Expand Up @@ -728,7 +729,7 @@ textarea.dui-field-input {
border: none;
border-radius: var(--dui-form-field-wrapper-radius);
font: var(--dui-form-field-input-line-font);
line-height: var(--dui-form-field-input-line-hieght);
line-height: var(--dui-form-field-input-line-height);
overflow: var(--dui-form-input-overflow, hidden);
white-space: nowrap;
text-overflow: ellipsis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ body.dui {

--dui-form-field-input-height: 32px;
--dui-form-field-input-border: none;
--dui-form-field-input-line-hieght: 31px;
--dui-form-field-input-line-height: 31px;
--dui-form-field-input-line-font: var(--dui-font-regular);
--dui-form-field-input-text-indent: 5px;
--dui-form-field-messages-wrapper-padding: 0 5px 0 5px;
Expand Down

0 comments on commit 2a2c994

Please sign in to comment.