framer-templates icon indicating copy to clipboard operation
framer-templates copied to clipboard

Does this work in the latest version of Framer Studio?

Open madoublet opened this issue 10 years ago • 8 comments
trafficstars

I just tried to create a custom template using your repo. However, I get this error when I include it in Framer studio.

[undefined] TypeError: undefined is not an object (evaluating 'Framer.Config.template')

I get the same error if I include one of the existing templates as well. It looks like the repo hasn't been updated in awhile, so I just wanted to check it has been tested recently or if the problem is something I did.

madoublet avatar May 15 '15 18:05 madoublet

It took a bit of hacking, but I got it to work with the following changes:

var options = _.defaults(Framer.Config.template || {}, defaults);

To:

var options = _.defaults({}, defaults);

And then changing the root from:

root = document.getElementById('FramerRoot');

To:

root = document.getElementById('FramerContextRoot-Default');

madoublet avatar May 15 '15 19:05 madoublet

Thanks for bringing this up (and for providing the fix as well). I'll try to get around to updating the templates in the next few days.

tisho avatar May 17 '15 07:05 tisho

All should be fine now.

tisho avatar May 18 '15 03:05 tisho

Thanks! I will check it out this morning.

madoublet avatar May 18 '15 13:05 madoublet

This positioned the device correctly, but the content frame was not being resized. I added the following code to resize the content frame:

function positionFramerRoot(){

   // ... code to position the framer ...

    var deviceBackground = root.querySelector('.DeviceBackground');
    deviceBackground.style.width = contentWidth + 'px';
    deviceBackground.style.height = contentHeight + 'px';

    var devicePhone= root.querySelector('.DevicePhone');
    devicePhone.style.width = contentWidth + 'px';
    devicePhone.style.height = contentHeight + 'px';

    var deviceScreen= root.querySelector('.DeviceScreen');
    deviceScreen.style.width = contentWidth + 'px';
    deviceScreen.style.height = contentHeight + 'px';

    var deviceComponentPort = root.querySelector('.DeviceComponentPort');
    deviceComponentPort.style.width = contentWidth + 'px';
    deviceComponentPort.style.height = contentHeight + 'px';

    var deviceContent = root.querySelector('.DeviceContent');
    deviceContent.style.width = contentWidth + 'px';
    deviceContent.style.height = contentHeight + 'px';

}

This works pretty well for me now, although the cursor is gigantic.

madoublet avatar May 18 '15 15:05 madoublet

I wanted to add that my touch events are not working with the fix I applied as well.

madoublet avatar May 19 '15 20:05 madoublet

Can you try again? I've tested touch events on my iPhone and everything seems to be working correctly now, but please confirm it works on your end as well.

Out of curiosity, why are you using these templates, instead of just configuring Framer.Device?

tisho avatar May 21 '15 06:05 tisho

I will try it out this morning. I am using the library to create a custom device (Samsung Tab S). It has a pretty unique resolution (1600 x 2560). I took a look at Framer.Device but it looks like it is limited to setting the background. But, I am really new to Framer. So, I might not know what is possible within the tool.

madoublet avatar May 21 '15 12:05 madoublet