I am trying to position an inner element inside the root element. The root element is set to be 100% high and 100% wide. However, I want the inner svg to be 10px or so from the edge of the outer svg--all except the right edge, which I would like to be 200px from the outer right edge. I want this to display in a web browser and so the user should be able to resize the browser and hence the outer svg while the inner svg should be able to maintain the correct distance from the outer svg on each side.
Like this:
+OUTER SVG------------------------------------------+
| |
| +INNER SVG----------------+ |
| | | |
| | | 200px |
| | | <---+-----+----> |
| | | |
| | | | 1
| | | | 0
| | | | 0
| | | | %
| | | |
| | | | h
| | | | i
| +-------------------------+ | g
| | h
| |
+---------------------------------------------------+
100% Wide
Is it possible to do this with SVG alone?
If I understand you correctly, this is trivial. SVG is built to have many visual elements in a Z stack, aligned, overlapped, whatever.
Use Inkscape, free and opensource, to create SVGs, and then you can edit the file directly in a text editor if you want to see how SVG is formed. In Inkscape you can use the alignment tools, the grid, the transform-scaling tool, drag and drop, and probably some other tools to accomplish this.
Related
Let's say we have 3 buffers (A, B, C) open in Vim arranged as follows
-----------------------------------------
| | |
| | |
| | |
| A | |
| | |
| | |
|------------------| B |
| | |
| | |
| C | |
| | |
| | |
-----------------------------------------
and we want to rearrange it as
-----------------------------------------
| | |
| | |
| | |
| | B |
| | |
| | |
| A |--------------------|
| | |
| | |
| | C |
| | |
| | |
-----------------------------------------
I know I can do this by closing C and reopening it after splitting B. Is there a simple way to do this where I don't have to close buffers and I can rearrange the windows directly?
You wouldn't "close" the buffer C, only the window that displays it.
Vim has dedicated normal mode commands for:
switching a window and the next one in a row or column,
rotating the whole window layout,
pushing a window to the far top, far right, far bottom, and far left,
but it doesn't have one for moving a window to an arbitrary point so, assuming the window you want to move has the focus, the command should look like this:
:q|winc w|sp c
which is not too shabby. You might be able to find a plugin that provides the level of control you are after on https://www.vim.org.
Values to check with
| | Northing | Easting |
|-------|----------|---------|
| Inst1 | 41345 | 33467.8 |
| inst2 | 41600.5 | 33607.2 |
| Inst3 | 41900.8 | 33740.2 |
| Inst4 | 41933.4 | 33780 |
| Inst5 | 41829.5 | 33694.6 |
| Inst6 | 41449.9 | 33539 |
Range of Coordinate
| | Northing | | Easting | |
|----|----------|----------|---------|----------|
| T1 | 41158.68 | 41396.88 | 33357.6 | 33517.57 |
| T2 | 41307.9 | 41456.6 | 33384.2 | 33580.5 |
| T3 | 41372.1 | 41517.5 | 33411.3 | 33607.5 |
| T4 | 41431.6 | 41572.7 | 33435.8 | 33632.5 |
| T5 | 41482.9 | 41654.6 | 33472.3 | 33654.2 |
| S1 | 41564.9 | 41701.2 | 33493.1 | 33688.7 |
| S2 | 41611.5 | 41762.3 | 33520.2 | 33708.3 |
| S3 | 41672.7 | 41841.6 | 33555.5 | 33734.1 |
| S4 | 41752.2 | 41897.9 | 33580.6 | 33767.6 |
| S5 | 41809.3 | 41941.7 | 33600.1 | 33791.7 |
| S6 | 41854.6 | 41998.7 | 33625.4 | 33810.7 |
| T6 | 41914.8 | 42055.4 | 33650.7 | 33836.1 |
| T7 | 41971.5 | 42137.4 | 33687.2 | 33859.9 |
Nested IF is not displaying the right value and can't go beyond row 48.
How can I have range M41:Q53 included?
Current formula in place below
=IF(N41<=$H$41<=O41 & P41<=$I$41<=Q41,M41,IF(N42<=$H$41<=O42 &
P42<=$I$41<=Q42,M42,IF(N43<=$H$41<=O43 &
P43<=$I$41<=Q43,M43,IF(N44<=$H$41<=O44 &
P44<=$I$41<=Q44,M44,IF(N45<=$H$41<=O45 &
P45<=$I$41<=Q45,M45,IF(N46<=$H$41<=O46 &
P46<=$I$41<=Q46,M46,IF(N47<=$H$41<=O47 &
P47<=$I$41<=Q47,M47,IF(N48<=$H$41<=O48 & P48<=$I$41<=Q48,M48,"Not
here"))))))))
When comparing coordinates, the choice of coordinate system doesn't change the logic very much. :-)
It can be tricky (but not impossible) to consistently check if a point is within a polygon, but just a plain ol' rectangle like this is straightforward. If you intend to compare more than a few coordinates then nested If's just won't work. (In fact they should be avoided at all times!)
For my quick-n-dirty example I took your data and put it into Columns vs Rows instead of side by side.
The formula is H6 is:
=IF(AND(H$3>=MIN($C6:$D6),H$3<=MAX($C6:$D6),H$4>=MIN($E6:$F6),H$4<=MAX($E6:$F6)),"Match","-")
Basically it's just checking:
Is Northing To Match greater than or equal to `MIN of NorthingStart & NorthingEnd?
Is Northing To Match less than or equal to `MAX of NorthingStart & NorthingEnd?
If Yes to both then the point Northing to Match is within the specified rectangle.
There are a number of other ways this could also be tackled. Which one is the right one depends mainly on how much data you'll be comparing, and whether it's an ongoing need (needing to account for unforeseen circumstances or not)...
The same thing could also be accomplished with side-by-side datasets with the help of an array formula.
Further Reading:
Introduction to Coordinate Geometry (many handy links)
SE: Analytic Geometry: How to check if a point is inside a rectangle?
Wikipedia: Intersection_theory
How to check if two given line segments intersect?
And a but of a tangent (no pun intended), but since I mentioned it & just for fun, a short explanation of:
How to check if a given point lies inside or outside a polygon?
1. Draw a horizontal line to the right of each point and extend it to infinity
2. Count the number of times the line intersects with polygon edges.
3. A point is inside the polygon if either count of intersections is odd or
point lies on an edge of polygon. If none of the conditions is true, then
point lies outside.
How to handle point g in the above figure?
Note that we should returns true if the point lies on the line or same
as one of the vertices of the given polygon. To handle this, after
checking if the line from p to extreme intersects, we check whether
p is colinear with vertices of current line of polygon. If it is
colinear, then we check if the point p lies on current side of
polygon, if it lies, we return true, else false. (Source)
I have been using the Notion Window Manager (http://notion.sourceforge.net/) for a few weeks. I was wondering if it is possible to create a keybinding that splits a workspace in the same way that META+S and META+K S splits a frame horizontally and vertically.
So if I had two vertical frames in a workspace like this:
-----
|1|2|
| | |
| | |
| | |
-----
The keybinding to split horizontally should add a new frame that spans the workspace horizontally:
-----
|1|2|
| | |
-----
| 3 |
-----
Currently META+S only splits the selected frame horizontally:
-----
|1|2|
| | |
|-| |
|3| |
-----
Is there any way to accomplish splitting the entire workspace horizontally or vertically in Notion?
The solution I came up with is to add a keybinding to the split_top function in cfg_tiling.lua. To split horizontally I added:
kpress(META.."Z", "WTiling.split_top(_, 'bottom')")
to the WTiling defbindings function. I also added
kpress("Z", "Wtiling.split_top(_, 'left')")
to the submap META.."K" bindings.
The split_top function splits at the root of the split tree. This will create a new frame that splits the entire workspace rather than the current frame.
One sizing issue that I noticed with this approach is that it will try to split the workspace exactly in half. If there is a horizontal frame splitting a workspace split_top will resize it to the smallest size and add a new frame below it. If there is a vertical frame it will become about 10 pixels wide when the new frame is added.
Horizontal size issue. New frames are 0 height:
Start ->Mod1+Z ->Mod1+Z
-1--2-- -1--2-- -1--2--
| | | | | | | | |
| | | | | | | | |
-3----- -3----- -3-----
| | -4----- -4-----
| | | | -5-----
| | | | | |
| | | | | |
------- ------- -------
Vertical size issue. New frames are 0 width:
Start -> Mod1+K Z -> Mod1+K Z
-1----2---- -4--1-2---- -5-41-2----
| | | | || | | ||| |
| | | | || | | ||| |
| |3---| | ||3---| | |||3---|
| | | | || | | ||| |
| | | | || | | ||| |
----------- ----------- -----------
Another issue is the focus does not change to the newly create frame. Hitting Mod1+Z will create the frame but the user has to Mod1+TAB to the frame to manipulate it.
This is a start but a comprehensive solution would check for frames that already split the workspace and split them instead and change the focus to the new frame.
Yes, you can.
You either need to put your binding in the workspace context or from the frame/mplex context you need to look up the managing workspace and then call split on that.
(I'd post code and more concrete terms but I'm not in front of a notion machine at the moment and don't want to confuse things by using the wrong ones.)
I usually have my Vim screen split into two vertical windows, each of which may be further horizontally split. Sometimes, I want to add or delete a vertical window. Is there a way to detect how many top-level vertical splits there are and add or remove vsplits as necessary?
For example, suppose my screen looks like this:
+--------+--------+
| | |
| | |
+--------+ |
| | |
| | |
| +--------+
| | |
+--------+--------+
I want :Columns 1 to give me
+--------+
| |
| |
+--------+
| |
| |
| |
| |
+--------+
by closing the two right-most windows.
I want :Columns 2 to do nothing, detecting that two columns are already open.
And I want :Columns 3 to give me
+--------+--------+--------+
| | | |
| | | |
+--------+ | |
| | | |
| | | |
| +--------+ |
| | | |
+--------+--------+--------+
I am fine if the function ignores vertical splits within horizontal splits. For example, if I had
+--------+
| |
| |
+---+----+
| | |
| | |
| | |
| | |
+---+----+
and I ran :Columns 2, I would get
+--------+--------+
| | |
| | |
+---+----+ |
| | | |
| | | |
| | | |
| | | |
+---+----+--------+
There is indeed a way, but it is involved; the first step is to count the currently-open vertical windows, and I don’t know of any built-in function that facilitates this. The working approach I found to it is basically to start at the first window (the top of the first — if not the entirety of the first — vertical split), and to then, using wincmd l, move to the next window to the right for as long as wincmd l moves to a new window, adding each to a count of open vertical windows including the first one. (I think this is what Gary Fixler referred to in the comments on the question.)
I started trying to write the code for posting here, and it grew to become larger than any function I would want to put in my ~/.vimrc, so I ended up turning it into a plugin which takes the above approach and provides the :Columns command; see Columcille (on vim.org at http://www.vim.org/scripts/script.php?script_id=4742.) The plugin also provides a command for similarly managing horizontal split windows: :Rows divides the current column (or the main window, if there are no open vertical splits) into the specified number of “rows.”
In Vim I tend to open buffers in new vertical splits (with the occasional horizontal split). I keep my code to 80 chars wide, so this works pretty well on large monitors.
I often end up with this window arrangement:
---------------------
| | | | |
| | | | |
------ | A | B |
| | | | |
| | | | |
---------------------
At four or five columns wide, it can start getting a bit too narrow, so then I want to move the windows around so it looks like this:
----------------
| | | A |
| | | |
------ ------
| | | B |
| | | |
----------------
As far as I know, this is impossible to do by moving the windows in Vim.
The only way to get that window arrangement I've found, is to close window A, and then re-open A as a new horizontal split from window B.
Is that correct, or is there a way to move/re-arrange windows like that in Vim? Maybe a plugin?
I'm yet to find anything, so I thought I would ask because I find the opening/closing of windows anoying and breaks my flow.
FWIW, I find the Ctrl-W + J / Ctrl-W + K shortcuts useless, because they make the new horizontal split as wide as the whole screen, rather than splitting with the neighbouring window. I.e. Ctrl-W + J would give me this:
----------------
| | | |
| | | |
------ | A |
| | | |
| | | |
----------------
| |
| B |
----------------
Which is generally never what I want.
If anyone has some ideas, let me know!
There's a plugin that can do exactly what you want. Here's the link : https://github.com/fabi1cazenave/suckless.vim.