()
| 7295 | |
| 7296 | /// {@inheritDoc} |
| 7297 | @Override |
| 7298 | public boolean animate() { |
| 7299 | if (!visible) { |
| 7300 | return false; |
| 7301 | } |
| 7302 | Image bgImage = getStyle().getBgImage(); |
| 7303 | boolean animateBackground = bgImage != null && bgImage.isAnimation() && bgImage.animate(); |
| 7304 | Motion m = getAnimationMotion(); |
| 7305 | |
| 7306 | // perform regular scrolling |
| 7307 | if (m != null && destScrollY != -1 && destScrollY != getScrollY()) { |
| 7308 | // change the variable directly for efficiency both in removing redundant |
| 7309 | // repaints and scroll checks |
| 7310 | setScrollY(m.getValue()); |
| 7311 | if (destScrollY == scrollY) { |
| 7312 | destScrollY = -1; |
| 7313 | deregisterAnimatedInternal(); |
| 7314 | updateTensileHighlightIntensity(0, 0, m != null); |
| 7315 | } |
| 7316 | return true; |
| 7317 | } |
| 7318 | boolean animateY = false; |
| 7319 | boolean animateX = false; |
| 7320 | // perform the dragging motion if exists |
| 7321 | if (draggedMotionY != null) { |
| 7322 | // change the variable directly for efficiency both in removing redundant |
| 7323 | // repaints and scroll checks |
| 7324 | int dragVal = draggedMotionY.getValue(); |
| 7325 | int iv = getInvisibleAreaUnderVKB(); |
| 7326 | int edge = (getScrollDimension().getHeight() - getHeight() + iv); |
| 7327 | if (!draggedMotionY.isFinished() |
| 7328 | && draggedMotionY.isDecayMotion() |
| 7329 | && draggedMotionY.countAvailableVelocitySamplingPoints() > 1) { |
| 7330 | final Motion origDraggedMotionY = draggedMotionY; |
| 7331 | if (dragVal < 0) { |
| 7332 | // Once past 0, decay motion is too slow. We need to hit it with heavy friction. |
| 7333 | draggedMotionY = Motion.createFrictionMotion( |
| 7334 | dragVal, |
| 7335 | -getTensileLength(), |
| 7336 | (int) origDraggedMotionY.getVelocity(), |
| 7337 | 0.01f |
| 7338 | ); |
| 7339 | draggedMotionY.start(); |
| 7340 | origDraggedMotionY.finish(); |
| 7341 | } else if (snapToGrid |
| 7342 | && Math.abs(origDraggedMotionY.getVelocity()) * 1000 < CN.convertToPixels(5)) { |
| 7343 | // If snapToGrid is enabled, the grid snap should take precendent if the drag is slower |
| 7344 | // than some threshold. |
| 7345 | draggedMotionY = Motion.createFrictionMotion( |
| 7346 | dragVal, |
| 7347 | origDraggedMotionY.getDestinationValue(), |
| 7348 | (int) origDraggedMotionY.getVelocity(), |
| 7349 | 0.1f |
| 7350 | ); |
| 7351 | draggedMotionY.start(); |
| 7352 | origDraggedMotionY.finish(); |
| 7353 | } |
| 7354 | } |
nothing calls this directly
no test coverage detected