Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Added trigger when context element is part of the dom
- Loading branch information
Showing
with
9 additions
and
0 deletions.
-
+4
−0
framer/Context.coffee
-
+5
−0
framer/Layer.coffee
|
@@ -78,6 +78,7 @@ class exports.Context extends BaseClass |
|
|
@perspectiveOriginX = options.perspectiveOriginX |
|
|
@perspectiveOriginY = options.perspectiveOriginY |
|
|
|
|
|
@elementInDOM = false |
|
|
@reset() |
|
|
|
|
|
if options.hasOwnProperty("index") |
|
@@ -302,6 +303,8 @@ class exports.Context extends BaseClass |
|
|
parentElement = @_parent?._element |
|
|
parentElement ?= document.body |
|
|
parentElement.appendChild(@_element) |
|
|
@elementInDOM = true |
|
|
@_layers?.map (l) -> l.elementInsertedIntoDocument() |
|
|
|
|
|
Utils.domComplete(@__pendingElementAppend) |
|
|
|
|
@@ -312,6 +315,7 @@ class exports.Context extends BaseClass |
|
|
|
|
|
if @_element?.parentNode |
|
|
@_element.parentNode.removeChild(@_element) |
|
|
@elementInDOM = false |
|
|
|
|
|
if @__pendingElementAppend |
|
|
Utils.domCompleteCancel(@__pendingElementAppend) |
|
|
|
@@ -892,6 +892,11 @@ class exports.Layer extends BaseClass |
|
|
@bringToFront() |
|
|
@_context.element.appendChild(@_element) |
|
|
|
|
|
# This method is called as soon as the @_element is part of the DOM |
|
|
# If layers are initialized before the DOM is complete, |
|
|
# the contexts calls this methods on all Layers as soon as it appends itself to the document |
|
|
elementInsertedIntoDocument: -> |
|
|
|
|
|
_createHTMLElementIfNeeded: -> |
|
|
if not @_elementHTML |
|
|
@_elementHTML = document.createElement "div" |
|
|