MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / pointerPressed

Method pointerPressed

CodenameOne/src/com/codename1/ui/List.java:1777–1811  ·  view source on GitHub ↗
(int x, int y)

Source from the content-addressed store, hash-verified

1775
1776 /// {@inheritDoc}
1777 @Override
1778 public void pointerPressed(int x, int y) {
1779 if (!isEnabled()) {
1780 return;
1781 }
1782 if (fixedSelection > FIXED_NONE_BOUNDRY) {
1783 // for a fixed list we need to store the initial drag position
1784 if (isSmoothScrolling()) {
1785 if (orientation != HORIZONTAL) {
1786 fixedDraggedPosition = y;
1787 } else {
1788 fixedDraggedPosition = x;
1789 }
1790 if (isDragActivated()) {
1791 int selected = getCurrentSelected();
1792 model.setSelectedIndex(selected);
1793 fixedDraggedMotion = null;
1794 fixedDraggedAnimationPosition = 0;
1795 }
1796 fixedDraggedSelection = getModel().getSelectedIndex();
1797 }
1798 }
1799 // prevent a hover event from activating the drag in case of a click screen,
1800 // this is essential for the Storm device
1801 setDragActivated(false);
1802 int current = model.getSelectedIndex();
1803 int selection = pointerSelect(x, y);
1804
1805 if (selection > -1 && fixedSelection < FIXED_NONE_BOUNDRY) {
1806 model.setSelectedIndex(selection);
1807 }
1808 fireOnRelease = current == selection;
1809
1810 super.pointerPressed(x, y);
1811 }
1812
1813 /// {@inheritDoc}
1814 @Override

Callers 4

actionPerformedMethod · 0.45
restoreContentPaneMethod · 0.45
pointerPressMethod · 0.45
testSideMenuCloseNPEMethod · 0.45

Calls 9

getCurrentSelectedMethod · 0.95
getModelMethod · 0.95
pointerSelectMethod · 0.95
isDragActivatedMethod · 0.80
setDragActivatedMethod · 0.80
isEnabledMethod · 0.65
setSelectedIndexMethod · 0.65
getSelectedIndexMethod · 0.65
isSmoothScrollingMethod · 0.45

Tested by 2

pointerPressMethod · 0.36
testSideMenuCloseNPEMethod · 0.36