Skip to content

Commit 036fb60

Browse files
committed
feat: update draggable example to show more complexity
1 parent 717a877 commit 036fb60

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

app/scripts/controllers/draggable.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,17 @@
33
angular.module('integrationApp')
44
.controller('DraggableCtrl', function ($scope, $famous) {
55
var EventHandler = $famous['famous/core/EventHandler'];
6-
$scope.handler = new EventHandler();
6+
7+
var data = [];
8+
data.push( {id: 0, name: 'zero', position: [10, 100], handler: new EventHandler() } );
9+
data.push( {id: 1, name: 'one', position: [10, 200], handler: new EventHandler() } );
10+
data.push( {id: 2, name: 'two', position: [10, 300], handler: new EventHandler() } );
11+
12+
$scope.nodes = data;
13+
console.log($scope.nodes);
14+
15+
$scope.remove = function() {
16+
$scope.nodes.splice(0, 1);
17+
console.log($scope.nodes);
18+
}
719
});

app/views/draggable.html

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
1-
<fa-app style="width: 320px; height: 568px; overflow: hidden;">
2-
<fa-draggable fa-pipe-from="handler">
3-
<fa-surface fa-background-color="'red'" fa-size="[200, 200]" fa-pipe-to="handler"></fa-surface>
4-
</fa-draggable>
5-
</fa-app>
1+
<fa-app style="width: 320px; height: 568px; overflow: hidden;">
2+
<fa-modifier ng-repeat="node in nodes" fa-translate="[10,500]" fa-size="[80, 40]">
3+
<fa-surface>
4+
<button ng-click="remove()">Remove one</button>
5+
</fa-surface>
6+
</fa-modifier>
7+
8+
<fa-modifier ng-repeat="node in nodes" fa-translate="node.position" fa-size="[80, 40]">
9+
<fa-draggable fa-pipe-from="node.handler">
10+
<fa-surface fa-background-color="'red'" fa-size="[undefined, undefined]" fa-pipe-to="node.handler">
11+
{{node.id}}: {{node.name}}
12+
</fa-surface>
13+
</fa-draggable>
14+
</fa-modifier>
15+
16+
</fa-app>

0 commit comments

Comments
 (0)