Skip to content

Instantly share code, notes, and snippets.

@jordandobson
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jordandobson/948ef6243ed38de40f6b to your computer and use it in GitHub Desktop.
Save jordandobson/948ef6243ed38de40f6b to your computer and use it in GitHub Desktop.
# DEFAULTS #####################################################################################################
document.body.addEventListener('touchmove', (e) -> e.preventDefault() );
######################################################################################################################
# HELPER METHODS #####################################################################################################
######################################################################################################################
getComponent = (layer, parentLayer, opts) ->
c = layer.copy()
c.visible = true
c.superLayer = parentLayer if parentLayer
c.x = opts.x if opts and opts.x
c.y = opts.y if opts and opts.y
c.backgroundColor = opts.bg if opts and opts.bg
return c
class EdgeResizeFixer extends Layer
constructor: (@options) ->
super @options
@properties = backgroundColor: COLOR.clear, width: SCREEN.width, height: SCREEN.height, x: 0, y: 0, clip: false
@.style = { "boxShadow": "0 0 0 20px black, inset 0 0 0 1px black" }
@.bringToFront()
# This is a subset of my values I use
# VALUES / CONSTANTS #####################################################################################################
SCREEN =
width: Framer.Device.screen.width
height: Framer.Device.screen.height
COLOR =
blue: "#094ab2"
white: "#ffffff"
black: "#000000"
smoke: "#f2f2f2"
lightest:"#e5e5e5"
light: "#cccccc"
grey: "#999999"
greyer: "#848484"
clear: "transparent"
white95: "rgba(255,255,255,.95)"
white90: "rgba(255,255,255,.9)"
white33: "rgba(255,255,255,.33)"
white25: "rgba(255,255,255,.25)"
black25: "rgba(0,0,0,.25)"
black10: "rgba(0,0,0,.10)"
black40: "rgba(0,0,0,.40)"
grey50: "rgba(127,127,127,.5)"
toSet: "#E0119D"
dark: "#1a1a1a"
# Examples of components to make available to your view for reuse
######################################################################################################################
ICON =
burger: new Layer height: 31, width: 41, image: IMAGE.menu, visible: false
search: new Layer height: 33, width: 33, image: IMAGE.search, visible: false
info: new Layer height: 44, width: 44, image: IMAGE.info, visible: false
share: new Layer height: 53, width: 38, image: IMAGE.share, visible: false
add: new Layer height: 42, width: 42, image: IMAGE.add, visible: false
back: new Layer height: 36, width: 20, image: IMAGE.back, visible: false
LIST =
row: new Layer height: SIZE.barH, width: SCREEN.width, backgroundColor: COLOR.white, x: 0, y: 0, visible: false
icon: new Layer name: NAME.icon, height: SIZE.barH, width: SIZE.listIconW, backgroundColor: COLOR.clear, x: SIZE.edge
text: new Layer name: NAME.text, height: SIZE.barH, width: SIZE.listText, backgroundColor: COLOR.clear, x: SIZE.listIconW + (SIZE.edge*2), y: 0, clip: false
textLabel: new Layer name: NAME.textLabel, height: 40, width: SIZE.listText, backgroundColor: COLOR.clear, x: 0, y: 10
textSub: new Layer name: NAME.textSub, height: 40, width: SIZE.listText, backgroundColor: COLOR.clear, x: 0, y: 44
image: new Layer name: NAME.image, height: SIZE.listIconW, width: SIZE.listIconW, backgroundColor: COLOR.clear, x: 0, y: ((SIZE.barH - SIZE.listIconW) / 2) - 3, image: IMAGE.folderShared
TEXT =
headerTitle: new Layer height: 44, width: SCREEN.width, backgroundColor: COLOR.clear, visible: false
headerTitleAccountLabel: new Layer height: 22, width: SCREEN.width, backgroundColor: COLOR.clear, x: 0, y: 56
pivotTitle: new Layer height: 88, width: SCREEN.width/4, backgroundColor: COLOR.clear, visible: false
# LIST ######################################################################################################################
# Combine List Layers
LIST.icon.superLayer = LIST.row
LIST.text.superLayer = LIST.row
LIST.image.superLayer = LIST.icon
LIST.textSub.superLayer = LIST.text
LIST.textLabel.superLayer = LIST.text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment