{"action":"opened","issue":{"url":"https://api.github.com/repos/krasimir/gifffer/issues/26","repository_url":"https://api.github.com/repos/krasimir/gifffer","labels_url":"https://api.github.com/repos/krasimir/gifffer/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/krasimir/gifffer/issues/26/comments","events_url":"https://api.github.com/repos/krasimir/gifffer/issues/26/events","html_url":"https://github.com/krasimir/gifffer/issues/26","id":248564419,"number":26,"title":"the problem of calculatePercentageDim ","user":{"login":"phoenix-yassin","id":6100314,"avatar_url":"https://avatars2.githubusercontent.com/u/6100314?v=4","gravatar_id":"","url":"https://api.github.com/users/phoenix-yassin","html_url":"https://github.com/phoenix-yassin","followers_url":"https://api.github.com/users/phoenix-yassin/followers","following_url":"https://api.github.com/users/phoenix-yassin/following{/other_user}","gists_url":"https://api.github.com/users/phoenix-yassin/gists{/gist_id}","starred_url":"https://api.github.com/users/phoenix-yassin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phoenix-yassin/subscriptions","organizations_url":"https://api.github.com/users/phoenix-yassin/orgs","repos_url":"https://api.github.com/users/phoenix-yassin/repos","events_url":"https://api.github.com/users/phoenix-yassin/events{/privacy}","received_events_url":"https://api.github.com/users/phoenix-yassin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-08-08T00:05:04Z","updated_at":"2017-08-08T00:05:04Z","closed_at":null,"body":"`function calculatePercentageDim (el, w, h, wOrig, hOrig) {\r\n  var parentDimW = el.parentNode.offsetWidth;\r\n  var parentDimH = el.parentNode.offsetHeight;\r\n  var ratio = wOrig / hOrig;\r\n\r\n  if (w.toString().indexOf('%') > 0) {\r\n    w = parseInt(w.toString().replace('%', ''));\r\n    w = (w / 100) * parentDimW;\r\n    h = w / ratio;\r\n  } else if (h.toString().indexOf('%') > 0) {\r\n    h = parseInt(h.toString().replace('%', ''));\r\n    h = (h / 100) * parentDimW;\r\n    w = h / ratio;\r\n  }\r\n\r\n  return { w: w, h: h };\r\n};`\r\n\r\nin the block 'else if', w & h is calculated in a flawed way!\r\nMaybe as below:\r\n`\r\nelse if (h.toString().indexOf('%') > 0) {\r\n    h = parseInt(h.toString().replace('%', ''));\r\n    h = (h / 100) * parentDimH;\r\n    w = h * ratio;\r\n  }\r\n`\r\n"}}
{"actor":{"display_login":"phoenix-yassin"}}