<commit_before>{_} = require "./Underscore"

Utils        = require "./Utils"
{BaseClass}  = require "./BaseClass"
{Events}     = require "./Events"
{Frame}      = require "./Frame"
{Simulation} = require "./Simulation"
{Defaults}   = require "./Defaults"

{EventBuffer} = require "./EventBuffer"
{PanRecognizer} = require "./Recognizers/PanRecognizer"

Events.DragStart             = "dragstart"
Events.DragWillMove          = "dragwillmove"
Events.DragDidMove           = "dragmove"
Events.DragMove              = "dragmove"
Events.DragEnd               = "dragend"
Events.DidStartDecelerating  = "didstartdecelerating"
Events.DidEndDecelerating    = "didenddecelerating"
Events.DidStartBounce        = "didstartbounce"
Events.DidEndBounce          = "didendbounce"
Events.DidStartAnimation     = "didstartanimation"
Events.DidEndAnimation       = "didendanimation"
Events.DidStartLockDirection = "didstartlockdirection"


class exports.LayerDraggable extends BaseClass

	@define "speedX", @simpleProperty "speedX", 1, true
	@define "speedY", @simpleProperty "speedY", 1, true

	@define "horizontal", @simpleProperty "horizontal", true, true
	@define "vertical", @simpleProperty "vertical", true, true

	# @define "lockDirection", @simpleProperty "lockDirection", false, true

	@define "constraints",
		get: -> @_constraints
		set: (value) -> 
			if value and _.isObject(value)
				@_constraints = _.defaults(value, {x:0, y:0, width:0, height:0})
			else
				@_constraints = null
			@_updateSimulationConstraints(@_constraints) if @_constraints<commit_msg>Add todo<commit_after>{_} = require "./Underscore"

Utils        = require "./Utils"
{BaseClass}  = require "./BaseClass"
{Events}     = require "./Events"
{Frame}      = require "./Frame"
{Simulation} = require "./Simulation"
{Defaults}   = require "./Defaults"

{EventBuffer} = require "./EventBuffer"
{PanRecognizer} = require "./Recognizers/PanRecognizer"

Events.DragStart             = "dragstart"
Events.DragWillMove          = "dragwillmove"
Events.DragDidMove           = "dragmove"
Events.DragMove              = "dragmove"
Events.DragEnd               = "dragend"
Events.DidStartDecelerating  = "didstartdecelerating"
Events.DidEndDecelerating    = "didenddecelerating"
Events.DidStartBounce        = "didstartbounce"
Events.DidEndBounce          = "didendbounce"
Events.DidStartAnimation     = "didstartanimation"
Events.DidEndAnimation       = "didendanimation"
Events.DidStartLockDirection = "didstartlockdirection"

"""
TODO:

- Check if all events are thrown correctly
- Deal with nested draggables
	- Event propagation (click vs move)
	- Multiple scroll moves
	- Multiple lock directions
	
"""

class exports.LayerDraggable extends BaseClass

	@define "speedX", @simpleProperty "speedX", 1, true
	@define "speedY", @simpleProperty "speedY", 1, true

	@define "horizontal", @simpleProperty "horizontal", true, true
	@define "vertical", @simpleProperty "vertical", true, true

	@define "constraints",
		get: -> @_constraints
		set: (value) -> 
			if value and _.isObject(value)
				@_constraints = _.defaults(value, {x:0, y:0, width:0, height:0})
			else
				@_constraints = null
			@_updateSimulationConstraints(@_constraints) if @_constraints
{'fraction_non_alphanumeric': 0.12433944668946223, 'fraction_numerical': 0.003730183400683867, 'mean_word_length': 3.8905775075987843, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4412487', 'n_tokens_mistral': 1019, 'n_tokens_neox': 964, 'n_words': 231}