Skip to content

Commit

Permalink
Allow the IF card window to scale up. (But not down; it scrolls.)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Plotkin authored and Andrew Plotkin committed May 4, 2016
1 parent d575e3d commit 305bf85
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions if-card.html
Expand Up @@ -2,6 +2,10 @@
<html>
<head>
<title>Play Some Interactive Fiction</title>
<script type="text/javascript">
window.$ = window.jQuery = require('./quixe/lib/jquery-1.11.2.min.js');
require('./if-card.js');
</script>
<style type="text/css">

body {
Expand Down
24 changes: 24 additions & 0 deletions if-card.js
@@ -0,0 +1,24 @@
'use strict';

/* These are the values defined in main.js, not in the HTML. */
const base_width = 810;
const base_height = 600;

function evhan_resize(ev)
{
var width = $(window).width();
var height = $(window).height();

var ratio = Math.min(width / base_width, height / base_height);

if (ratio < 1.0)
$('#card').css('transform', '');
else
$('#card').css('transform', 'scale('+ratio+','+ratio+')');
}

$(document).ready(function() {
$('#card').css('transform-origin', 'top left');
$('#card').css('margin-left', '10px');
$(window).on('resize', evhan_resize);
});
1 change: 0 additions & 1 deletion main.js
Expand Up @@ -575,7 +575,6 @@ function open_card_window()
{
var winopts = {
width: 810, height: 600,
maxWidth: 810, maxHeight: 600,
useContentSize: true,
javascript: false
};
Expand Down

0 comments on commit 305bf85

Please sign in to comment.