Added outer whitespace to the poll shape, as in the Flash client

This commit is contained in:
Oleksandr Zhurbenko 2015-09-11 12:59:33 -07:00
parent c7111089dc
commit cfccc3aae2

View File

@ -63,15 +63,29 @@ class @WhiteboardPollModel extends WhiteboardToolModel
width = (x2 * @gw + @xOffset) - x width = (x2 * @gw + @xOffset) - x
height = (y2 * @gh + @yOffset) - y height = (y2 * @gh + @yOffset) - y
#creating a base rectangle #creating a base outer rectangle
@obj = @paper.rect(x, y, width, height, 0) @obj = @paper.rect(x, y, width, height, 0)
@obj.attr "stroke", "#333333"
@obj.attr "fill", backgroundColor @obj.attr "fill", backgroundColor
@obj.attr "stroke-width", zoomStroke(formatThickness(thickness)) @obj.attr "stroke-width", 0
@definition = @definition =
shape: "poll_result" shape: "poll_result"
data: [x1, y1, x2, y2, @obj.attrs["stroke"], @obj.attrs["stroke-width"], @obj.attrs["fill"]] data: [x1, y1, x2, y2, @obj.attrs["stroke"], @obj.attrs["stroke-width"], @obj.attrs["fill"]]
#recalculated coordinates, width and height for the inner rectangle
width = width*0.95
height = height - width*0.05
x = x+width*0.025
y = y+width*0.025
#creating a base inner rectangle
@obj1 = @paper.rect(x, y, width, height, 0)
@obj1.attr "stroke", "#333333"
@obj1.attr "fill", backgroundColor
@obj1.attr "stroke-width", zoomStroke(formatThickness(thickness))
@definition =
shape: "poll_result"
data: [x1, y1, x2, y2, @obj.attrs["stroke"], @obj1.attrs["stroke-width"], @obj1.attrs["fill"]]
#Calculating a proper font-size, and the maximum widht and height of the objects #Calculating a proper font-size, and the maximum widht and height of the objects
calculatedData = calculateFontAndWidth(textArray, calcFontSize, width, height, x, y) calculatedData = calculateFontAndWidth(textArray, calcFontSize, width, height, x, y)
calcFontSize = calculatedData[0] calcFontSize = calculatedData[0]
@ -137,7 +151,7 @@ class @WhiteboardPollModel extends WhiteboardToolModel
#Initial coordinates of the percentage column #Initial coordinates of the percentage column
yRight = y+verticalPadding+barHeight/2 - magicNumber yRight = y+verticalPadding+barHeight/2 - magicNumber
xRight = x + horizontalPadding*3 + maxLeftWidth + maxRightWidth + maxBarWidth + 1 xRight = x + horizontalPadding*3 + maxLeftWidth + maxRightWidth + maxBarWidth + 1
objects = [@obj, @obj2, @obj3] objects = [@obj, @obj1, @obj2, @obj3]
for i in [0..textArray.length-1] for i in [0..textArray.length-1]
#Adding an element to the left column #Adding an element to the left column