Coder Social home page Coder Social logo

com.miga.waterfall's Introduction

Alloy Waterfall layout Titanium Alloy

The widget will create a scrollview Waterfall layout with images

Preview

alt text

Quick Start

Get it gitTio

Download this repository and install it:

  • In your application's config.json file, include the following line in your dependencies:
"dependencies": {
    "com.miga.waterfall": "1.0"
}
  • Copy the com.miga.waterfall folder into your app/widgets directory.

Or simply use the gitTio CLI:

$ gittio install com.miga.waterfall

Use it

###xml

<Widget src="com.miga.waterfall" id="waterfall"/>

###controller

####add image

// random item size:
var sx = Math.floor(Math.random() * 2) + 1;
var sy = Math.floor(Math.random() * 2) + 1;

// find maximum free width
var freeX = $.waterfall.getFreeWidth();
if (sx>freeX) {
    sx=freeX;
}

// image
var img = $.UI.create("ImageView", {
    image: "http://lorempixel.com/200/200/",
    width: 200,
    height: 200,
    backgroundColor: "#fff",
});

// add item
var obj = $.waterfall.addItem({
    object: img,
    resize: true,
    borderWidth: 1,
    borderColor: "#fff",
    placeholder: {
        backgroundColor: "#999"
    },
    size: {
        x: sx,
        y: sy
    }
});

Documentation

Public methods

Method Description
addItem adds a new image
getFreeWidth returns the maximum column width for a new item
getItemWidth returns the maximum image width for one cel
clear clears the whole list

TODO / Ideas for improvement

Feel free to improve this widget by forking, submitting pull requests or creating issues.

Changelog

  • 1.0 First version

Licences

This project is licensed under CC BY-SA 4.0. Please read the https://creativecommons.org/licenses/by-sa/4.0/ for more information about this license.

Appcelerator, Appcelerator Titanium and associated marks and logos are trademarks of Appcelerator, Inc.
Titanium is Copyright (c) 2008-2015 by Appcelerator, Inc. All Rights Reserved.
Titanium is licensed under the Apache Public License (Version 2).

com.miga.waterfall's People

Contributors

m1ga avatar

Watchers

Steven avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.