OpenShot Video Editor  2.0.0
misc.js
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Misc directives (right click handling, debug functions, etc...)
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  * @author Cody Parker <cody@yourcodepro.com>
6  *
7  * @section LICENSE
8  *
9  * Copyright (c) 2008-2014 OpenShot Studios, LLC
10  * <http://www.openshotstudios.com/>. This file is part of
11  * OpenShot Video Editor, an open-source project dedicated to
12  * delivering high quality video editing and animation solutions to the
13  * world. For more information visit <http://www.openshot.org/>.
14  *
15  * OpenShot Video Editor is free software: you can redistribute it
16  * and/or modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation, either version 3 of the
18  * License, or (at your option) any later version.
19  *
20  * OpenShot Video Editor is distributed in the hope that it will be
21  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 
30 // Handle right-click context menus
31 App.directive('ngRightClick', function($parse) {
32  return function(scope, element, attrs) {
33  var fn = $parse(attrs.ngRightClick);
34  element.bind('contextmenu', function(event) {
35  scope.$apply(function() {
36  event.preventDefault();
37  fn(scope, {$event:event});
38  });
39  });
40  };
41 });
42 
43 
44 // Debug directive (for binding a timeline scale slider)
45 App.directive('dbSlider', function () {
46  return {
47  restrict: 'A',
48  link: function (scope, element, attrs) {
49  element.slider({
50  value: 30,
51  step: 2,
52  min: 8,
53  max: 210,
54  slide: function(event, ui) {
55  $("#scaleVal").val(ui.value);
56  scope.$apply(function(){
57  scope.project.scale = ui.value;
58  scope.pixelsPerSecond = parseFloat(scope.project.tick_pixels) / parseFloat(scope.project.scale);
59  });
60 
61  }
62  });
63  }
64  };
65 });
66 
var App
Definition: app.js:31
jQuery fx step
Definition: jquery.js:9537