overlay-grid.client.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. (function (angular) {
  2. const SECTION_NAME = "remote-debug";
  3. /**
  4. * Display the snippet when in snippet mode
  5. */
  6. angular
  7. .module("BrowserSync")
  8. .directive("cssGrid", function () {
  9. return {
  10. restrict: "E",
  11. replace: true,
  12. scope: {
  13. "options": "="
  14. },
  15. templateUrl: "overlay-grid.html",
  16. controller: ["$scope", "Socket", overlayGridDirectiveControlller],
  17. controllerAs: "ctrl"
  18. };
  19. });
  20. /**
  21. * @param $scope
  22. * @param Socket
  23. */
  24. function overlayGridDirectiveControlller($scope, Socket) {
  25. var ctrl = this;
  26. ctrl.overlayGrid = $scope.options[SECTION_NAME]["overlay-grid"];
  27. ctrl.size = ctrl.overlayGrid.size;
  28. var ns = SECTION_NAME + ":overlay-grid";
  29. ctrl.alter = function (value) {
  30. Socket.emit("ui", {
  31. namespace: ns,
  32. event: "adjust",
  33. data: value
  34. });
  35. };
  36. ctrl.toggleAxis = function (axis, value) {
  37. Socket.emit("ui", {
  38. namespace: ns,
  39. event: "toggle:axis",
  40. data: {
  41. axis: axis,
  42. value: value
  43. }
  44. });
  45. };
  46. }
  47. })(angular);