Class: MatchingController

MatchingController

Controller for a matching and its view.

Constructor

new MatchingController(matching, view)

Construct a controller for this matching and this view.
Parameters:
Name Type Description
matching Matching
view MatchingView
Source:

Members

matching

Returns the matching.
Source:

view

Returns the view.
Source:

Methods

_click(event)

Add/remove a point or a segment, update the view, and update the global view.
Parameters:
Name Type Description
event MouseEvent
Source:

_eventMouseToPoint(event) → {Point}

Returns a point corresponding to the position in the mouse event. The vertical coordinate is reversed to have (*, 0) in the bottom.
Parameters:
Name Type Description
event MouseEvent
Source:
Returns:
Type
Point

_move(event)

Move the current point and if a first point was fixed the building segment, and update the view of the matching.
Parameters:
Name Type Description
event MouseEvent
Source:

_nearestPointIfExist(point) → {Array}

If there exist an point closed enough to point then return [this closed point, this close point], else return [point, null].
Parameters:
Name Type Description
point Point
Source:
Returns:
[Point, null or Point]
Type
Array

_out()

Reset the first point used to build segment and update the view.
Source:

_setEventListeners()

Set listeners on the view.
Source:

_verticalHorizontalSecondPoint(point) → {Point}

If point is in a vertical or horizontal position compared to _segmentFirstPoint then return point, else return a new point in the nearest good vertical or horizontal position.
Parameters:
Name Type Description
point Point
Source:
Returns:
Type
Point

addOrRemovePoint(point)

If point is already in the matching then remove it, else add it.
Parameters:
Name Type Description
point Point
Source:

addOrRemoveSegment(segment)

If segment is already in the matching then remove it, else if the segment don't intersects other segment in this matching then add it.
Parameters:
Name Type Description
segment Segment
Source:

changeAction()

Set action property from HTML element and reset the first point used to build segment.
Source:

changeDrawSegments()

Set drawSegment property from HTML element and update the view.
Source:

changeVerticalHorizontal()

Set vertical-horizontal property from HTML element.
Source:

clear()

Reset the controller, clear and update the view, and update the global view.
Source:

clearSegmentFirstPoint()

Reset the first point used to build segment.
Source:

setGlobalView(globalView)

Set the global view.
Parameters:
Name Type Description
globalView GlobalView
Source: