예제 #1
0
        private void onTouchEnd()
        {
            mPath.lineTo(mLastX * PIXEL_SIZE, mLastY * PIXEL_SIZE);
            mBuffer.drawPath(mPath, mPaint);
            mPath.reset();
            Firebase segmentRef = mFirebaseRef.push();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String segmentName = segmentRef.getKey();
            string segmentName = segmentRef.Key;

            mOutstandingSegments.Add(segmentName);

            // create a scaled version of the segment, so that it matches the size of the board
            Segment segment = new Segment(mCurrentSegment.Color);

            foreach (Point point in mCurrentSegment.Points)
            {
                segment.addPoint((int)Math.Round(point.x / mScale), (int)Math.Round(point.y / mScale));
            }

            // Save our segment into Firebase. This will let other clients see the data and add it to their own canvases.
            // Also make a note of the outstanding segment name so we don't do a duplicate draw in our onChildAdded callback.
            // We can remove the name from mOutstandingSegments once the completion listener is triggered, since we will have
            // received the child added event by then.
            segmentRef.setValue(segment, new CompletionListenerAnonymousInnerClassHelper(this, segmentName));
        }
예제 #2
0
 private void onTouchStart(float x, float y)
 {
     mPath.reset();
     mPath.moveTo(x, y);
     mCurrentSegment = new Segment(mCurrentColor);
     mLastX          = (int)x / PIXEL_SIZE;
     mLastY          = (int)y / PIXEL_SIZE;
     mCurrentSegment.addPoint(mLastX, mLastY);
 }
예제 #3
0
        private void onTouchMove(float x, float y)
        {
            int x1 = (int)x / PIXEL_SIZE;
            int y1 = (int)y / PIXEL_SIZE;

            float dx = Math.Abs(x1 - mLastX);
            float dy = Math.Abs(y1 - mLastY);

            if (dx >= 1 || dy >= 1)
            {
                mPath.quadTo(mLastX * PIXEL_SIZE, mLastY * PIXEL_SIZE, ((x1 + mLastX) * PIXEL_SIZE) / 2, ((y1 + mLastY) * PIXEL_SIZE) / 2);
                mLastX = x1;
                mLastY = y1;
                mCurrentSegment.addPoint(mLastX, mLastY);
            }
        }
예제 #4
0
		private void onTouchEnd()
		{
			mPath.lineTo(mLastX * PIXEL_SIZE, mLastY * PIXEL_SIZE);
			mBuffer.drawPath(mPath, mPaint);
			mPath.reset();
			Firebase segmentRef = mFirebaseRef.push();
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final String segmentName = segmentRef.getKey();
			string segmentName = segmentRef.Key;
			mOutstandingSegments.Add(segmentName);

			// create a scaled version of the segment, so that it matches the size of the board
			Segment segment = new Segment(mCurrentSegment.Color);
			foreach (Point point in mCurrentSegment.Points)
			{
				segment.addPoint((int)Math.Round(point.x / mScale), (int)Math.Round(point.y / mScale));
			}

			// Save our segment into Firebase. This will let other clients see the data and add it to their own canvases.
			// Also make a note of the outstanding segment name so we don't do a duplicate draw in our onChildAdded callback.
			// We can remove the name from mOutstandingSegments once the completion listener is triggered, since we will have
			// received the child added event by then.
			segmentRef.setValue(segment, new CompletionListenerAnonymousInnerClassHelper(this, segmentName));
		}
예제 #5
0
		private void onTouchStart(float x, float y)
		{
			mPath.reset();
			mPath.moveTo(x, y);
			mCurrentSegment = new Segment(mCurrentColor);
			mLastX = (int) x / PIXEL_SIZE;
			mLastY = (int) y / PIXEL_SIZE;
			mCurrentSegment.addPoint(mLastX, mLastY);
		}