Пример #1
0
 public async Task <bool> MfAssistZoom(PinchStage stage, FloatPoint p, float size)
 {
     ReportAction(stage, p, size);
     return(await OldNewAction(
                async() => await PinchZoom(stage, p, size),
                async() => await OldMfAssistZoom(stage, p, size),
                Profile.NewTouch,
                f => Profile.NewTouch = f));
 }
Пример #2
0
 public async Task <bool> MfAssistMove(PinchStage stage, FloatPoint p)
 {
     ReportAction(stage, p);
     return(await OldNewAction(
                async() => await NewMfAssistMove(stage, p),
                async() => await TryGetString($"?mode=camctrl&type=mf_asst&value={(int)(p.X * 1000)}/{(int)(p.Y * 1000)}"),
                Profile.NewTouch,
                f => Profile.NewTouch = f));
 }
Пример #3
0
 public async Task <bool> FocusPointMove(FloatPoint p)
 {
     ReportAction(p);
     return(await OldNewAction(
                async() => await TryGet($"?mode=camctrl&type=touch&value={(int)(p.X * 1000)}/{(int)(p.Y * 1000)}&value2=on"),
                async() => await TryGet($"?mode=camctrl&type=touchaf&value={(int)(p.X * 1000)}/{(int)(p.Y * 1000)}"),
                Profile.NewTouch,
                f => Profile.NewTouch = f));
 }
Пример #4
0
        private async Task <bool> PinchZoom(PinchStage stage, FloatPoint p, float size)
        {
            try
            {
                if (!autoreviewUnlocked)
                {
                    autoreviewUnlocked = true;
                    await TryGet("?mode=camcmd&value=autoreviewunlock");
                }

                var pp1 = new IntPoint(p - size, 1000f).Clamp(0, 1000);
                var pp2 = new IntPoint(p + size, 1000f).Clamp(0, 1000);

                var url = $"?mode=camctrl&type=pinch&value={stage.GetString()}&value2={pp1.X}/{pp1.Y}/{pp2.X}/{pp2.Y}";
                Debug.WriteLine(url, "PinchZoom");
                var resstring = await http.GetString(url);

                if (resstring.StartsWith("<xml>"))
                {
                    return(false);
                }

                var csv = resstring.Split(',');
                if (csv[0] != "ok")
                {
                    return(false);
                }

                if (stage == PinchStage.Stop)
                {
                    autoreviewUnlocked = false;
                }

                return(true);
            }
            catch (LumixException)
            {
                throw;
            }
            catch (ConnectionLostException)
            {
                Debug.WriteLine("Connection lost", "Connection");
                return(false);
            }
            catch (Exception ex)
            {
                LogError("Camera action failed", ex);
                return(false);
            }
        }
Пример #5
0
        private async Task <bool> OldMfAssistZoom(PinchStage stage, FloatPoint floatPoint, float size)
        {
            if (stage == PinchStage.Start)
            {
                lastOldPinchSize = size;
                return(true);
            }

            if (LumixState.CameraMode != CameraMode.MFAssist)
            {
                return(await MfAssistMove(stage, floatPoint));
            }

            var val = size - lastOldPinchSize > 0 ? 10 : 5;

            Debug.WriteLine("Mag val:" + val, "MFAssist");
            return(await TryGet($"?mode=setsetting&type=mf_asst_mag&value={val}"));
        }
Пример #6
0
        public async Task <bool> FocusPointResize(PinchStage stage, FloatPoint p, float size)
        {
            ReportAction(size);
            return(await OldNewAction(
                       async() => await PinchZoom(stage, p, size),
                       async() =>
            {
                var dif = size - lastOldPinchSize;
                if (Math.Abs(dif) > 0.03f)
                {
                    lastOldPinchSize = size;
                    var val = dif > 0 ? "up" : "down";
                    await http.Get <BaseRequestResult>($"?mode=camctrl&type=touchaf_chg_area&value={val}");
                }
                if (stage == PinchStage.Stop || stage == PinchStage.Single)
                {
                    lastOldPinchSize = 0;
                }

                return true;
            },
                       Profile.NewTouch,
                       f => Profile.NewTouch = f));
        }
Пример #7
0
 public IntPoint(FloatPoint p1, float m)
 {
     X = (int)(p1.X * m);
     Y = (int)(p1.Y * m);
 }