Awesomium browser zoom v1.7 - c#

How can I zoom in/out the webControl in Awesomium v1.7? there is no webControl.zoom in v1.7...
I am applying zoom when I start the websession, like this:
myWebControl.WebSession = WebCore.CreateWebSession(new WebPreferences() { CustomCSS = "body { zoom: 200%; }" });
But I also want to be able to apply zoom in/out after the webcontrol has been displayed.just like we did in v1.6. Im using wpf C#.
Any help would be appreciated.

The Zoom property and supporting API (similar to the one available in 1.6.x), will be available in the final release of version 1.7.

Related

Display compass - ArcGIS Runtime SDK - Xamarin.Forms

I am using the 1st release of the ArcGIS Runtime SDK for .Net - Xamarin.Forms (nuget package here).
One of the requirements is to display a compass that indicates the north. I haven't found any build-in feature for the moment. Is someone can point me out how to implement this functionality ?
So after few research, I've implemented a custom solution:
Find a compass icon that can rotate (see this article to add image resource to Xamarin.Form)
Add the image on top of the map:
<Image x:Name="NorthArrow" />
Rotate the image when the view point changed:
MapView.ViewpointChanged += (sender, args) =>
{
NorthArrow.Rotation = -MapView.MapRotation;
};
Complete solution here.

How do I Focus a Camera in Windows Universal Apps?

I am working with the Windows Universal Sample for OCR located here:
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/OCR/cs
Specifically the OcrCapturedImage.xaml.cs
It seems that the camera often becomes unfocused, blurry, and nowhere near as good quality as the native camera app. How can I set up autofocusing and/or tap to fix exposure?
What I have tried so far is looking at the other camera samples which help set resolution, but I cannot find anything about focus/exposure.
Update:
I think
await mediaCapture.VideoDeviceController.FocusControl.FocusAsync();
and
await mediaCapture.VideoDeviceController.ExposureControl.SetAutoAsync(true);
But this isn't working (does nothing-still blurry etc.) and could be built upon if someone knows how to tap a certain area and apply focus/exposure accordingly.
Native Camera:
App Camera:
Update based on answer:
I must have been putting my focus methods in the wrong spot because my original update code works. Sergi's also works. I want to used the tapped event in combination with it, something like this:
Point tapped=e.GetPosition(null); //Where e is TappedRoutedEventArgs from a tapped event method on my preview screen
await mediaCapture.VideoDeviceController.RegionsOfInterestControl.ClearRegionsAsync();
await mediaCapture.VideoDeviceController.RegionsOfInterestControl.SetRegionsAsync(new[] { new RegionOfInterest() { Bounds = new Rect(tapped.X, tapped.Y, 0.02, 0.02) } }); //Throws Parameter Incorrect
But it throws parameter incorrect. Also, How would I show the overlay a Rectangle on the preview screen, so the user knows how big the region of interest is?
This is a great link https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/CameraManualControls/cs/MainPage.Focus.xaml.cs
Configuration of the auto focus using the Configure method of the FocusControl class.
mediaCapture.VideoDeviceController.FocusControl.Configure(
new FocusSettings { Mode = FocusMode.Auto });
await mediaCapture.VideoDeviceController.FocusControl.FocusAsync();
In order to focus on a certain area, the RegionOfInterestControl propery can be used. It has the SetRegionsAsync method to add a collection of RegionOfInterest instances. RegionOfInterest has the Bounds property which defines the region of focus. This example shows how to set the focus in the center:
// clear previous regions of interest
await mediaCapture.VideoDeviceController.RegionOfInterestControl.ClearRegionsAsync();
// focus in the center of the screen
await mediaCapture.VideoDeviceController.RegionOfInterestControl.SetRegionsAsync(
new []
{
new RegionOfInterest() {Bounds = new Rect(0.49,0.49,0.02,0.02) }
});

How to get Awesomium's scroll offset?

How can I get the current horizontal and vertical scroll offset of the Web view (showing an arbitrary website)?
I want to save the UI layout and need the offset to be able to restore the viewport position after restarting my application. I´m using WebControl (WPF) with the latest Awesomium.
I found the solution!
Awesomium does not handle anything scroll-related. It´s done by the underlying WebKit. Therefore, I have to use JavaScript to obtain the information:
var xoffset = webControl.ExecuteJavascriptWithResult("window.pageXOffset");
var yoffset = webControl.ExecuteJavascriptWithResult("window.pageYOffset");
And with
webControl.ExecuteJavascript("window.scrollTo(x, y);");
I can apply a scroll offset to the view.

Pinch Zoom with ScrollViewer

I'm using an ScrollViewer in the MVVM enviroment to navigate around an map of europe. But when I use the ScrollViewer the deltaScale for the manipulationDeltaEventArgs.Pinchmanipulation doesn't work. The DeltaScale stays at one, no matter what. I tried to take a look at the Current and Original of the Pinchmanipulation and they are the same. So can anyone help me with making it possible to zoom while having an scrollViewer?
The manipulationDelta is:
public void Zoom(ManipulationDeltaEventArgs e)
{
if (e.PinchManipulation == null)
{
return;
}
}
I don't think scrollviewer supports zooming in Windows Phone 8. Only Windows Store apps can do this right now.

Control.PointToScreen on Windows Phone

Is there a way to get a control's absolute screen co-ordinates on Windows Phone? also, will help if that method will work with UserControl components. WPF seems to have Control.PointToScreen, which isb't in the WP APIs
The idea is I'm trying to use a Callout control to point to a UserControl on the screen as a help bubble, and the anchor point doesn't take in absolute coordinates either - so it's a huge connected problem which I'll build up as an answer to this post.
Use UIElement.TransformToVisual()
something like this should do the trick:
var control = this; // assign the control you want to get the position of.
var transform = control.TransformToVisual(Application.Current.RootVisual);
var controlPosition = transform.Transform(new Point(0, 0));
probably you could try Control.MousePosition instead
is this want you want (though it's for WP7): How do you find the screen position of a control in silverlight on WP7?

Categories

Resources