Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PlayWallDesktop
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PlayWall
PlayWallDesktop
Commits
ec6ff3e6
Commit
ec6ff3e6
authored
4 years ago
by
Tobias Ullerich
Browse files
Options
Downloads
Patches
Plain Diff
#160 - Cleanup code
parent
6ce51f2e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
PlayWallCore/src/main/java/de/tobias/playpad/project/page/Page.java
+12
-4
12 additions, 4 deletions
...re/src/main/java/de/tobias/playpad/project/page/Page.java
with
12 additions
and
4 deletions
PlayWallCore/src/main/java/de/tobias/playpad/project/page/Page.java
+
12
−
4
View file @
ec6ff3e6
...
...
@@ -254,7 +254,7 @@ public class Page {
final
int
rows
=
getProject
().
getSettings
().
getRows
();
for
(
int
i
=
0
;
i
<
rows
;
i
++)
{
insertPad
Into
(
columns
,
i
,
rows
*
columns
);
insertPad
AndShiftSuccessor
(
columns
,
i
,
rows
*
columns
);
}
}
...
...
@@ -263,13 +263,21 @@ public class Page {
final
int
rows
=
getProject
().
getSettings
().
getRows
()
-
1
;
for
(
int
i
=
0
;
i
<
columns
;
i
++)
{
insertPad
Into
(
columns
,
i
,
rows
*
columns
);
insertPad
AndShiftSuccessor
(
columns
,
i
,
rows
*
columns
);
}
}
private
void
insertPadInto
(
int
x
,
int
y
,
int
maxPad
)
{
/**
* Insert a pad into given (x, y). Moves all other pads one position ahead.
*
* @param x x
* @param y y
* @param lastPadIndex index of the last pad on the page
*/
private
void
insertPadAndShiftSuccessor
(
int
x
,
int
y
,
int
lastPadIndex
)
{
int
position
=
getPadPosition
(
x
,
y
);
for
(
int
i
=
maxPad
-
1
;
i
>=
position
;
i
--)
{
// Going backwards to avoid overwriting the next pad when updating the position of the current one.
for
(
int
i
=
lastPadIndex
-
1
;
i
>=
position
;
i
--)
{
getPad
(
i
).
setPosition
(
i
+
1
);
}
getPad
(
position
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment