Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Idea: relative right, left, top, bottom based on styler symbol #230

Open
markrickert opened this issue Mar 23, 2015 · 4 comments
Open

Idea: relative right, left, top, bottom based on styler symbol #230

markrickert opened this issue Mar 23, 2015 · 4 comments

Comments

@markrickert
Copy link
Member

I think it would be neat to do something like this in a stylesheet

def thing1(st)
  st.frame = {
    t: 5,
    l: 5,
    w: 10,
    h: 10
  }
end

def thing2(st)
  st.frame = {
    below: :thing1,
    right_of: :thing1
    w: 10,
    h: 10
  }
end

and it would put thing2 at: [15, 15]

We'd have to think of how we might be able to integrate spacing in this so like I want to place something to the right of element thing_n plus 10 points, for example.

Thoughts?

@twerth
Copy link
Member

twerth commented Mar 24, 2015

Yeah, I think it's a good idea. But I agree we'd have to come up with something that worked well when specifying the gap.

So currently you'd do this if you want it set to [25,25]:

def thing2(st)
  st.frame = {
    t: rmq(:thing1).frame.bottom + 10,
    l: rmq(:thing1).frame.right + 10,
    w: 10,
    h: 10
  }
end

We can come up with a good API for that. Let me think.

@twerth
Copy link
Member

twerth commented Mar 24, 2015

We could use padding, but this doesn't seem very nice:

def thing2(st)
  st.frame = {
    below: :thing1,
    right_of: :thing1,
    w: 10,
    h: 10,
    padding: {l: 10, t: 10}
  }
end

@twerth
Copy link
Member

twerth commented Mar 24, 2015

This isn't very nice either:

def thing2(st)
  st.frame = {
    below: {thing1: 10},
    right_of: {thing1: 10},
    w: 10,
    h: 10
  }
end

@twerth
Copy link
Member

twerth commented Mar 24, 2015

I like this one, as it's consistent with below_prev: 10

def thing2(st)
  st.frame = {
    below(:thing1): 10,
    right_of(:thing1): 10,
    w: 10,
    h: 10
  }
end

For 0, just use 0:

def thing2(st)
  st.frame = {
    below(:thing1): 0,
    right_of(:thing1): 0,
    w: 10,
    h: 10
  }
end

Yup, I like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants