CameraPopoverHandle.js 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. *
  3. * Licensed to the Apache Software Foundation (ASF) under one
  4. * or more contributor license agreements. See the NOTICE file
  5. * distributed with this work for additional information
  6. * regarding copyright ownership. The ASF licenses this file
  7. * to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance
  9. * with the License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing,
  14. * software distributed under the License is distributed on an
  15. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  16. * KIND, either express or implied. See the License for the
  17. * specific language governing permissions and limitations
  18. * under the License.
  19. *
  20. */
  21. var exec = require('cordova/exec');
  22. /**
  23. * @namespace navigator
  24. */
  25. /**
  26. * A handle to an image picker popover.
  27. *
  28. * __Supported Platforms__
  29. *
  30. * - iOS
  31. *
  32. * @example
  33. * navigator.camera.getPicture(onSuccess, onFail,
  34. * {
  35. * destinationType: Camera.DestinationType.FILE_URI,
  36. * sourceType: Camera.PictureSourceType.PHOTOLIBRARY,
  37. * popoverOptions: new CameraPopoverOptions(300, 300, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY)
  38. * });
  39. *
  40. * // Reposition the popover if the orientation changes.
  41. * window.onorientationchange = function() {
  42. * var cameraPopoverHandle = new CameraPopoverHandle();
  43. * var cameraPopoverOptions = new CameraPopoverOptions(0, 0, 100, 100, Camera.PopoverArrowDirection.ARROW_ANY);
  44. * cameraPopoverHandle.setPosition(cameraPopoverOptions);
  45. * }
  46. * @module CameraPopoverHandle
  47. */
  48. var CameraPopoverHandle = function() {
  49. /**
  50. * Can be used to reposition the image selection dialog,
  51. * for example, when the device orientation changes.
  52. * @memberof CameraPopoverHandle
  53. * @instance
  54. * @method setPosition
  55. * @param {module:CameraPopoverOptions} popoverOptions
  56. */
  57. this.setPosition = function(popoverOptions) {
  58. var args = [ popoverOptions ];
  59. exec(null, null, "Camera", "repositionPopover", args);
  60. };
  61. };
  62. module.exports = CameraPopoverHandle;