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

Disable Window Resizing #794

Closed
rocheston opened this issue Feb 22, 2022 · 5 comments
Closed

Disable Window Resizing #794

rocheston opened this issue Feb 22, 2022 · 5 comments

Comments

@rocheston
Copy link

iframe applications - For some applications I want to lock the window from resizing. How do I do that? Example: I have a clock application and I want to restrict the resizing. Lock the height/width.

What should I add to package/clock/dist/main.js file?

@andersevenrud
Copy link
Member

First off, you should never modify the dist folder contents. Modify the sources and rebuild instead.

https://manual.os-js.org/tutorial/window/ will show you how to remove resizing by setting an option.

@rocheston
Copy link
Author

Thank you.

@rocheston
Copy link
Author

rocheston commented Feb 24, 2022

It is not working for iFrame applications. Resizable option is still enabled and I can resize the windows. Here is the code. Please tell me what I am doing wrong? I want to lock the chess game from being resized.

File location: src/Package/AboutMaya/index.js

I rebuit everything. Still no go.


import osjs from 'osjs';
import {name as applicationName} from './metadata.json';

// Our launcher
const register = (core, args, options, metadata) => {
  // Create a new Application instance
  const proc = core.make('osjs/application', {args, options, metadata});

  // Create  a new Window instance
  proc
    .createWindow({
      id: 'AboutMayaWindow', resizable: false,
      title: metadata.title.en_EN,
      icon: proc.resource(proc.metadata.icon),
      dimension: {width: 400, height: 400},
      position: {left: 700, top: 200}
    })
    .on('destroy', () => proc.destroy())
    .render($content => {
      const iframe = document.createElement('iframe');
      iframe.style.width = '100%';
      iframe.style.height = '100%';
      iframe.src = proc.resource('/data/index.html');
      iframe.setAttribute('border', '0');
      $content.appendChild(iframe);
    });

grab0

@andersevenrud
Copy link
Member

That should be:

.createWindow({
  attributes: {
    resizable: false,
  }
})

@rocheston
Copy link
Author

That totally worked. Your support is fantastic. Thank you. 🙏

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

No branches or pull requests

2 participants