viewbox

Stretch <svg> inside an <embed> to fit window size

让人想犯罪 __ 提交于 2020-01-21 03:24:46
问题 I am trying to stretch an svg document inside an DOM in order to fit the window size. like so: <div id="y"> <div id="button"> click to zoom</div> <embed id="x" src="s17.svg" > <script> var btn= document.getElementById("button"); btn.addEventListener('click',function(){ var z= document.getElementsByTagName("embed")[0]; var y = z.getSVGDocument(); y.lastChild.setAttribute("viewBox","0 0 "+window.innerWidth+" "+window.innerHeight); },false); </script> </div> css: #x{ height:100%; width:100%;

SVG for print with scale

南笙酒味 提交于 2019-12-31 07:01:26
问题 I have an SVG file representing a flat in my browser and I need to print the output in a specific scale. I'm using SVG.js to manipulate the SVG content but I can't find a combination of correct viewport viewbox setup to meet my needs. What I know is the SVG source file size. Via the x and y coordinates I calculated a distance to find the correct "screen scale" to match 1cm on the plan with a pixel number. For printing I need to respect "specific scales" for example 1/50. So I tried to get the

WPF TextBox Inside ViewBox loses Cursor on resize

余生颓废 提交于 2019-12-31 01:56:08
问题 I have a textbox inside a viewbox. When I try to resize the window, the textbox size and font size getting scaled, but if I try to focus the textbox and try move the cursor inside the textbox using keyboard, sometimes the cursor is getting disappeared. Is there a way to show the cursor always? Refer the below code which a TextBox inside ViewBox. <Window x:Class="Resolution_Learning.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft

How do I keep a constant FontSize in WPF Viewbox?

孤街浪徒 提交于 2019-12-28 22:43:34
问题 I have a Viewbox with a number of TextBlock s that are scaled and positioned perfectly by the ViewBox . Something like this: <Viewbox Stretch="Uniform"> <Canvas Width="100" Height="100"> <Ellipse Width="100" Height="100" Stroke="Black"/> <TextBlock Width="100" TextAlignment="Center" FontSize="12">Top Center</TextBlock> </Canvas> </Viewbox> If the user resizes the Viewbox its contents are perfectly scaled to match. However I would like to keep the FontSize to 12 regardless of the actual size

SVG viewBox reversing Y-coordinates

三世轮回 提交于 2019-12-23 12:55:24
问题 I'm using SVG to draw in a HTML page different shapes. These different shapes are retrieved from geometry objects of a spatial database in Microsoft Sql Server. The problem I'm facing is that the system of coords (Svg and Microsoft Sql Server) is different. 0,0 begins in Svg on the top left corner, whereas in Microsoft Sql Server it starts at the bottom left corner. I need to reverse just the Y coords. I'm also using viewBox to display the data properly (for different transformations). Is

ListView - select index only programmatically

会有一股神秘感。 提交于 2019-12-23 05:26:21
问题 i am trying to implement listbox (or listview): <ListView ItemsSource="{Binding Players}" SelectedIndex="{Binding SelectedIndex}"> My problem is, that i want to bind selected index to property in code-behind. It work only on form start, but i need to disable user to change selection. Selectin will be changed ONLY programmaticaly. Thanks for all advices or solutions :) 回答1: So, working solution: private void playersList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (sender

理解SVG的viewport,viewBox【1】

依然范特西╮ 提交于 2019-12-19 16:37:04
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> viewport表示的是svg可视区大小,具体体现就是svg元素的width和height属性值所圈起来的区域: <svg width="400" height="300" style="border:1px solid #cd0000;"> <rect x="10" y="5" width="20" height="15" fill="#cd0000"/> </svg> 上述svg代码便定义了一个400px*300px的viewpoint,默认单位是px,也可以是其他web单位。上述代码的效果是: 在一个400px*300px的舞台上的(10,5)坐标位置放了一个20px*15px的矩形。显示效果全在意料之中,但是,如果svg增加新的属性viewBox,情况就大不相同了,代码: <svg width="400" height="300" viewBox="0,0,40,30" style="border:1px solid #cd0000;"> <rect x="10" y="5" width="20" height="15" fill="#cd0000"/> </svg> 效果: 只是在svg标签中增加了 viewBox="0,0,40,30" 就发生如此大的变化,那viewBox的4个属性值分别是什么

Maintaining fixed-thickness lines in WPF with Viewbox scaling/stretching

会有一股神秘感。 提交于 2019-12-18 13:28:44
问题 I have a <Grid> which contains some vertical and horizontal <Line> s. I want the grid to be scalable with the window size, and retain its aspect ratio, so it's contained in a <Viewbox Stretch="Uniform"> . However, I also want the lines to always render with a width of 1 pixel, so I use: Line line = new Line(); line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased); // other line settings here... This makes the lines' initial appearance ideal, but as soon as you start resizing the

Stretching the items in a WPF ListView within a ViewBox

吃可爱长大的小学妹 提交于 2019-12-18 11:45:45
问题 I have a frustrating problem that I would much appreciate some help with. I have a ListView within a ViewBox and I can't get the items within the ListView to stretch horizontally. Here is the XAML : <Window x:Class="WpfApplication3.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication3" Title="Window1"> <Window.Resources> <local:Inning x:Key="inning"> <local:Inning.Skins>

System.Windows.Media.Animation Warning: 6

耗尽温柔 提交于 2019-12-18 09:16:13
问题 When I run animation in wpf using storyboard I am getting following error in output window. System.Windows.Media.Animation Warning: 6 : Unable to perform action because the specified Storyboard was never applied to this object for interactive control.; Action='Stop'; Storyboard='System.Windows.Media.Animation.Storyboard'; Storyboard.HashCode='57850459'; Storyboard.Type='System.Windows.Media.Animation.Storyboard'; TargetElement='System.Windows.Media.Animation.Storyboard'; TargetElement