Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ExpandingPreviousNode.java
1 
16 package net.squiz.matrix.matrixtree;
17 
18 import net.squiz.matrix.core.*;
19 
20 public class ExpandingPreviousNode extends ExpandingNode {
21 
22  public ExpandingPreviousNode(int parentTotalAssets, int currentAssetsCount, int viewedAssetsCount) {
23  setParentTotalAssets(parentTotalAssets);
24  setCurrentAssetsCount(currentAssetsCount);
25  setViewedAssetsCount(viewedAssetsCount);
26 
27  int to = (getCurrentLoc()+AssetManager.getLimit());
28  if (to > parentTotalAssets) {
29  to = parentTotalAssets;
30  }
31  Asset expandingAsset = new ExpandingAsset(getName());
32  setUserObject(expandingAsset);
33  setCueModeName(Matrix.translate("asset_map_expanding_node_move_to_previous_set"));
34  }
35 
36  public int getStartLoc(int evtX, double boundsX) {
37  int res = evtX - (int)boundsX;
38  if (res >=0 && res <=12) {
39  // first img clicked, we will get previous set of nodes
40  if (getViewedAssetsCount() <= AssetManager.getLimit()) {
41  return 0;
42  } else {
43  return getViewedAssetsCount() - AssetManager.getLimit();
44  }
45  } else if (res >=13 && res <= 35) {
46  // second img clicked, get the first set of nodes
47  return 0;
48  } else {
49  return -1;
50  }
51  }
52 
53 }