Jssor - how to keep image aspect ratio? - jssor

Sometime photo aspect ratio is not same as slide container, I see that photo will be stretched to fill all the container space.
Is there any option to avoid this, to make photo aspect ratio not changed? Surely that there will be some blank space, but shapes in photo are not changed.

Please set $FillMode option, 0: streach, 1: contain, 2: cover, 4: actual size, 5: contain for large image and actual size for small image.
The value 1 or 2 or 4 will be good choice to keep aspect ratio
<script>
jQuery(document).ready(function ($) {
var options = {
$FillMode: 1, //[Optional] The way to fill image in slide, 0 stretch, 1 contain (keep aspect ratio and put all inside slide), 2 cover (keep aspect ratio and cover whole slide), 4 actuall size, 5 contain for large image and actual size for small image, default value is 0
$AutoPlay: true, //[Optional] Whether to auto play, to enable slideshow, this option must be set to true, default value is false
$DragOrientation: 3 //[Optional] Orientation to drag slide, 0 no drag, 1 horizental, 2 vertical, 3 either, default value is 1 (Note that the $DragOrientation should be the same as $PlayOrientation when $DisplayPieces is greater than 1, or parking position is not 0)
};
var jssor_slider1 = new $JssorSlider$("slider1_container", options);
});
</script>
Reference: Jssor Slider Options

Related

Math doesn't work for the size and position of Game Pieces WRT the size of their container "room"

The positions and sizes of my Game Pieces, as set by CGPoint(..) and CGRect(..), don’t make arithmetic sense to me when looked at with respect to the width and height of the surrounding container of all Game Pieces?
Let me illustrate with just one specific example –
I call the surrounding container = “room”.
One of many specific Game Pieces = “rock”.
Here’s the math
roomWidth = Double(UIScreen.main.bounds.width)
roomHeight = Double(UIScreen.main.bounds.height)
While in Portrait mode:
roomWidth = 744.0
roomHeight = 1133.0
When rotated to Landscape mode:
roomWidth = 1133.0,
roomHeight = 744.0
So far so good .. here’s the problem:
When I look at my .sks file, the width of the “rock” and its adjacent game pieces far exceeds the roomWidth; for example,
Widths of rock + paddle + tree = 507 + 768 + 998 which obviously exceeds the room’s width for either Portrait or Landscape mode – and this math doesn’t even address the separation between Game Pieces.
The final math “craziness” looks at the swift xPos values for each Game Piece as specified in my .sks file:
Room: xPos = 40,
Rock: xPos = -390,
Paddle: xPos = -259,
Tree: xPos = 224
I cannot grasp the two high negative numbers .. to me, that means the Rock and the Paddle shouldn’t even be visible .. seriously off-screen.
One significant addition = I did set the Autoresizing Mask to center horizontally and vertically
I need a serious infusion of “smarts” here.
The default anchorPoint of an sks file (SpriteKit Scene file) is (0.5, 0.5). So the origin (0, 0) of the scene is drawn at the center of the SKView. You can change the anchor point in the Attributes inspector when editing the sks file. The default means that negative coordinates not too far from the origin will be visible in the SKView.
The scene also has a scaleMode property which determines how the scene is scaled if its size doesn't match the SKView's size. The default is .fill, which means the view scales the scene's axes independently so the scene's size exactly fills the view.

ActiveReports Change Image size at runtime

I have an image that is 300px width and has to be set at runtime. At design time, the image is a different size and depending on a flag, the image has to be changed. How do I set the image width in C#/VB.NET.
I cast the object as a Picture. The Width property only takes a SINGLE value and presume its inches. How do I tell the picture control that I'm passing in is the pixel size not inches?
Here's an example of how you can set the size in pixels, convert it to inches (as the GrapeCity Team suggests), and apply it to your picture based on a conditional variable:
The following code is added in the Script section of your report:
Sub Detail_Format
Dim intSizeInPixels As Integer = 300
Dim dblSizeInInches as Double = intSizeInPixels / 96
Dim mfFlag As Boolean = True
If mfFlag Then
Picture1.Width = dblSizeInInches
End If
End Sub

How to scale two game objects with different scale sizes proportionally?

I have two game objects, one for main canvas and other for editor (a dummy version).
The scale for main go is 1, 1, 1 and other one (dummy) is .3, .3, .3. What I want to do is scale the main gameobject proportionally based on the scale percent that the user sets to dummy go, how I can do this?
DummyGameObject.transform.localScale = CanvasGameObject.transform.localScale * 0.33f; //or
DummyGameObject.transform.localScale = CanvasGameObject.transform.localScale / 3;

GtkPaned widget for arbitrary geometries?

I would like my application window to be divided into rectangles with sides perpendicular to the window borders. The number of rectangles would normally be quite large, and the user should be able to resize the rectangles.
Is there a Gtk widget which would allow for that? GTkPaned comes close - by embedding several GtkPaned widgets one can get such rectangle disivisons, but not all of them are possible - one obvious constraint is that there must be an edge which spans the whole window either horizontally or vertically. The simplest arrangement I know of which doesn't have this property, and so can't be built with Gtkpaned, is: one square in the middle and four rectangles of the same size each, around the square.
Is there a widget which allows for such arbitrary resizable rectangle arrangements in Gtk?
If you don't have to have the dividing lines draggable, then use a GtkGrid:
grid = Gtk.Grid()
grid.attach(widget1, 0, 0, 3, 1)
grid.attach(widget2, 3, 0, 1, 3)
grid.attach(widget3, 0, 1, 1, 3)
grid.attach(widget4, 1, 3, 3, 1)
grid.attach(widget5, 1, 1, 2, 2)
# 1112
# 3552
# 3552
# 3444

UIScrollView: content offset calculation after zoom

Could somebody advice which formula used to content offset calculation after zoom in UIScrollView? Let's consider following example:
I have a UIScrollView with content view in size (1000, 1000), then if I programmatically setZoomScale to 2.0 and in scrollViewDidEndZooming:withView:atScale method I will have the following:
contentSize before zoom = {1000, 1000}
contentOffset before zoom = {0, 0}
scale = 2.000000
contentSize after zoom = {2000, 2000}
contentOffset after zoom = {160, 230}
I need to know how the new value of contentOffset {160, 230} calculated. Is there any dependency of formula that used to calculate the content offset in this case?
Thanks
This may or may not be relevant, but note that 160x230 is half the resolution of the iPhone, less the status bar: 320x460. Try changing the UIScrollView's frame, or its superview's frame, and see how this affects the numbers.
EDIT: Come to think of it, it makes perfect sense that the offset is half the size of the scroll view, as it will expand equally in both directions. So, the formula would be: contentOffset = (scrollView.frame.size.width/2 * (scaleAfter - scaleBefore), scrollView.frame.size.height/2 * (scaleAfter - scaleBefore)).
Therefore, if the scale was 4.0f, the offset would be: (320/2 * (4-1), 460/2 * (4-1)) => (480, 690). Try a scale of 4 and see if (480, 690) comes out.