Absolute positioning by reference x,y in FPDF (php) - fpdf

Is there a way to absolutely position items in FPDF?
SetY() uses relative positioning...
If I wish to write at [100,100] and then go back to position [20,20] on the page...
Is there a way to do this?

Use the SetY() method which allows you to set position at an absolute location in the page, starting from the top or the bottom. For example, SetY(20) or SetY(-20) to start from the bottom of the page.

Related

Application Menu on top of Leaflet map

In a map application based on Leaflet, I would like to have a large application menu, kind of a settings menu. I managed to put a nice button into the top right corner as a L.Control and it gets fired on a click.
The menu should position either to the left of the menu button or simply in the middle of the screen.
I am wondering whether it is best practice to use
a Popup,
a Layer,
another Control or
just position a at the right place on the page.
Trying the latter, I found that I have to set z-index to a very high value to see it, and it feels a bit odd not to use the Leafleat features.
What would be the "right" solution to use with Leaflet?
If you want a full screen map, you can use https://github.com/Turbo87/leaflet-sidebar
I use it here: http://franceimage.github.io/map
You can create a nice customized icons based toolbar using Leaflet easybutton plugin.
You will have all the leaflet based controls (Click, hover, position etc.) to set that up as per your requirements.
Here are the implementation examples:
http://danielmontague.com/projects/easyButton.js/v1/examples/
and github repo: https://github.com/CliffCloud/Leaflet.EasyButton

How to check which place in panel was clicked? GWT

How can I check which place in Panel Was clicked? I know, I have this some functions:
getClientX, getClientY, getNativeButton, getRelativeX, getRelativeY, getScreenX, getScreenY, getX, getY
but how can I check which click Was near right side of panel and which was near left side of the panel?
I can't add to the Panel two div's with 50% width and detect in that way..
More info:
It's a lot of panels. I must do this in each of panel. I don't know how many panels we have. We have got a constans width of each panel = 400px.
Regards!
Assuming you're handling an onClick event or similar for a panel, you can get the cursor position with getClientX or something similar. Then just get the position and size of the panel and simply check what you're closet to; all elements are rectangular, so shouldn't be too difficult to just write four ifs for it.
The getElement() method will give you the panel's underlying element, so you may need to use that to get the exact size and position.

Bing Maps Ajax v7 Directions Module incorrectly sets bounds when map layer is hidden

I have a relatively simple web app, that allows the user to enter two waypoints (from and to locations), then click a button to get the directions itinerary and a map with the route path plotted on the map.
The app was laid out so that the form, the itinerary and the map where in separate "tabs" and the layers could be shown and hidden based on the tab selection.
Oddly, the map would always be zoomed right out to the minimum zoom (entire world view) although the pushpins (waypoints) and route path were correctly plotted, the map bounds were not being honored. If the map was visible, then those route path bounds were honored and the map functioned as expected.
An example of this is here: http://jsfiddle.net/junto/DMR2T/
Click on 'Get Directions' when the map is visible, and the map is zoomed to the correct bounds. Then toggle the map and click 'Get Directions' again. Toggle the map back to visible. You'll see the map has the incorrect zoom level and bounds.
Lastest build of Google Chrome, Safari, Firefox all display this issue. Internet Explorer does not.
Is this a bug?
My guess is that in order to properly compute zooming and bounds, the map needs to know its display size. In order for the map to know that, it needs to be visible. So a workaround would be to move the map off screen rather than hiding it.
See my updated example here: http://jsfiddle.net/ZWzjC/
In my example I simply set a negative left margin, I'm sure there are more clever ways to move something off the screen while maintaining its visibility. I tried using visibility:hidden but that doesn't seem to hide the map correctly. display:none won't work since that causes the map to have 0 dimensions, and that's what .toggle() probably uses internally anyway.

make the page scroll to show the full contents of a div element?

I'm using a simple javascript toggle function to expand a div to show its contents. If the div is near the bottom of the screen, it expands and some of the div disappears off the screen.
How can I get the page to automatically scroll down to make sure the div is in view?
Each element on your page, including your DIV, will have a set of offset values relative to the document. You can get these via the $.offset() method. This will give you the x and y coordinates to the element on the page.
There are many plugins that exist in the wild (such as $.scrollTo() by Ariel Flesler) which will animate scrolling of your page for you, and even do so via a set of provided coordinates. You would join these two items together to automate a scrolling to the offset coordinates of your DIV.
Just make sure your DIV isn't taller than your viewport, or else you'll need to scroll even more to see all of it.

How can I align text inside a GnomeCanvas text item

I would like to have a GnomeCanvas text item and according to its content (and the content language) decide whether to align the text to the right or to the left.
I found one way to do it by changing the anchor property, but using this method would require me to manage the anchor position myself (change it to the right of the text bounding box when aligning to the right), and it seems there must be a simpler way.
EDIT: I see there is also the justification property, which allows me to align the text to the right. However, I still need to set the anchor point according to the language, instead of setting a bounding box that would apply to any language.
Its about a month without another answer. I guess my first understanding was correct and there isn't another way with the canvas. My solution would then be to change the anchor to east and change the anchor point accordingly.