kdf
Version:
50 lines (39 loc) • 1.31 kB
text/coffeescript
KDView = require './../../core/view.coffee'
module.exports = class KDOverlayView extends KDView
constructor: (options = {}, data) ->
options.isRemovable ?= yes
options.animated ?= no
options.color ?= no
options.transparent ?= no
options.opacity ?= 0.5
options.appendToDomBody ?= yes
options.cssClass = KD.utils.curry "kdoverlay", options.cssClass
super options, data
"animated" if options.animated
"transparent" if options.transparent
if options.color
backgroundColor : options.color
opacity : options.opacity
if options.container instanceof KDView
options.container.addSubView this
"position", "absolute"
else if options.appendToDomBody
if options.animated
.defer => "in"
.wait 300, =>
"OverlayAdded", this
else
"OverlayAdded", this
if options.isRemovable
if options.animated
"click", =>
"in"
.wait 300, =>
else
"click", =>
remove: ->
"OverlayWillBeRemoved"
"OverlayRemoved", this