progress on getting makeShape to work for 'rect'
This commit is contained in:
parent
7aa31b47b7
commit
813f10cef0
@ -94,16 +94,18 @@ define [
|
||||
# Received event to update a shape being created
|
||||
# @param {string} shape type of shape being updated
|
||||
# @param {Array} data all information to update the shape
|
||||
@socket.on "updShape", (shape, data) =>
|
||||
@socket.on "updShape", (data) =>
|
||||
shape = data.shape.type
|
||||
console.log "socket on: updShape"
|
||||
globals.events.trigger("connection:updShape", shape, data)
|
||||
|
||||
# Received event to create a shape on the whiteboard
|
||||
# @param {string} shape type of shape being made
|
||||
# @param {Array} data all information to make the shape
|
||||
@socket.on "makeShape", (shape, data) =>
|
||||
console.log "socket on: makeShape"
|
||||
globals.events.trigger("connection:makeShape", shape, data)
|
||||
@socket.on "whiteboardMakeShape", (data) =>
|
||||
shape = data.shape.type
|
||||
console.log "socket on: whiteboardMakeShape"
|
||||
globals.events.trigger("connection:whiteboardMakeShape", shape, data)
|
||||
|
||||
# Pencil drawings are received as points from the server and painted as lines.
|
||||
@socket.on "shapePoints", (type, color, thickness, points) =>
|
||||
|
@ -393,6 +393,10 @@ define [
|
||||
|
||||
# Make a shape `shape` with the data in `data`.
|
||||
makeShape: (shape, data) ->
|
||||
console.log("shape")
|
||||
console.log(shape)
|
||||
console.log("data")
|
||||
console.log(data)
|
||||
tool = null
|
||||
switch shape
|
||||
when "path", "line"
|
||||
@ -546,7 +550,7 @@ define [
|
||||
globals.events.on "connection:updShape", (shape, data) =>
|
||||
@updateShape(shape, data)
|
||||
|
||||
globals.events.on "connection:makeShape", (shape, data) =>
|
||||
globals.events.on "connection:whiteboardMakeShape", (shape, data) =>
|
||||
@makeShape(shape, data)
|
||||
|
||||
globals.events.on "connection:shapePoints", (type, color, thickness, points) =>
|
||||
|
@ -23,7 +23,13 @@ define [
|
||||
# @param {number} y the y value of the top left corner
|
||||
# @param {string} colour the colour of the object
|
||||
# @param {number} thickness the thickness of the object's line(s)
|
||||
make: (x, y, colour, thickness) ->
|
||||
make: (data) ->
|
||||
console.log("make data");
|
||||
console.log(data);
|
||||
x = data.shape.coordinate.firstX
|
||||
y = data.shape.coordinate.firstY
|
||||
color = data.shape.color
|
||||
thickness = data.shape.thickness
|
||||
@obj = @paper.rect(x * @gw + @xOffset, y * @gh + @yOffset, 0, 0, 1)
|
||||
@obj.attr Utils.strokeAndThickness(colour, thickness)
|
||||
@definition =
|
||||
|
Loading…
Reference in New Issue
Block a user