ServerView

ServerView

The ServerView models an attached client view in the browser. rescale views.

Constructor

new ServerView(socket, valuesopt)

Source:
Parameters:
Name Type Attributes Description
socket Namespace Socket.io socket for publishing changes.
values Object <optional>
Object with user supplied values describing the view.

Extends

Members

(nullable) [@@holder] :module:mixins.Locker

Description:
  • If the Lockable is locked, stores a reference to the holder of the lock.
Source:
Overrides:
Mixes In:
Default Value:
  • undefined
If the Lockable is locked, stores a reference to the holder of the lock.
Type:

(nullable) [@@lockedItem] :module:mixins.Lockable

Description:
  • The internally stored reference to the locked item. For access use the external getter. There is no external setter provided. The nature of Symbols makes this interal reference technically accessible, but it still should not be set directly.
Source:
Overrides:
Mixes In:
Default Value:
  • undefined
The internally stored reference to the locked item. For access use the external getter. There is no external setter provided. The nature of Symbols makes this interal reference technically accessible, but it still should not be set directly.
Type:

(nullable) [@@locked] :boolean

Description:
  • Whether this Lockable is locked.
Source:
Overrides:
Mixes In:
Default Value:
  • falsy
Whether this Lockable is locked.
Type:
  • boolean

(nullable) [@@scheduled] :boolean

Description:
  • Whether a publication has been scheduled.
Source:
Overrides:
Mixes In:
Default Value:
  • falsy
Whether a publication has been scheduled.
Type:
  • boolean

bottomLeft :module:shared.Point2D

Description:
  • Get the position of the bottom left corner of this view.
Source:
Get the position of the bottom left corner of this view.
Type:

bottomRight :module:shared.Point2D

Description:
  • Get the position of the bottom right corner of this view.
Source:
Get the position of the bottom right corner of this view.
Type:

device :module:server.Device

Description:
  • The device corresponding to the client's device's physical orientation.
Source:
The device corresponding to the client's device's physical orientation.
Type:

group :module:server.ServerViewGroup

Description:
  • The group that this view belongs to.
Source:
Default Value:
  • null
The group that this view belongs to.
Type:

(constant) id :number

Description:
  • Id to make the views uniquely identifiable.
Source:
Id to make the views uniquely identifiable.
Type:
  • number

(constant) id :number

Description:
  • Id to make the view groups uniquely identifiable.
Source:
Id to make the view groups uniquely identifiable.
Type:
  • number

index :number

Description:
  • The index is an integer identifying the View, coming from ServerController.
Source:
Overrides:
Default Value:
  • undefined
The index is an integer identifying the View, coming from ServerController.
Type:
  • number

lockZ :boolean

Description:
  • Whether to raise item upon interaction or lock Z position instead.
Source:
Overrides:
Default Value:
  • false
Whether to raise item upon interaction or lock Z position instead.
Type:
  • boolean

lockedItem :module:mixins.Lockable

Description:
  • External getter for the locked item. There is no setter available.
Source:
Overrides:
Mixes In:
External getter for the locked item. There is no setter available.
Type:

rotation :number

Source:
Overrides:
Default Value:
  • 0
Type:
  • number

scale :number

Source:
Overrides:
Default Value:
  • 1
Type:
  • number

socket :Socket

Description:
  • Socket.io socket for publishing changes.
Source:
Socket.io socket for publishing changes.
Type:
  • Socket

state

Description:
  • A place for user to store view state.
Source:
A place for user to store view state.

topLeft :module:shared.Point2D

Description:
  • Get the position of the top left corner of this view.
Source:
Get the position of the top left corner of this view.
Type:

topRight :module:shared.Point2D

Description:
  • Get the position of the top right corner of this view.
Source:
Get the position of the top right corner of this view.
Type:

type :string

Source:
Overrides:
Default Value:
  • 'item/polygonal'
Type:
  • string

x :number

Source:
Overrides:
Default Value:
  • 0
Type:
  • number

y :number

Source:
Overrides:
Default Value:
  • 0
Type:
  • number

Methods

[@@emit]()

Description:
  • Emit the publication of this object and mark that it is no longer scheduled for publication.
Source:
Overrides:
Mixes In:

(protected) _emitPublication()

Description:
  • Emit the publication of this object. This method must be implemented by classes that use this mixin. It should never be called except by this mixin.
Source:
Overrides:
Mixes In:

dispatch(event, payload)

Description:
  • Send Message to this view to dispatch a user-defined event.
Source:
Parameters:
Name Type Description
event string name of the user-defined event.
payload object argument to pass to the event handler.

isLocked() → {boolean}

Description:
  • Checks whether this lockable is locked.
Source:
Overrides:
Mixes In:
Returns:
True if the item is locked, false otherwise.
Type
boolean

lock(locker)

Description:
  • Lock this item.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Description
locker module:mixins.Locker The holder of the lock.

moveBy(dxopt, dyopt)

Description:
  • Move the transformable by the given amounts.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Attributes Default Description
dx number <optional>
0 Movement along the x axis.
dy number <optional>
0 Movement along the y ayis.

moveTo(xopt, yopt)

Description:
  • Move the transformable to the given coordinates.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Attributes Default Description
x number <optional>
this.x x coordinate to move to.
y number <optional>
this.y y coordinate to move to.

obtainLockOnItem(item) → {boolean}

Description:
  • Obtain a lock on the given item for this view.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Description
item module:mixins.Lockable The item to lock down.
Returns:
True if the lock was obtained, false otherwise.
Type
boolean

publish()

Description:
  • Schedule a publication of this object for the end of this turn of the node.js event loop. This will have the effect of making sure that the object update is not emitted until after all transformations applied by the user have been completed (assuming they don't use async callbacks, of course), and that only one update will be emitted regardless of the number of transformations that are applied! All this and we don't even need to do any fancy software engineering!
Source:
Overrides:
Mixes In:

releaseLockedItem()

Description:
  • Release the view's item lock.
Source:
Overrides:
Mixes In:

reversePoint(x, y) → {module:shared.Point2D}

Description:
  • Reverses "transformPoint"
Source:
Overrides:
Mixes In:
Parameters:
Name Type Description
x number x coordinate to transform.
y number y coordinate to transform.
Returns:
The transformed point.
Type
module:shared.Point2D

reversePointChange(dx, dy) → {module:shared.Point2D}

Description:
  • Reverses "transformPointChange"
Source:
Overrides:
Mixes In:
Parameters:
Name Type Description
dx number dx coordinate to transform.
dy number dy coordinate to transform.
Returns:
The transformed point.
Type
module:shared.Point2D

rotateBy(radiansopt, pxopt, pyopt)

Description:
  • Rotate the transformable by the given amount, in radians, around the given x,y point.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Attributes Default Description
radians number <optional>
0 The amount of rotation to apply to the transformable, in radians.
px number <optional>
this.x The x coordinate of the point around which to rotate.
py number <optional>
this.y The y coordinate of the point around which to rotate.

scaleBy(dsopt, mxopt, myopt, deltaFnopt)

Description:
  • Adjust the transformable by the given scale.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Attributes Default Description
ds number <optional>
1 Change in desired scale.
mx number <optional>
this.x The x coordinate of the point around which to scale.
my number <optional>
this.y The y coordinate of the point around which to scale.
deltaFn string <optional>
'times' The Point2D operation to apply to the delta point to extract the corrext this.x and this.y values. Should be one of 'times' or 'divideBy' depending on the use case.

toJSON()

Source:
Overrides:
Returns:
object A serialized version of the view, ready for transmission.

transformPoint(x, y) → {module:shared.Point2D}

Description:
  • Transforms a point from the transformable space to the default space. That is, it applies to the point the same transformations that apply to this Transformable2D, but in reverse.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Description
x number x coordinate to transform.
y number y coordinate to transform.
Returns:
The transformed point.
Type
module:shared.Point2D

transformPointChange(dx, dy) → {module:shared.Point2D}

Description:
  • Transforms a "change" point from the transformable space to the default space. Very much like the 'transformPoint' function, except that it does not apply translation.
Source:
Overrides:
Mixes In:
Parameters:
Name Type Description
dx number dx coordinate to transform.
dy number dy coordinate to transform.
Returns:
The transformed point.
Type
module:shared.Point2D

unlock()

Description:
  • Unlock this item.
Source:
Overrides:
Mixes In: