Skip to content

Commit

Permalink
fix: Updated canvas and video surfaces to support new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Belovarich committed Aug 20, 2014
1 parent 815940b commit b7c81aa
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/scripts/directives/fa-canvas-surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* `Fa-canvas-surface` accepts classes and faSize, the only two attributes HTML5 canvas requires is width and height.
*/
angular.module('famous.angular')
.directive('faCanvasSurface', ['$famous', '$famousDecorator', function ($famous, $famousDecorator) {
.directive('faCanvasSurface', ['$famous', '$famousDecorator', '$interpolate', '$controller', '$compile', function ($famous, $famousDecorator, $interpolate, $controller, $compile) {
return {
scope: true,
transclude: true,
Expand All @@ -41,10 +41,19 @@ angular.module('famous.angular')
isolate.renderNode = new CanvasSurface({
size: scope.$eval(attrs.faSize)
});


$famousDecorator.addRole('renderable',isolate);
isolate.show();

if (attrs.class) {
isolate.renderNode.setClasses(attrs['class'].split(' '));
}

// Throw an exception if anyother famous scene graph element is added on fa-surface.
$famousDecorator.sequenceWith(scope, function(data) {
throw new Error('Surfaces are leaf nodes of the Famo.us render tree and cannot accept rendernode children. To include additional Famo.us content inside of a fa-surface, that content must be enclosed in an additional fa-app.');
});

},
post: function(scope, element, attrs){
var isolate = $famousDecorator.ensureIsolate(scope);
Expand Down
10 changes: 9 additions & 1 deletion src/scripts/directives/fa-video-surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,18 @@ angular.module('famous.angular')
isolate.renderNode = new VideoSurface({
class: scope.$eval(attrs.class)
});


$famousDecorator.addRole('renderable',isolate);
isolate.show();

if (attrs.class) {
isolate.renderNode.setClasses(attrs['class'].split(' '));
}
// Throw an exception if anyother famous scene graph element is added on fa-surface.
$famousDecorator.sequenceWith(scope, function(data) {
throw new Error('Surfaces are leaf nodes of the Famo.us render tree and cannot accept rendernode children. To include additional Famo.us content inside of a fa-surface, that content must be enclosed in an additional fa-app.');
});

},
post: function (scope, element, attrs) {

Expand Down

0 comments on commit b7c81aa

Please sign in to comment.