How to prevent resizing a Chrome Packaged App? - google-chrome-extension

I've just jumped into developing apps for chrome, and just started with the "Hello World" example. My first thing I wanted to change is to prevent resizing of the window, I've searched and got nothing... :(
So, is this even possible right now?
Also, reading the documentation it says 'panel' is non-resizable,but at least in windows it is...

Use the resizable flag.
chrome.app.window.create("YourPage.html", {
"bounds": {
"width": 320,
"height": 240,
},
"resizable": false,
});

Specify min and max width and height when creating a window to constrain it. You can set min and max to the same value to make the window non-resizable.
E.g., here is a modified main.js from the Hello World sample:
chrome.app.runtime.onLaunched.addListener(function() {
chrome.app.window.create('index.html',
{minWidth: 500, minHeight: 309,
maxWidth: 500, maxHeight: 309});
});
For more details, see the app window api.

Related

How to charachter stand only center of tile not our site of tile

My code is here please look it. I have try my option but stuck in this.
https://www.codepile.net/pile/7mPpA9m0
What i do and please share me best solution. I'm stuck from last 2 weeks. in this problem please help me
As mention in a previews comment (I couldn't answer because the question was closed), the problem is the bounding-box of the physics objects.
It could be the player or the platform, depending on the images.
To know for sure turn on the debug information(debug: true) in the config of the Phaser Game Object. (a nice demo can be found here: https://phaser.io/examples/v3/view/physics/arcade/custom-debug-colors)
And than adjust the size of the bounding box. _(a nice demo can be found here: https://phaser.io/examples/v3/view/physics/arcade/smaller-bounding-box)
I here you can see what I mean in action.
The red and white player would have the same bounding box, but I made the box of the white player smaller with the function setSize and adjusted the position of the bounding box with the function setOffset.
Here a working Demo:
var config = {
type: Phaser.AUTO,
width: 536,
height: 183,
scene: {
create: create
},
physics: {
default: 'arcade',
arcade: {
gravity:{y:100},
//show debug information
debug: true
}
},
banner: false
};
function create () {
// JUST FOR DEMO START
let graphics = this.make.graphics();
graphics.fillStyle(0xffffff);
graphics.fillRect(10,5,10,25);
graphics.generateTexture('player', 30, 30);
// JUST FOR DEMO END
let platform = this.add.rectangle(150, 120, 100, 20, 0x00ff00)
.setOrigin(0, 1);
this.physics.add.existing(platform)
.body
.setImmovable(true)
.setAllowGravity(false);
let player = this.add.image(136, 50, 'player')
.setOrigin(.5, 1)
.setTint(0xff0000);
this.physics.add.existing(player);
let player2 = this.add.image(136, 50, 'player')
.setOrigin(.5, 1);
this.physics.add.existing(player2)
.body
// CHANGE SIZE OFF PHYSICS BOX
.setSize(14, 25, false)
.setOffset(8, 5)
.setAllowGravity(false)
.setVelocityY(10)
this.physics.add.collider(player, platform);
this.physics.add.collider(player2, platform);
}
var game = new Phaser.Game(config);
<script src="https://cdn.jsdelivr.net/npm/phaser#3.55.2/dist/phaser.js">
</script>
Depending on, if you player's or your platforms bounding-box is to big you will have to adjust it, or make images, that have less transparent borders.

Window resize "jitter" using wgpu-ris and winit

I'm experimenting with some rust code that is a slight re-structuring of the code shown in the Learn WGPU tutorial, including the addition of a uniform transform to draw objects at fixed (pixel) locations and sizes.
I notice that when I resize my window, that my boxes stretch, squash, and jitter drastically.
The stretching/warping follows the magnitude and direction of the delta, and once the resize is completed the boxes always settle at their correct position and size
GifCam's frame diff view shows the extent of the stretching during the move
To rule out any of my changes to the tutorial code, I cloned the repository, built and ran "tutorial6-uniforms", and it shows the same behavior with resizes stretching and squashing the shape as they occur.
Adding println's to my resize and render functions (and disabling redraws on MainEventsCleared) shows even pairs of resize events and redraws
redraw called PhysicalSize { width: 800, height: 600 } // initial draw
resize called PhysicalSize { width: 799, height: 600 } // resize begins
redraw called PhysicalSize { width: 799, height: 600 }
resize called PhysicalSize { width: 774, height: 589 }
redraw called PhysicalSize { width: 774, height: 589 }
This all makes me believe that there is something going on behind the scenes, where perhaps the frame is stretched first to match the window's new size before the redraw is completed? Is there a way to prevent this? When there are a lot of elements on the screen, especially text, this effect becomes pretty jarring. Not to mention most application's do not suffer from this, so it looks unprofessional and ugly.
Here is my event loop, I've omitted other code to keep my post size down but will add more if it helps troubleshoot the issue, or refer to the code here from the tutorial.
event_loop.run(move |event, _, control_flow| {
match event {
Event::WindowEvent {
ref event,
window_id,
} if window_id == window.id() => {
match event {
// ...
WindowEvent::Resized(physical_size) => {
renderer.resize(*physical_size);
},
_ => {}
}
},
Event::RedrawRequested(_) => {
match renderer.render() {
Ok(_) => {},
Err(e) => eprintln!("{:?}", e),
}
},
// no change in observed resizing behavior with or without
/*Event::MainEventsCleared => {
window.request_redraw();
},*/
// ...
_ => {}
}
})
I believe this is a winit issue, where it both sets the view to be automatically resized and also not giving the app chance to redraw before OS redraws the resized window. I haven't found a good workaround, so I guess the only path is for someone to dive in to winit code.
Changing the surface's presentation mode from Fifo to Immediate prevents distortion while resizing (on Windows 10).
// surface: wgpu::Surface, device: wgpu::Device
let config = wgpu::SurfaceConfiguration {
...
present_mode: wgpu::PresentMode::Immediate,
...
};
surface.configure(&device, &config);

Arabic font in Phaser.js

Hi I wanted to add some Arabic text to my Phaser game. I have the following in the update() function:
this.scoreText = this.add.text( this.world.centerX, this.world.height/5,
"",{nsize: "32px", fill: "#FFF", align: "center"});
this.scoreText.setText("تُفاحة");
This produces strange letters on the screen which are not Arabic. Any ideas?
First off, you shouldn't be adding text in the update() method - this would cause it to be added multiple times (once for each frame, ideally 60 times per second). Move it to the create() method so that it's only added once. You also have a typo in the parameters: nsize should be just size.
function create() {
this.scoreText = this.add.text( this.world.centerX, this.world.height / 5, "", { size: "32px", fill: "#FFF", align: "center" });
this.scoreText.setText("تُفاحة");
}
You can try something like
Import the font in the CSS part in index.html
#import url(https://fonts.googleapis.com/earlyaccess/amiri.css);
Then just declare the style as a variable
var style = { font: "32px Amiri", fill: "#333", align: "center" };
Then in the create function add the text like in this jsfiddle https://jsfiddle.net/albator2018/r2zLtoqd/
There is another manner to do it but like what i've just explained it works fine

Electron webPreferneces scrollBounce ineffective

The documentation for Electron states that the native macOS bounce effect on scrolling can be implemented using the webPreferences object when initating the browser window.
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
scrollBounce: true
}
})
This does not appear to have any effect when tested in 1.3.5. The documentation is clear at https://github.com/electron/electron/blob/master/docs/api/browser-window.md
Is this a bug or have we missed something.

Displaying qTip hover on outer nodes of Cytoscape.js graph?

When hovering over the outer nodes of graph in Cytoscape.js, the qTip dialog is not displayed.
Is there anyway to display the qTip bubbles upon hovering on an outer node? I can have the qtip popup on nodes in the upper half but not much along the sides of the graph. Especially towards the bottom half.
cy.elements('node').qtip({
id: function() {
return this.data('id');
},
content: function() {
return this.data('name') + '<br /><em>$' + this.data('weight') + '</em>';
},
position: {
my: 'bottom right',
viewport: $(etl_cyto_div),
adjust: {
cyViewport: true,
method: 'flip none'
}
},
show: {
cyBgOnly: false
},
hide: {
cyBgOnly: false,
cyViewport: true,
delay: 100
},
style: {
classes: 'qtip-tipsy',
tip: {
width: 16,
height: 8
}
}
});
I suspect your options may be causing the issue. Because this extension is a relatively thin wrapper around qtip, you just use the qTip API and options.
Try leaving options.position.adjust.method default
Try a more permissive options.position.adjust.method; see qtip docs
adjust.cyViewport is expensive (especially on touch) and can be buggy depending on the version of qtip used.
Try all defaults and see if you can reproduce your issue with the events you want. If not, then the issue is due to the set options. If so, please file your example code in an issue

Resources