Starts a transition. * * Note: The translation animator takes full control over the parenting of the actors until the animation is complete. * When calling this function the actors may be parented in arbitrary ways, they will be reparented to the proper state.
(
// Entering by translation actors
enteringActors: Clutter.Actor[],
// global actors list
globalContext: Clutter.Actor[],
direction: number
)
| 40 | * When calling this function the actors may be parented in arbitrary ways, they will be reparented to the proper state. |
| 41 | */ |
| 42 | setTranslation( |
| 43 | // Entering by translation actors |
| 44 | enteringActors: Clutter.Actor[], |
| 45 | // global actors list |
| 46 | globalContext: Clutter.Actor[], |
| 47 | direction: number |
| 48 | ): void { |
| 49 | let translationY = this.container.translation_y; |
| 50 | let translationX = this.container.translation_x; |
| 51 | |
| 52 | // Determine visible area |
| 53 | const visibleArea = { |
| 54 | x1: Math.abs(translationX), |
| 55 | x2: Math.abs(translationX) + this.container.allocation.get_width(), |
| 56 | y1: Math.abs(translationY), |
| 57 | y2: Math.abs(translationY) + this.container.allocation.get_height(), |
| 58 | }; |
| 59 | |
| 60 | /** |
| 61 | * If Animation is already in progress we want to remove all actor that are not currently visible on the screen in order to reduce the distance needed to reach the final entering actors |
| 62 | */ |
| 63 | if (this.animationInProgress) { |
| 64 | this.container.remove_all_transitions(); |
| 65 | this.animationInProgress = false; |
| 66 | |
| 67 | // Foreach this.displayed child check if it's in visible bound and hide every one that are outisde and update the current translation accordingly in order to prevent any visible jump |
| 68 | this.container |
| 69 | .get_children() |
| 70 | .filter((actor) => actor.visible) |
| 71 | .forEach((actor) => { |
| 72 | const allocationBox = this.getTransformedBox(actor); |
| 73 | if (this.vertical) { |
| 74 | if (allocationBox.y2 < visibleArea.y1) { |
| 75 | actor.hide(); |
| 76 | translationY += InfinityTo0( |
| 77 | allocationBox.get_height() |
| 78 | ); |
| 79 | } |
| 80 | if (allocationBox.y1 > visibleArea.y2) { |
| 81 | actor.hide(); |
| 82 | } |
| 83 | } else { |
| 84 | if (allocationBox.x2 < visibleArea.x1) { |
| 85 | actor.hide(); |
| 86 | translationX += InfinityTo0( |
| 87 | allocationBox.get_width() |
| 88 | ); |
| 89 | } |
| 90 | if (allocationBox.x1 > visibleArea.x2) { |
| 91 | actor.hide(); |
| 92 | } |
| 93 | } |
| 94 | }); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * For each entering actors we want to be sure that: |
| 99 | * 1- their are the child of the container and visible |
nothing calls this directly
no test coverage detected