chaser-capacitor-camera-preview 7.0.7 → 7.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,22 +137,24 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, UIScrollViewDelegate {
137
137
  self.webView?.scrollView.backgroundColor = UIColor.clear
138
138
  self.webView?.superview?.addSubview(self.previewView)
139
139
 
140
- if let toBack = self.toBack, toBack {
141
- self.webView?.superview?.bringSubviewToFront(self.webView!)
142
- }
143
-
144
140
  try? self.cameraController.displayPreview(on: self.previewView)
145
141
 
146
142
  self.shapesOverlay = ShapesOverlayView(frame: CGRect(x: self.x ?? 0, y: self.y ?? 0, width: width, height: adjustedHeight))
147
143
  self.shapesOverlay.autoresizingMask = [.flexibleWidth, .flexibleHeight]
148
- self.webView?.superview?.addSubview(self.shapesOverlay)
149
-
150
- let frontView = (self.toBack ?? false) ? self.webView : self.previewView
151
- self.cameraController.setupGestures(target: frontView ?? self.previewView, enableZoom: self.enableZoom ?? false)
144
+ self.shapesOverlay.isUserInteractionEnabled = false
145
+ self.previewView.addSubview(self.shapesOverlay)
152
146
 
153
147
  if self.enableZoom == true {
154
148
  self.setupZoomControl()
155
149
  }
150
+
151
+ // Always bring WebView to front when toBack is true so HTML buttons work
152
+ if let toBack = self.toBack, toBack {
153
+ self.webView?.superview?.bringSubviewToFront(self.webView!)
154
+ }
155
+
156
+ let frontView = (self.toBack ?? false) ? self.webView : self.previewView
157
+ self.cameraController.setupGestures(target: frontView ?? self.previewView, enableZoom: self.enableZoom ?? false)
156
158
 
157
159
  if self.rotateWhenOrientationChanged == true {
158
160
  NotificationCenter.default.addObserver(self, selector: #selector(CameraPreview.rotated), name: UIDevice.orientationDidChangeNotification, object: nil)
@@ -702,10 +704,12 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, UIScrollViewDelegate {
702
704
  for (title, value) in values {
703
705
  let button = UIButton(type: .system)
704
706
  button.setTitle(title, for: .normal)
705
- button.backgroundColor = UIColor.black.withAlphaComponent(0.5)
707
+ button.titleLabel?.font = UIFont.systemFont(ofSize: 11)
708
+ button.backgroundColor = UIColor.black.withAlphaComponent(0.4)
706
709
  button.setTitleColor(.white, for: .normal)
707
- button.layer.cornerRadius = 15
708
- button.heightAnchor.constraint(equalToConstant: 30).isActive = true
710
+ button.layer.cornerRadius = 10
711
+ button.heightAnchor.constraint(equalToConstant: 20).isActive = true
712
+ button.widthAnchor.constraint(equalToConstant: 36).isActive = true
709
713
  button.tag = Int(value * 10)
710
714
 
711
715
  button.addAction(UIAction(handler: { [weak self] _ in
@@ -720,9 +724,8 @@ public class CameraPreview: CAPPlugin, CAPBridgedPlugin, UIScrollViewDelegate {
720
724
 
721
725
  NSLayoutConstraint.activate([
722
726
  stackView.centerXAnchor.constraint(equalTo: parentView.centerXAnchor),
723
- stackView.bottomAnchor.constraint(equalTo: parentView.bottomAnchor, constant: -20),
724
- stackView.widthAnchor.constraint(equalToConstant: 250),
725
- stackView.heightAnchor.constraint(equalToConstant: 40)
727
+ stackView.bottomAnchor.constraint(equalTo: parentView.bottomAnchor, constant: -8),
728
+ stackView.heightAnchor.constraint(equalToConstant: 24)
726
729
  ])
727
730
 
728
731
  parentView.bringSubviewToFront(stackView)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chaser-capacitor-camera-preview",
3
- "version": "7.0.7",
3
+ "version": "7.0.8",
4
4
  "description": "Camera preview",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",