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

Support custom drag region when title bar is hidden #28

Closed
everdrone opened this Issue Jan 9, 2018 · 10 comments

Comments

Projects
None yet
4 participants
@everdrone
Copy link

everdrone commented Jan 9, 2018

this environment is totally new here, and since there is not much documentation for the whole "sketch plugin development" topic i'm learning by examples.

Managed to make a react ready environment with the help of this module, but with hideTitleBar set to true i can't find a way to make a draggable area in the UI.

any advice?

@everdrone everdrone changed the title Support `-webkit-drag-region: drag;` Support `-webkit-app-region: drag;` Jan 9, 2018

@mathieudutour

This comment has been minimized.

Copy link
Member

mathieudutour commented Jan 9, 2018

It's not possible yet. I need to dig into how to do that. Here is how Atom is doing it: https://github.com/electron/electron/blob/master/atom/browser/native_browser_view_mac.mm#L12-L154

@mathieudutour mathieudutour changed the title Support `-webkit-app-region: drag;` Support custom drag region when title bar is hidden Jan 9, 2018

@everdrone

This comment has been minimized.

Copy link
Author

everdrone commented Jan 9, 2018

nice

thanks for the reference, will look into that

@tborychowski

This comment has been minimized.

Copy link

tborychowski commented Nov 8, 2018

Any updates on this?

1 similar comment
@canisminor1990

This comment has been minimized.

Copy link

canisminor1990 commented Dec 16, 2018

Any updates on this?

@mathieudutour

This comment has been minimized.

Copy link
Member

mathieudutour commented Mar 14, 2019

fix in v3.0.0

Instead of -webkit-app-region: drag;, you will need to set data-app-region="drag" on your div

@tborychowski

This comment has been minimized.

Copy link

tborychowski commented Mar 15, 2019

There seems to be a problem with the v3.0.0.
When I update the plugin window doesn't even open.
I tried several times to switch between 2.1.7 and 3.0.0 and the former works every time, the latter doesn't (I even commented out all my executeJavascript leaving just the bare-bones BrowserWindow).

In Sketch dev-tools the error says:

Error in command MyPlugin Script at path /Users/tom/Projects/my-plugin/my-plugin.sketchplugin/Contents/Sketch/index.js 
does not contain a handler function named: onRun.
@mathieudutour

This comment has been minimized.

Copy link
Member

mathieudutour commented Mar 15, 2019

Do you have a repro I could try? The error doesn't seem to be related to this package

@tborychowski

This comment has been minimized.

Copy link

tborychowski commented Mar 15, 2019

@mathieudutour
I stripped down my actual plugin to the bare min, and here it is: https://github.com/tborychowski/my-plugin
It works no problem with the older version, but getting this error with v3.

@mathieudutour

This comment has been minimized.

Copy link
Member

mathieudutour commented Mar 15, 2019

That's because of this: https://github.com/tborychowski/my-plugin/blob/master/src/manifest.json#L23. Any reason to set it to false? The output from webpack doesn't work well with the cocoascript preprocessor.

Also don't use private APIs https://github.com/tborychowski/my-plugin/blob/master/src/index.js#L22-L25? there are APIs for all of this available

@tborychowski

This comment has been minimized.

Copy link

tborychowski commented Mar 15, 2019

Thanks @mathieudutour

  1. For the preprocessor - I assumed that when I'm using some CocoaScript this needs to be enabled :-) (seems to work without it)

  2. Yeah, I was playing around with something and forgot to remove it.

Btw, how do I hide the Minimise and Maximise buttons with the official APIs?
(maximizable: false only disables the button for me, instead of hiding it)

It's odd that this works with the older version though.
Anyway - changing the disableCocoaScriptPreprocessor to false fixes my issue.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.