1
0
mirror of https://github.com/pdf2htmlEX/pdf2htmlEX.git synced 2024-12-21 20:50:07 +00:00

add CONTRIBUTING.md

This commit is contained in:
Lu Wang 2013-11-20 21:21:51 +08:00
parent feaa13e36f
commit a527bd0443
2 changed files with 142 additions and 11 deletions

136
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,136 @@
This is a general guide if you want to report bugs, ask questions,
request features or submitting patches.
Please take a moment to review this document in order to make the
process easy and effective for everyone involved.
This document is adapted from [necolas/issue-guidelines](https://github.com/necolas/issue-guidelines)
## Table of Contents
- [Channels](#channels)
- [The Issue Tracker](#issue-tracker)
- [The Mailing List](#mailing-list)
- [Contacting the Author](#author)
- [Guidance](#guide)
- [Ask Questions](#ask-question)
- [Bug Reports](#bug-report)
- [Feature Requests](#feature-request)
- [Pull Requests](#pull-request)
***
<div id="channels"></div>
## Channels
A few channels are available to reach the developers, please find the most proper one for your purpose.
<div id="issue-tracker"></div>
### The Issue Tracker
The [Issue Tracker](https://github.com/coolwanglu/pdf2htmlEX/issues)
is the best way for
[bug reports](#bug-report),
[features requests](#feature-request)
and [submitting pull requests](#pull-request).
Please respect the following restrictions:
* Do not post personal support requests, (e.g How can I call pdf2htmlEX in Java?). Use the mailing list, or [Stack Overflow](http://stackoverflow.com) instead.
* Keep the discussion on topic and respect the opinions of others.
* Posts violating the above restrictions may be removed without any notification.
<div id="mailing-list"></div>
### The Mailing List
The [Mailing list](pdf2htmlex@googlegroups.com) is set up for discussion and announcements.
You are welcome to [ask any question](#ask-question) about pdf2htmlEX there.
However do not report issues or submit patches there, since it's terrible to keep track of them.
<div id="author"></div>
### Contacting the author
pdf2htmlEX is mostly written and maintained by Lu Wang (王璐).
His email and twitter address of the author can be found in
[README.md](https://github.com/coolwanglu/pdf2htmlEX/blob/master/README.md).
Please post only messages that do not fit into the above channels, for example:
- Private messages to the author.
- Sample files with private information. (But please still report the bug via the issue tracker)
Please expect a _long_ delaysince the messages are usually archived and checked on a regular basis.
<div id="guidance"></div>
## Guidance
Here are a few tips for different types of messages.
Lots of your time may be saved if you follow the guidelines.
<div id="ask-question"></div>
### Ask questions
If you need any help or have issues using pdf2htmlEX,
follow the following steps to get it resolved as fast as possible:
First of all, did you realize that your question might have been already answered in one of the following places?
- [pdf2htmlEX Wiki](https://github.com/coolwanglu/pdf2htmlEX/wiki)
- The manpage (run `man pdf2htmlEX`)
- Old posts in the [mailing list](#mailing-list) or the [issue tracker](#issue-tracker)
- [Google](http://www.google.com/)
If you cannot find anything useful there, do not hesitate to post in the [mailing list](#mailing-list).
On the other hand, if you think it's something wrong about pdf2htmlEX, please [report a bug](#bug-report) instead.
<div id="bug-report"></div>
### Bug Reports
A bug is a demonstrable problem that is caused by the code in the repository.
A perfect bug report may help the developer to identify the cause and locate the problematic code quickly.
Before you report any bug:
- Use the latest git version of pdf2htmlEX, since the issue may have been already fixed.
- Search for previous issues (open or closed), to make sure that the issue has not been reported before.
A good bug report shouldn't leave others needing to chase you up for more information.
The developers may be very familiar with the code base of pdf2htmlEX,
but they may not know anything about your environment or what steps you have done,
unless you have them stated.
Please try to be as detailed as possible in your report.
Good examples include: [#58](https://github.com/coolwanglu/pdf2htmlEX/issues/58), [#183](https://github.com/coolwanglu/pdf2htmlEX/issues/183) and [#226](https://github.com/coolwanglu/pdf2htmlEX/issues/226).
If you are not sure, please try to answer the following questions:
- What's your operating system?
- What's the version of pdf2htmlEX and depended libraries? (You can post the output of `pdf2htmlEX -v`)
- Which browser(s) are you using?
- What steps will reproduce the issue? &mdash; please try to remove unnecessary steps
- What's the result and what did you expect? &mdash; e.g. you can post screenshots
- What error messages did you see?
- Where's the affected PDF file? &mdash; e.g. you may upload the file via Dropbox and post a link here
Especially for issues regarding building pdf2htmlEX:
- Which compiler are you using?
- What's the output of `cmake` and `make`?
- What's the content of `CMakeList.txt`?
<div id="feature-request"></div>
### Feature requests
Feature requests are welcome. But take a moment to find out whether your idea
fits with the scope and aims of the project. It's up to *you* to make a strong
case to convince the project's developers of the merits of this feature. Please
provide as much detail and context as possible.
<div id="pull-request"></div>
### Pull requests
Good pull requests - patches, improvements, new features - are a fantastic
help. They should remain focused in scope and avoid containing unrelated
commits.
**Please ask first** before embarking on any significant pull request (e.g.
implementing features, refactoring code, porting to a different language),
otherwise you risk spending a lot of time working on something that the
project's developers might not want to merge into the project.
Please read [_Using Pull Requests_](https://help.github.com/articles/using-pull-requests/)
if you are new to pull requests.
**IMPORTANT**: By submitting a patch, you agree to allow the project owner to
license your work under the same license as that used by the project.

View File

@ -663,13 +663,12 @@ Viewer.prototype = {
/**
* @param{number} ratio
* @param{boolean} is_relative
* @param{number=} offsetX
* @param{number=} offsetY
* @param{Array.<number>=} preserve_pos preserve the position after rescaling
*
* TODO: offsetX/Y is by default the center of container
* TODO consider scale on offsetX/Y
*/
rescale : function (ratio, is_relative, offsetX, offsetY) {
rescale : function (ratio, is_relative, preserve_pos) {
var old_scale = this.scale;
var new_scale = old_scale;
// set new scale
@ -683,14 +682,11 @@ Viewer.prototype = {
this.scale = new_scale;
if (! offsetX)
offsetX = 0;
if (! offsetY)
offsetY = 0;
if(!preserve_pos)
preserve_pos = [0,0]
// Save offset of the active page
var active_page = this.pages[this.cur_page_idx];
if (!active_page) return;
var active_page_ele = active_page.page;
var prev_offset = [ active_page_ele.offsetLeft, active_page_ele.offsetTop ];
@ -703,14 +699,13 @@ Viewer.prototype = {
var container = this.container;
// Correct container scroll to keep view aligned while zooming
var correction_top = active_page_ele.offsetTop - prev_offset[1];
container.scrollTop += correction_top + offsetY;
container.scrollTop += correction_top + preserve_pos[1];
// Take the center of the view as a reference
var prev_center_x = container.clientWidth / 2 - prev_offset[0];
// Calculate the difference respect the center of the view after the zooming
var correction_left = prev_center_x * (new_scale/old_scale - 1) + active_page_ele.offsetLeft - prev_offset[0];
// Scroll the container accordingly to keep alignment to the initial reference
container.scrollLeft += correction_left + offsetX;
container.scrollLeft += correction_left + preserve_pos[0];
// some pages' visibility may be toggled, wait for next render()
// renew old schedules since rescale() may be called frequently