Exemplo n.º 1
0
  public ArrayList<Integer> createRasterLines() {
    float scale = editorView.getmScaleFactor();
    ArrayList<Integer> gridLines = new ArrayList<Integer>();

    for (int i = 0; i < horizontalRasterCT / scale; i++) {
      gridLines.add(
          (Integer)
              (i * RASTER_HORIZONTAL_WIDTH
                  - RASTER_HORIZONTAL_WIDTH / 2
                  + mOffsetX % RASTER_HORIZONTAL_WIDTH
                  - mOffsetX));
    }

    return gridLines;
  }
Exemplo n.º 2
0
  public void draw(Canvas canvas) {
    if (rasterOn) {
      horizontalRasterCT = (canvas.getWidth() / RASTER_HORIZONTAL_WIDTH) + 3;

      Paint paint = new Paint();
      paint.setPathEffect(new DashPathEffect(new float[] {10, 3, 6, 3}, 1));
      float scale = editorView.getmScaleFactor();

      if ((snapMode == SNAP_OFF) || (snapMode == SNAP_RASTER)) {
        paint.setColor(Color.BLUE);

        ArrayList<Integer> gridLines = createRasterLines();

        for (int i = 0; i < gridLines.size(); i++) {
          canvas.drawLine(
              gridLines.get(i),
              (int) ((0 - mOffsetY) / scale),
              gridLines.get(i),
              (int) ((canvas.getHeight() - mOffsetY) / scale),
              paint);
        }
      }

      if (snapMode == SNAP_GRID) {
        paint.setColor(Color.RED);

        for (AbstractElement e : tweetFlow.getmElements().values()) {
          if (e instanceof ServiceRequest) {
            canvas.drawLine(
                e.getMiddleX(),
                (int) ((0 - mOffsetY) / scale),
                e.getMiddleX(),
                (int) ((canvas.getHeight() - mOffsetY) / scale),
                paint);
          }
        }
      }
    }
  }