Skip to content

Commit

Permalink
remaining text features
Browse files Browse the repository at this point in the history
  • Loading branch information
chompa111 committed Jun 10, 2022
1 parent 3cb488e commit c4265ef
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
26 changes: 26 additions & 0 deletions src/main/java/graphical/basics/gobject/CodeBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,32 @@ public void removeLine(int index) {

}

public void removeLines(int i,int j) {
textGutter.removeLine(lineCounter - 2);
for(int x=i;x<=j;x++){
text.removeLine(x);
}
background.getLowerRightPoint().setY(background.getLowerRightPoint().getY() - (j-i+1)*textSize * 1.15);
backgroundShadow.getLowerRightPoint().setY(backgroundShadow.getLowerRightPoint().getY() - (j-i+1)*textSize * 1.15);
gutter.getLowerRightPoint().setY(gutter.getLowerRightPoint().getY() - (j-i+1)*textSize * 1.15);
gutterLine.getP2().setY(gutterLine.getP2().getY() - (j-i+1)*textSize * 1.15);
lineCounter-=(j-i+1);
}

public Task removeLinesAnimated(int i, int j) {
return text.removeLinesAnimated(i,j)
.parallel(background.getLowerRightPoint().move(0, -(j-i+1)*textSize * 1.15, Presentation.staticReference.seconds(1)))
.parallel(backgroundShadow.getLowerRightPoint().move(0, -(j-i+1)*textSize * 1.15, Presentation.staticReference.seconds(1)))
.parallel(gutter.getLowerRightPoint().move(0, -(j-i+1)*textSize * 1.15, Presentation.staticReference.seconds(1)))
.parallel(gutterLine.getP2().move(0, -(j-i+1)*textSize * 1.15, Presentation.staticReference.seconds(1)))
.parallel(Animation.fadeoutGrow(textGutter.getLinesAsGroup((lineCounter-2)-(j-i),lineCounter-2), Presentation.staticReference.seconds(0.75)))
.afterConclusion(()->{
textGutter.removeLines((lineCounter-2)-(j-i),lineCounter-2);
lineCounter-=(j-i+1);
});

}

public Task removeLineAnimated(int index) {
return text.removeLineAnimated(index)
.parallel(background.getLowerRightPoint().move(0, -textSize * 1.15, Presentation.staticReference.seconds(1)))
Expand Down
25 changes: 23 additions & 2 deletions src/main/java/graphical/basics/gobject/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,27 @@ public void removeLine(int index){
}
}

public void removeLines(int i, int j){
getLinesAsGroup(j+1,lines.size()-1).changeSetPosition(0,-(j-i+1)*font.getSize() * 1.15);
for (var lineToBeRemoved : getLines(i,j)){
lines.remove(lineToBeRemoved);
if(!lineToBeRemoved.getString().isBlank()){
remove(lineToBeRemoved);
}
}
}

public Task removeLinesAnimated(int i,int j){
return getLinesAsGroup(j+1,lines.size()-1).move(0,-(j-i+1)*font.getSize() * 1.15).afterConclusion(()->{
for (var lineToBeRemoved : getLines(i,j)){
lines.remove(lineToBeRemoved);
if(!lineToBeRemoved.getString().isBlank()){
remove(lineToBeRemoved);
}
}
});
}

public Task removeLineAnimated(int index){
var lineToBeRemoved=lines.get(index);
return getLinesAsGroup(index+1,lines.size()-1).move(0,-font.getSize() * 1.15).afterConclusion(()->{
Expand Down Expand Up @@ -120,14 +141,14 @@ public List<StringGobject> getLines() {
public List<StringGobject> getLines(int i, int j) {
var result = new ArrayList<StringGobject>();
for (int x = i; x <= j; x++) {
result.add(lines.get(i));
result.add(lines.get(x));
}
return result;
}

public Group getLinesAsGroup(int i, int j) {
var result = new ArrayList<Gobject>();
for (int x = i; x <= j; x++) {
for (int x = i; x <= j && x<lines.size(); x++) {
result.add(lines.get(x));
}
return new Group(result);
Expand Down

0 comments on commit c4265ef

Please sign in to comment.