MCPcopy Create free account
hub / github.com/ArtifexSoftware/mupdf / pan

Method pan

platform/java/example/Viewer.java:1198–1222  ·  view source on GitHub ↗
(int panx, int pany)

Source from the content-addressed store, hash-verified

1196 }
1197
1198 protected void pan(int panx, int pany) {
1199 Adjustable hadj = pageScroll.getHAdjustable();
1200 Adjustable vadj = pageScroll.getVAdjustable();
1201 int h = hadj.getValue();
1202 int v = vadj.getValue();
1203 int newh = h + panx;
1204 int newv = v + pany;
1205
1206 if (newh < hadj.getMinimum())
1207 newh = hadj.getMinimum();
1208 if (newh > hadj.getMaximum() - hadj.getVisibleAmount())
1209 newh = hadj.getMaximum() - hadj.getVisibleAmount();
1210 if (newv < vadj.getMinimum())
1211 newv = vadj.getMinimum();
1212 if (newv > vadj.getMaximum() - vadj.getVisibleAmount())
1213 newv = vadj.getMaximum() - vadj.getVisibleAmount();
1214
1215 if (newh == h && newv == v)
1216 return;
1217
1218 if (newh != h)
1219 hadj.setValue(newh);
1220 if (newv != v)
1221 vadj.setValue(newv);
1222 }
1223
1224 protected void smartMove(int direction, int moves) {
1225 cancelSearch();

Callers 3

keyReleasedMethod · 0.95
canvasKeyTypedMethod · 0.95
mouseWheelMovedMethod · 0.95

Calls 2

setValueMethod · 0.80
getValueMethod · 0.45

Tested by

no test coverage detected