Fix Issue 33: Gradient picker for fill/stroke. Also start to optimize suspendRedraw/unsuspend. Added vector image of logo.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@346 eee81c28-f429-11dd-99c0-75d572ba1ddd
202
editor/jgraduate/LICENSE
Normal file
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
3
editor/jgraduate/README
Normal file
@@ -0,0 +1,3 @@
|
||||
jGraduate - A jQuery plugin for picking gradients
|
||||
|
||||
Licensed under the Apache License 2. See LICENSE for more information.
|
||||
171
editor/jgraduate/css/jGraduate-0.2.0.css
Normal file
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* jGraduate Default CSS
|
||||
*
|
||||
* Copyright (c) 2009 Jeff Schiller
|
||||
*
|
||||
* Licensed under the Apache License Version 2
|
||||
*/
|
||||
|
||||
h2.jGraduate_Title {
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 11px !important;
|
||||
font-weight: bold;
|
||||
margin: -13px 0px 0px 0px;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.jGraduate_Picker {
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 12px;
|
||||
border-style: solid;
|
||||
border-color: lightgrey black black lightgrey;
|
||||
border-width: 1px;
|
||||
background-color: #EFEFEF;
|
||||
position: absolute;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
li.jGraduate_tab_color, li.jGraduate_tab_lingrad {
|
||||
background-color: #ccc;
|
||||
display: inline;
|
||||
border: solid 1px grey;
|
||||
padding: 3px;
|
||||
margin: 2px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
li.jGraduate_tab_current {
|
||||
background-color: #EFEFEF;
|
||||
display: inline;
|
||||
padding: 3px;
|
||||
margin: 2px;
|
||||
border: solid 1px black;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.jGraduate_colPick {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.jGraduate_lgPick {
|
||||
display: none;
|
||||
border: outset 1px #666;
|
||||
padding: 10px 7px 5px 5px;
|
||||
}
|
||||
|
||||
.jGraduate_tabs {
|
||||
position: relative;
|
||||
background-color: #EFEFEF;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
div.jGraduate_Swatch {
|
||||
display: inline-block;
|
||||
margin: 8px;
|
||||
}
|
||||
div.jGraduate_GradContainer {
|
||||
border: 2px inset #EEE;
|
||||
background-image: url(../images/map-opacity.png);
|
||||
background-position: 0px 0px;
|
||||
height: 256px;
|
||||
}
|
||||
|
||||
.jGraduate_AlphaArrows {
|
||||
position: absolute;
|
||||
margin-top: -10px;
|
||||
margin-left: 250.5px;
|
||||
}
|
||||
|
||||
div.jGraduate_Opacity {
|
||||
border: 2px inset #eee;
|
||||
margin-top: 14px;
|
||||
background-color: black;
|
||||
background-image: url(../images/Maps.png);
|
||||
background-position: 0px -2816px;
|
||||
height: 20px;
|
||||
cursor: ew-resize;
|
||||
}
|
||||
|
||||
div.jGraduate_OpacityField {
|
||||
margin-top: 110px;
|
||||
margin-left: -10px;
|
||||
}
|
||||
|
||||
div.jGraduate_Form {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 140px;
|
||||
margin: -3px 3px 0px 4px;
|
||||
}
|
||||
|
||||
div.jGraduate_StopSection {
|
||||
width: 120px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.jGraduate_OkCancel {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
width: 113px;
|
||||
}
|
||||
|
||||
input.jGraduate_Ok, input.jGraduate_Cancel {
|
||||
display: block;
|
||||
width: 100px;
|
||||
margin-left: -4px;
|
||||
margin-right: -4px;
|
||||
}
|
||||
input.jGraduate_Ok {
|
||||
margin: 9px -4px 5px -4px;
|
||||
}
|
||||
|
||||
.colorBox {
|
||||
display: inline-block;
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
border: 1px solid #808080;
|
||||
vertical-align: -7px;
|
||||
cursor: pointer;
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
label.jGraduate_Form_Heading {
|
||||
position: relative;
|
||||
top: 10px;
|
||||
background-color: #EFEFEF;
|
||||
padding: 2px;
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
div.jGraduate_Form_Section {
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: grey;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
padding: 15px 5px 5px 5px;
|
||||
margin: 2px;
|
||||
width: 110px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.jGraduate_LightBox {
|
||||
position: fixed;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
background-color: #000;
|
||||
opacity: 0.5;
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.jGraduate_stopPicker {
|
||||
position: absolute;
|
||||
display: none;
|
||||
background: #E8E8E8;
|
||||
}
|
||||
227
editor/jgraduate/css/jPicker-1.0.9.css
Executable file
@@ -0,0 +1,227 @@
|
||||
.jPicker_Picker {
|
||||
display: inline-block;
|
||||
height: 24px; /* change this value if using a different sized color picker icon */
|
||||
position: relative; /* make this element an absolute positioning container */
|
||||
text-align: left; /* make the zero width children position to the left of container */
|
||||
width: 25px; /* change this value if using a different sized color picker icon */
|
||||
}
|
||||
.jPicker_Color {
|
||||
display: block;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
.jPicker_Icon {
|
||||
background-repeat: no-repeat;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
.jPicker_Container {
|
||||
display: none;
|
||||
z-index: 10; /* make sure container draws above color picker icon in Firefox/Safari/Chrome/Opera/etc. -
|
||||
IE calculates z-index so this won't work - we will hide all color picker icons placed after the selected one in code when shown in IE */
|
||||
}
|
||||
.jPicker_table {
|
||||
background-color: #efefef;
|
||||
border: 1px outset #666;
|
||||
font-family: Arial, Helvetica, Sans-Serif;
|
||||
font-size: 12px;
|
||||
height: 330px;
|
||||
margin: 0px;
|
||||
padding: 5px;
|
||||
width: 550px;
|
||||
}
|
||||
.jPicker_table td {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
vertical-align: top;
|
||||
}
|
||||
.jPicker_MoveBar {
|
||||
background-color: #dddddd;
|
||||
border: 1px outset #aaa;
|
||||
cursor: move;
|
||||
height: 12px;
|
||||
}
|
||||
.jPicker_Title {
|
||||
font-size: 11px !important;
|
||||
font-weight: bold;
|
||||
margin: -2px 0px 0px 0px;
|
||||
padding: 0px;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
.jPicker_ColorMap {
|
||||
border: 2px inset #eee;
|
||||
cursor: crosshair;
|
||||
height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
||||
margin: 0px 5px 0px 5px;
|
||||
overflow: hidden; /* hide the overdraw of the Color Map icon when at edge of viewing box */
|
||||
padding: 0px;
|
||||
position: relative; /* make this element an absolute positioning container */
|
||||
width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
||||
}
|
||||
div[class="jPicker_ColorMap"] {
|
||||
height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
||||
width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
||||
}
|
||||
.jPicker_ColorMap_l1, .jPicker_ColorMap_l2, .jPicker_ColorMap_l3, .jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3, .jPicker_ColorBar_l4, .jPicker_ColorBar_l5, .jPicker_AlphaBar_l1, .jPicker_AlphaBar_l2 {
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
.jPicker_ColorMap_l1 {
|
||||
background-color: #000000;
|
||||
background-image: none;
|
||||
}
|
||||
.jPicker_ColorMap_l2 {
|
||||
background-color: transparent;
|
||||
}
|
||||
.jPicker_ColorMap_l3 {
|
||||
background-repeat: repeat;
|
||||
}
|
||||
.jPicker_ColorMap_Arrow {
|
||||
display: block;
|
||||
position: absolute;
|
||||
}
|
||||
.jPicker_ColorBar {
|
||||
border: 2px inset #eee;
|
||||
cursor: n-resize;
|
||||
height: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
||||
margin: 12px 10px 0px 5px;
|
||||
padding: 0px;
|
||||
position: relative;
|
||||
width: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */
|
||||
}
|
||||
div[class="jPicker_ColorBar"] {
|
||||
height: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
||||
width: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
||||
}
|
||||
.jPicker_ColorBar_l1, .jPicker_ColorBar_l2, .jPicker_ColorBar_l3 {
|
||||
background-color: transparent;
|
||||
background-image: none;
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.jPicker_ColorBar_l4 {
|
||||
background-color: transparent;
|
||||
background-repeat: repeat-x;
|
||||
}
|
||||
.jPicker_ColorBar_l5 {
|
||||
background-color: transparent;
|
||||
background-repeat: repeat;
|
||||
}
|
||||
.jPicker_ColorBar_Arrow {
|
||||
display: block;
|
||||
left: -10px; /* (arrow width / 2) - (element width / 2) - position arrows' center in elements' center */
|
||||
position: absolute;
|
||||
}
|
||||
.jPicker_AlphaBar {
|
||||
border: 2px inset #eee;
|
||||
cursor: e-resize;
|
||||
display: none;
|
||||
height: 24px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 20px later */
|
||||
margin: 10px 5px 4px 5px;
|
||||
padding: 0px;
|
||||
position: relative;
|
||||
width: 260px; /* IE 6 incorrectly draws border inside the width and height instead of outside - We will fix this to 256px later */
|
||||
}
|
||||
div[class="jPicker_AlphaBar"] {
|
||||
height: 20px; /* correct to 20px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
||||
width: 256px; /* correct to 256px for browsers that support the "[class="xxx"]" selector (IE7+,Firefox,Safari,Chrome,Opera,etc.) */
|
||||
}
|
||||
.jPicker_AlphaBar_Arrow {
|
||||
display: block;
|
||||
top: -10px; /* (arrow height / 2) - (element height / 2) - position arrows' center in elements' center */
|
||||
position: absolute;
|
||||
}
|
||||
.jPicker_EnableAlpha {
|
||||
text-align: left;
|
||||
}
|
||||
.jPicker_Preview {
|
||||
font-size: x-small;
|
||||
text-align: center;
|
||||
}
|
||||
.jPicker_Preview div {
|
||||
border: 2px inset #eee;
|
||||
height: 62px;
|
||||
margin: 0px auto;
|
||||
padding: 0px;
|
||||
width: 62px;
|
||||
}
|
||||
.jPicker_Preview div span {
|
||||
border: 1px solid #000;
|
||||
display: block;
|
||||
height: 30px;
|
||||
margin: 0px auto;
|
||||
padding: 0px;
|
||||
width: 60px;
|
||||
}
|
||||
.jPicker_Preview div span.jPicker_Active {
|
||||
border-bottom-width: 0px;
|
||||
}
|
||||
.jPicker_Preview div span.jPicker_Current {
|
||||
border-top-width: 0px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.jPicker_OkCancel {
|
||||
text-align: center;
|
||||
width: 120px;
|
||||
}
|
||||
.jPicker_OkCancel input {
|
||||
width: 100px;
|
||||
}
|
||||
.jPicker_OkCancel input.jPicker_Ok {
|
||||
margin: 12px 0px 5px 0px;
|
||||
}
|
||||
.jPicker_Spacer {
|
||||
height: 10px;
|
||||
}
|
||||
.jPicker_HueText, .jPicker_SaturationText, .jPicker_BrightnessText, .jPicker_RedText, .jPicker_GreenText, .jPicker_BlueText, .jPicker_AlphaText {
|
||||
background-color: #fff;
|
||||
border: 1px inset #aaa;
|
||||
margin: 0px 0px 0px 5px;
|
||||
width: 30px;
|
||||
}
|
||||
.jPicker_EnterHex {
|
||||
text-align: right;
|
||||
}
|
||||
.jPicker_HexText {
|
||||
background-color: #fff;
|
||||
border: 1px inset #aaa;
|
||||
margin: 0px 19px 0px 5px;
|
||||
width: 50px;
|
||||
}
|
||||
td.jPicker_OpacityCol {
|
||||
padding-top: 12px;
|
||||
text-indent: -8px;
|
||||
}
|
||||
td.jPicker_OpacityCol * {
|
||||
display: none;
|
||||
}
|
||||
td.jPicker_HexCol {
|
||||
text-align: left;
|
||||
}
|
||||
.jPicker_Grid {
|
||||
text-align: center;
|
||||
}
|
||||
.jPicker_QuickColor {
|
||||
border: 1px inset #aaa;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
float: left;
|
||||
height: 12px;
|
||||
line-height: 12px;
|
||||
margin: 2px 3px 1px 3px;
|
||||
padding: 0px;
|
||||
width: 12px;
|
||||
}
|
||||
BIN
editor/jgraduate/images/Bars.png
Normal file
|
After Width: | Height: | Size: 424 B |
BIN
editor/jgraduate/images/Maps.png
Normal file
|
After Width: | Height: | Size: 82 KiB |
BIN
editor/jgraduate/images/bar-opacity.png
Normal file
|
After Width: | Height: | Size: 134 B |
BIN
editor/jgraduate/images/map-opacity.png
Normal file
|
After Width: | Height: | Size: 139 B |
BIN
editor/jgraduate/images/mappoint.gif
Normal file
|
After Width: | Height: | Size: 93 B |
BIN
editor/jgraduate/images/picker.gif
Normal file
|
After Width: | Height: | Size: 146 B |
BIN
editor/jgraduate/images/preview-opacity.png
Normal file
|
After Width: | Height: | Size: 135 B |
BIN
editor/jgraduate/images/rangearrows.gif
Normal file
|
After Width: | Height: | Size: 94 B |
BIN
editor/jgraduate/images/rangearrows2.gif
Normal file
|
After Width: | Height: | Size: 93 B |
1
editor/jgraduate/jpicker-1.0.9.min.js
vendored
Executable file
529
editor/jgraduate/jquery.jgraduate.js
Normal file
@@ -0,0 +1,529 @@
|
||||
/*
|
||||
* jGraduate 0.2.x
|
||||
*
|
||||
* jQuery Plugin for a gradient picker
|
||||
*
|
||||
* Copyright (c) 2009 Jeff Schiller
|
||||
* http://blog.codedread.com/
|
||||
*
|
||||
* Apache 2 License
|
||||
|
||||
jGraduate( options, okCallback, cancelCallback )
|
||||
|
||||
where options is an object literal:
|
||||
{
|
||||
window: { title: "Pick the start color and opacity for the gradient" },
|
||||
images: { clientPath: "images/" },
|
||||
paint: a Paint object
|
||||
}
|
||||
|
||||
- the Paint object is:
|
||||
{
|
||||
// object describing the color picked used by jPicker
|
||||
solidColor: { hex, },
|
||||
// DOM node for the linear gradient
|
||||
linearGradient: { grad, a,
|
||||
}
|
||||
- only one of solidColor and linearGradient must be non-null
|
||||
|
||||
- picker accepts the following object as input:
|
||||
{
|
||||
okCallback: function to call when Ok is pressed
|
||||
cancelCallback: function to call when Cancel is pressed
|
||||
paint: object describing the paint to display initially, if not set, then default to opaque white
|
||||
}
|
||||
|
||||
- okCallback receives a Paint object
|
||||
|
||||
*
|
||||
*/
|
||||
var ns = { svg: 'http://www.w3.org/2000/svg', xlink: 'http://www.w3.org/1999/xlink' };
|
||||
if(!window.console) {
|
||||
window.console = new function() {
|
||||
this.log = function(str) {};
|
||||
this.dir = function(str) {};
|
||||
};
|
||||
}
|
||||
$.jGraduate = {
|
||||
Paint:
|
||||
function(copy) {
|
||||
if (copy) {
|
||||
if (copy.solidColor)
|
||||
this.solidColor = new $.jPicker.Color({ hex: copy.solidColor.hex,
|
||||
a: copy.solidColor.a });
|
||||
|
||||
// FIXME: linearGradient can be an object, but .grad can still be null
|
||||
if (copy.linearGradient)
|
||||
// Opera throws NOT_SUPPORTED_ERROR if the cloneNode(null), the other browsers do not
|
||||
this.linearGradient = { grad: copy.linearGradient.grad ? document.cloneNode(copy.linearGradient.grad, true) : null,
|
||||
a: copy.linearGradient.a };
|
||||
}
|
||||
else {
|
||||
this.solidColor = new $.jPicker.Color({ hex: '000000', a: 100 });
|
||||
this.linearGradient = { grad: null, a: 100 };
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
jQuery.fn.jGraduateDefaults = {
|
||||
paint: new $.jGraduate.Paint(),
|
||||
window: {
|
||||
pickerTitle: "Drag markers to pick a paint",
|
||||
},
|
||||
images: {
|
||||
clientPath: "images/",
|
||||
},
|
||||
};
|
||||
|
||||
jQuery.fn.jGraduate =
|
||||
function(options) {
|
||||
var $arguments = arguments;
|
||||
return this.each( function() {
|
||||
var $this = $(this), $settings = $.extend(true, {}, jQuery.fn.jGraduateDefaults, options),
|
||||
id = $this.attr('id'),
|
||||
idref = '#'+$this.attr('id')+' ';
|
||||
|
||||
if (!idref)
|
||||
{
|
||||
alert('Container element must have an id attribute to maintain unique id strings for sub-elements.');
|
||||
return;
|
||||
}
|
||||
|
||||
var okClicked = function() {
|
||||
$.isFunction($this.okCallback) && $this.okCallback($this.paint);
|
||||
$this.hide();
|
||||
},
|
||||
cancelClicked = function() {
|
||||
$.isFunction($this.cancelCallback) && $this.cancelCallback();
|
||||
$this.hide();
|
||||
};
|
||||
|
||||
$.extend(true, $this, // public properties, methods, and callbacks
|
||||
{
|
||||
paint: $settings.paint,
|
||||
okCallback: $.isFunction($arguments[1]) && $arguments[1] || null,
|
||||
cancelCallback: $.isFunction($arguments[2]) && $arguments[2] || null,
|
||||
});
|
||||
|
||||
var mode = "solidColor",
|
||||
pos = $this.position(),
|
||||
color = null;
|
||||
|
||||
if ($this.paint == null) {
|
||||
$this.paint = { solidColor: new $.jPicker.Color({ hex: 'ffffff', a: 100 }),
|
||||
linearGradient: { grad: null, a: 100 } };
|
||||
}
|
||||
|
||||
if ($this.paint.linearGradient.grad != null) {
|
||||
mode = "linearGradient";
|
||||
$this.paint.solidColor = new $.jPicker.Color({ hex: 'ffffff', a: 100 });
|
||||
}
|
||||
else if ($this.paint.solidColor != null) {
|
||||
$this.paint.linearGradient = { grad: null, a: 100 };
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
|
||||
$this.addClass('jGraduate_Picker');
|
||||
$this.html('<ul class="jGraduate_tabs">' +
|
||||
'<li class="jGraduate_tab_color jGraduate_tab_current">Solid Color</li>' +
|
||||
'<li class="jGraduate_tab_lingrad">Linear Gradient</li>' +
|
||||
'</ul>' +
|
||||
'<div class="jGraduate_colPick"></div>' +
|
||||
'<div class="jGraduate_lgPick"></div>');
|
||||
var colPicker = $(idref + '> .jGraduate_colPick');
|
||||
var lgPicker = $(idref + '> .jGraduate_lgPick');
|
||||
|
||||
lgPicker.html(
|
||||
'<div id="' + id + '_jGraduate_Swatch" class="jGraduate_Swatch">' +
|
||||
'<h2 class="jGraduate_Title">' + $settings.window.pickerTitle + '</h2>' +
|
||||
'<div id="' + id + '_jGraduate_GradContainer" class="jGraduate_GradContainer"></div>' +
|
||||
'<div id="' + id + '_jGraduate_Opacity" class="jGraduate_Opacity" title="Click to set overall opacity of the gradient paint">' +
|
||||
'<img id="' + id + '_jGraduate_AlphaArrows" class="jGraduate_AlphaArrows" src="' + $settings.images.clientPath + 'rangearrows2.gif"></img>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="jGraduate_Form">' +
|
||||
'<div class="jGraduate_StopSection">' +
|
||||
'<label class="jGraduate_Form_Heading">Begin Stop</label>' +
|
||||
'<div class="jGraduate_Form_Section">' +
|
||||
'<label>x:</label>' +
|
||||
'<input type="text" id="' + id + '_jGraduate_x1" size="3" title="Enter starting x value between 0.0 and 1.0"/>' +
|
||||
'<label> y:</label>' +
|
||||
'<input type="text" id="' + id + '_jGraduate_y1" size="3" title="Enter starting y value between 0.0 and 1.0"/>' +
|
||||
'<div id="' + id + '_jGraduate_colorBoxBegin" class="colorBox"></div>' +
|
||||
'<label id="' + id + '_jGraduate_beginOpacity"> 100%</label>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="jGraduate_StopSection">' +
|
||||
'<label class="jGraduate_Form_Heading">End Stop</label>' +
|
||||
'<div class="jGraduate_Form_Section">' +
|
||||
'<label>x:</label>' +
|
||||
'<input type="text" id="' + id + '_jGraduate_x2" size="3" title="Enter ending x value between 0.0 and 1.0"/>' +
|
||||
'<label> y:</label>' +
|
||||
'<input type="text" id="' + id + '_jGraduate_y2" size="3" title="Enter ending y value between 0.0 and 1.0"/>' +
|
||||
'<div id="' + id + '_jGraduate_colorBoxEnd" class="colorBox"></div>' +
|
||||
'<label id="' + id + '_jGraduate_endOpacity">100%</label>' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="jGraduate_OpacityField">' +
|
||||
'<label class="jGraduate_OpacityLabel">A: </label>' +
|
||||
'<input type="text" id="' + id + '_jGraduate_OpacityInput" class="jGraduate_OpacityInput" size="3" value="100"/>%' +
|
||||
'</div>' +
|
||||
'</div>' +
|
||||
'<div class="jGraduate_OkCancel">' +
|
||||
'<input type="button" id="' + id + '_jGraduate_Ok" class="jGraduate_Ok" value="OK"/>' +
|
||||
'<input type="button" id="' + id + '_jGraduate_Cancel" class="jGraduate_Cancel" value="Cancel"/>' +
|
||||
'</div>' +
|
||||
'<div class="jGraduate_LightBox"></div>' +
|
||||
'<div id="' + id + '_jGraduate_stopPicker" class="jGraduate_stopPicker"></div>');
|
||||
|
||||
// --------------
|
||||
// Set up all the SVG elements (the gradient, stops and rectangle)
|
||||
var MAX = 256, MARGINX = 0, MARGINY = 0, STOP_RADIUS = 15/2,
|
||||
SIZEX = MAX - 2*MARGINX, SIZEY = MAX - 2*MARGINY;
|
||||
// var container = document.getElementById(id+'_jGraduate_Swatch');
|
||||
var container = document.getElementById(id+'_jGraduate_GradContainer');
|
||||
var svg = container.appendChild(document.createElementNS(ns.svg, 'svg'));
|
||||
svg.id = id+'_jgraduate_svg';
|
||||
svg.setAttribute('width', MAX);
|
||||
svg.setAttribute('height', MAX);
|
||||
svg.setAttribute("xmlns", ns.svg);
|
||||
|
||||
if ($this.paint.linearGradient.grad) {
|
||||
$this.paint.linearGradient.grad = svg.appendChild( document.importNode($this.paint.linearGradient.grad, true) );
|
||||
$this.paint.linearGradient.grad.id = id+'_jgraduate_grad';
|
||||
}
|
||||
else {
|
||||
var grad = svg.appendChild(document.createElementNS(ns.svg, 'linearGradient'));
|
||||
grad.id = id+'_jgraduate_grad';
|
||||
grad.setAttribute('x1','0.0');
|
||||
grad.setAttribute('y1','0.0');
|
||||
grad.setAttribute('x2','1.0');
|
||||
grad.setAttribute('y2','1.0');
|
||||
|
||||
var begin = grad.appendChild(document.createElementNS(ns.svg, 'stop'));
|
||||
begin.setAttribute('offset', '0.0');
|
||||
begin.setAttribute('stop-color', '#ff0000');
|
||||
|
||||
var end = grad.appendChild(document.createElementNS(ns.svg, 'stop'));
|
||||
end.setAttribute('offset', '1.0');
|
||||
end.setAttribute('stop-color', '#ff0');
|
||||
|
||||
$this.paint.linearGradient.grad = grad;
|
||||
}
|
||||
|
||||
var gradalpha = $this.paint.linearGradient.a;
|
||||
$('#' + id + '_jGraduate_OpacityInput').val(gradalpha);
|
||||
var posx = parseInt(255*(gradalpha/100)) - 4.5;
|
||||
$('#' + id + '_jGraduate_AlphaArrows').css({'margin-left':posx});
|
||||
$('#' + id + '_jgraduate_rect').attr('fill-opacity', gradalpha/100);
|
||||
|
||||
var x1 = parseFloat($this.paint.linearGradient.grad.getAttribute('x1')||0.0);
|
||||
var y1 = parseFloat($this.paint.linearGradient.grad.getAttribute('y1')||0.0);
|
||||
var x2 = parseFloat($this.paint.linearGradient.grad.getAttribute('x2')||1.0);
|
||||
var y2 = parseFloat($this.paint.linearGradient.grad.getAttribute('y2')||0.0);
|
||||
|
||||
var rect = document.createElementNS(ns.svg, 'rect');
|
||||
rect.id = id + '_jgraduate_rect';
|
||||
rect.setAttribute('x', MARGINX);
|
||||
rect.setAttribute('y', MARGINY);
|
||||
rect.setAttribute('width', SIZEY);
|
||||
rect.setAttribute('height', SIZEY);
|
||||
rect.setAttribute('fill', 'url(#'+id+'_jgraduate_grad)');
|
||||
rect.setAttribute('fill-opacity', '1.0');
|
||||
rect = svg.appendChild(rect);
|
||||
|
||||
// stop visuals created here
|
||||
var beginStop = document.createElementNS(ns.svg, 'image');
|
||||
beginStop.id = id + "_stop1";
|
||||
beginStop.setAttribute('class', 'stop');
|
||||
beginStop.setAttributeNS(ns.xlink, 'href', $settings.images.clientPath + 'mappoint.gif');
|
||||
beginStop.setAttributeNS(ns.xlink, "title", "Begin Stop");
|
||||
beginStop.appendChild(document.createElementNS(ns.svg, 'title')).appendChild(
|
||||
document.createTextNode("Begin Stop"));
|
||||
beginStop.setAttribute('width', 18);
|
||||
beginStop.setAttribute('height', 18);
|
||||
beginStop.setAttribute('x', MARGINX + SIZEX*x1 - STOP_RADIUS);
|
||||
beginStop.setAttribute('y', MARGINY + SIZEY*y1 - STOP_RADIUS);
|
||||
beginStop.setAttribute('cursor', 'move');
|
||||
// must append only after setting all attributes due to Webkit Bug 27952
|
||||
// https://bugs.webkit.org/show_bug.cgi?id=27592
|
||||
beginStop = svg.appendChild(beginStop);
|
||||
|
||||
var endStop = document.createElementNS(ns.svg, 'image');
|
||||
endStop.id = id + "_stop2";
|
||||
endStop.setAttribute('class', 'stop');
|
||||
endStop.setAttributeNS(ns.xlink, 'href', $settings.images.clientPath + 'mappoint.gif');
|
||||
endStop.setAttributeNS(ns.xlink, "title", "End Stop");
|
||||
endStop.appendChild(document.createElementNS(ns.svg, 'title')).appendChild(
|
||||
document.createTextNode("End Stop"));
|
||||
endStop.setAttribute('width', 18);
|
||||
endStop.setAttribute('height', 18);
|
||||
endStop.setAttribute('x', MARGINX + SIZEX*x2 - STOP_RADIUS);
|
||||
endStop.setAttribute('y', MARGINY + SIZEY*y2 - STOP_RADIUS);
|
||||
endStop.setAttribute('cursor', 'move');
|
||||
endStop = svg.appendChild(endStop);
|
||||
|
||||
// bind GUI elements
|
||||
$('#'+id+'_jGraduate_Ok').bind('click', function() {
|
||||
$this.paint.solidColor = null;
|
||||
okClicked();
|
||||
});
|
||||
$('#'+id+'_jGraduate_Cancel').bind('click', function(paint) {
|
||||
cancelClicked();
|
||||
});
|
||||
|
||||
var x1 = $this.paint.linearGradient.grad.getAttribute('x1');
|
||||
if(!x1) x1 = "0.0";
|
||||
x1Input = $('#'+id+'_jGraduate_x1');
|
||||
x1Input.val(x1);
|
||||
x1Input.change( function() {
|
||||
if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) {
|
||||
this.value = 0.0;
|
||||
}
|
||||
$this.paint.linearGradient.grad.setAttribute('x1', this.value);
|
||||
beginStop.setAttribute('x', MARGINX + SIZEX*this.value - STOP_RADIUS);
|
||||
});
|
||||
|
||||
var y1 = $this.paint.linearGradient.grad.getAttribute('y1');
|
||||
if(!y1) y1 = "0.0";
|
||||
y1Input = $('#'+id+'_jGraduate_y1');
|
||||
y1Input.val(y1);
|
||||
y1Input.change( function() {
|
||||
if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) {
|
||||
this.value = 0.0;
|
||||
}
|
||||
$this.paint.linearGradient.grad.setAttribute('y1', this.value);
|
||||
beginStop.setAttribute('y', MARGINY + SIZEY*this.value - STOP_RADIUS);
|
||||
});
|
||||
|
||||
var x2 = $this.paint.linearGradient.grad.getAttribute('x2');
|
||||
if(!x2) x2 = "1.0";
|
||||
x2Input = $('#'+id+'_jGraduate_x2');
|
||||
x2Input.val(x2);
|
||||
x2Input.change( function() {
|
||||
if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) {
|
||||
this.value = 1.0;
|
||||
}
|
||||
$this.paint.linearGradient.grad.setAttribute('x2', this.value);
|
||||
endStop.setAttribute('x', MARGINX + SIZEX*this.value - STOP_RADIUS);
|
||||
});
|
||||
|
||||
var y2 = $this.paint.linearGradient.grad.getAttribute('y2');
|
||||
if(!y2) y2 = "0.0";
|
||||
y2Input = $('#'+id+'_jGraduate_y2');
|
||||
y2Input.val(y2);
|
||||
y2Input.change( function() {
|
||||
if (isNaN(parseFloat(this.value)) || this.value < 0.0 || this.value > 1.0) {
|
||||
this.value = 0.0;
|
||||
}
|
||||
$this.paint.linearGradient.grad.setAttribute('y2', this.value);
|
||||
endStop.setAttribute('y', MARGINY + SIZEY*this.value - STOP_RADIUS);
|
||||
});
|
||||
|
||||
var stops = $this.paint.linearGradient.grad.getElementsByTagNameNS(ns.svg, 'stop');
|
||||
var numstops = stops.length;
|
||||
// if there are not at least two stops, then
|
||||
if (numstops < 2) {
|
||||
while (numstops < 2) {
|
||||
$this.paint.linearGradient.grad.appendChild( document.createElementNS(ns.svg, 'stop') );
|
||||
++numstops;
|
||||
}
|
||||
stops = $this.paint.linearGradient.grad.getElementsByTagNameNS(ns.svg, 'stop');
|
||||
}
|
||||
|
||||
var setOpacitySlider = function(e, div) {
|
||||
var offset = div.offset();
|
||||
var x = (e.pageX - offset.left - parseInt(div.css('border-left-width')));
|
||||
if (x > 255) x = 255;
|
||||
if (x < 0) x = 0;
|
||||
var posx = x - 4.5;
|
||||
x /= 255;
|
||||
$('#' + id + '_jGraduate_AlphaArrows').css({'margin-left':posx});
|
||||
$('#' + id + '_jgraduate_rect').attr('fill-opacity', x);
|
||||
x = parseInt(x*100);
|
||||
$('#' + id + '_jGraduate_OpacityInput').val(x);
|
||||
$this.paint.linearGradient.a = x;
|
||||
};
|
||||
|
||||
// handle dragging on the opacity slider
|
||||
var bSlidingOpacity = false;
|
||||
$('.jGraduate_Opacity').mousedown(function(evt) {
|
||||
setOpacitySlider(evt, $(this));
|
||||
bSlidingOpacity = true;
|
||||
evt.preventDefault();
|
||||
});
|
||||
$('.jGraduate_Opacity').mousemove(function(evt) {
|
||||
if (bSlidingOpacity) {
|
||||
setOpacitySlider(evt, $(this));
|
||||
evt.preventDefault();
|
||||
}
|
||||
});
|
||||
$('.jGraduate_Opacity').mouseup(function(evt) {
|
||||
setOpacitySlider(evt, $(this));
|
||||
bSlidingOpacity = false;
|
||||
evt.preventDefault();
|
||||
});
|
||||
|
||||
// handle dragging the stop around the swatch
|
||||
var draggingStop = null;
|
||||
var startx = -1, starty = -1;
|
||||
// for whatever reason, Opera does not allow $('image.stop') here
|
||||
$('.stop').mousedown(function(evt) {
|
||||
draggingStop = this;
|
||||
startx = evt.clientX;
|
||||
starty = evt.clientY;
|
||||
evt.preventDefault();
|
||||
});
|
||||
$('#'+id+'_jgraduate_svg').mousemove(function(evt) {
|
||||
if (null != draggingStop) {
|
||||
var dx = evt.clientX - startx;
|
||||
var dy = evt.clientY - starty;
|
||||
startx += dx;
|
||||
starty += dy;
|
||||
var x = parseFloat(draggingStop.getAttribute('x')) + dx;
|
||||
var y = parseFloat(draggingStop.getAttribute('y')) + dy;
|
||||
|
||||
// clamp stop to the swatch
|
||||
if (x < MARGINX - STOP_RADIUS) x = MARGINX - STOP_RADIUS;
|
||||
if (y < MARGINY - STOP_RADIUS) y = MARGINY - STOP_RADIUS;
|
||||
if (x > MARGINX + SIZEX - STOP_RADIUS) x = MARGINX + SIZEX - STOP_RADIUS;
|
||||
if (y > MARGINY + SIZEY - STOP_RADIUS) y = MARGINY + SIZEY - STOP_RADIUS;
|
||||
|
||||
draggingStop.setAttribute('x', x);
|
||||
draggingStop.setAttribute('y', y);
|
||||
|
||||
// calculate stop offset
|
||||
var fracx = (x - MARGINX + STOP_RADIUS)/SIZEX;
|
||||
var fracy = (y - MARGINY + STOP_RADIUS)/SIZEY;
|
||||
|
||||
if (draggingStop.id == (id+'_stop1')) {
|
||||
x1Input.val(fracx);
|
||||
y1Input.val(fracy);
|
||||
$this.paint.linearGradient.grad.setAttribute('x1', fracx);
|
||||
$this.paint.linearGradient.grad.setAttribute('y1', fracy);
|
||||
}
|
||||
else {
|
||||
x2Input.val(fracx);
|
||||
y2Input.val(fracy);
|
||||
$this.paint.linearGradient.grad.setAttribute('x2', fracx);
|
||||
$this.paint.linearGradient.grad.setAttribute('y2', fracy);
|
||||
}
|
||||
|
||||
evt.preventDefault();
|
||||
}
|
||||
});
|
||||
$('#'+id+'_jgraduate_svg').mouseup(function(evt) {
|
||||
draggingStop = null;
|
||||
});
|
||||
|
||||
var beginColor = stops[0].getAttribute('stop-color');
|
||||
if(!beginColor) beginColor = '#000';
|
||||
beginColorBox = $('#'+id+'_jGraduate_colorBoxBegin');
|
||||
beginColorBox.css({'background-color':beginColor});
|
||||
|
||||
var beginOpacity = stops[0].getAttribute('stop-opacity');
|
||||
if(!beginOpacity) beginOpacity = '1.0';
|
||||
$('#'+id+'jGraduate_beginOpacity').html( (beginOpacity*100)+'%' );
|
||||
|
||||
var endColor = stops[stops.length-1].getAttribute('stop-color');
|
||||
if(!endColor) endColor = '#000';
|
||||
endColorBox = $('#'+id+'_jGraduate_colorBoxEnd');
|
||||
endColorBox.css({'background-color':endColor});
|
||||
|
||||
var endOpacity = stops[stops.length-1].getAttribute('stop-opacity');
|
||||
if(!endOpacity) endOpacity = '1.0';
|
||||
$('#'+id+'jGraduate_endOpacity').html( (endOpacity*100)+'%' );
|
||||
|
||||
$('#'+id+'_jGraduate_colorBoxBegin').click(function() {
|
||||
$('div.jGraduate_LightBox').show();
|
||||
var colorbox = $(this);
|
||||
color = new $.jPicker.Color({ hex: beginColor.substr(1), a:(parseFloat(beginOpacity)*100) });
|
||||
$('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'bottom': 15}).jPicker({
|
||||
window: { title: "Pick the start color and opacity for the gradient" },
|
||||
images: { clientPath: $settings.images.clientPath },
|
||||
color: { active: color, alphaSupport: true }
|
||||
}, function(color){
|
||||
beginColor = '#' + this.settings.color.active.hex;
|
||||
beginOpacity = this.settings.color.active.a/100;
|
||||
colorbox.css('background', beginColor);
|
||||
$('#'+id+'_jGraduate_beginOpacity').html(parseInt(beginOpacity*100)+'%');
|
||||
stops[0].setAttribute('stop-color', beginColor);
|
||||
stops[0].setAttribute('stop-opacity', beginOpacity);
|
||||
$('div.jGraduate_LightBox').hide();
|
||||
$('#'+id+'_jGraduate_stopPicker').hide();
|
||||
}, null, function() {
|
||||
$('div.jGraduate_LightBox').hide();
|
||||
$('#'+id+'_jGraduate_stopPicker').hide();
|
||||
});
|
||||
});
|
||||
$('#'+id+'_jGraduate_colorBoxEnd').click(function() {
|
||||
$('div.jGraduate_LightBox').show();
|
||||
var colorbox = $(this);
|
||||
color = new $.jPicker.Color({ hex: endColor.substr(1), a:(parseFloat(endOpacity)*100) });
|
||||
$('#'+id+'_jGraduate_stopPicker').css({'left': 100, 'top': 15}).jPicker({
|
||||
window: { title: "Pick the end color and opacity for the gradient" },
|
||||
images: { clientPath: $settings.images.clientPath },
|
||||
color: { active: color, alphaSupport: true }
|
||||
}, function(color){
|
||||
endColor = '#' + this.settings.color.active.hex;
|
||||
endOpacity = this.settings.color.active.a/100;
|
||||
colorbox.css('background', endColor);
|
||||
$('#'+id+'_jGraduate_endOpacity').html(parseInt(endOpacity*100)+'%');
|
||||
stops[1].setAttribute('stop-color', endColor);
|
||||
stops[1].setAttribute('stop-opacity', endOpacity);
|
||||
$('div.jGraduate_LightBox').hide();
|
||||
$('#'+id+'_jGraduate_stopPicker').hide();
|
||||
}, null, function() {
|
||||
$('div.jGraduate_LightBox').hide();
|
||||
$('#'+id+'_jGraduate_stopPicker').hide();
|
||||
});
|
||||
});
|
||||
|
||||
// --------------
|
||||
|
||||
colPicker.jPicker(
|
||||
{
|
||||
window: { title: $settings.window.pickerTitle },
|
||||
images: { clientPath: $settings.images.clientPath },
|
||||
color: { active: $this.paint.solidColor, alphaSupport: true }
|
||||
},
|
||||
function(color) {
|
||||
$this.paint.solidColor = color;
|
||||
$this.paint.linearGradient.grad = null;
|
||||
okClicked();
|
||||
},
|
||||
null,
|
||||
function(){ cancelClicked(); }
|
||||
);
|
||||
|
||||
$(idref + ' .jGraduate_tab_color').click( function(){
|
||||
$(idref + ' .jGraduate_tab_lingrad').removeClass('jGraduate_tab_current');
|
||||
$(idref + ' .jGraduate_tab_color').addClass('jGraduate_tab_current');
|
||||
lgPicker.hide();
|
||||
colPicker.show();
|
||||
});
|
||||
$(idref + ' .jGraduate_tab_lingrad').click( function(){
|
||||
$(idref + ' .jGraduate_tab_color').removeClass('jGraduate_tab_current');
|
||||
$(idref + ' .jGraduate_tab_lingrad').addClass('jGraduate_tab_current');
|
||||
colPicker.hide();
|
||||
lgPicker.show();
|
||||
});
|
||||
|
||||
if (mode == "linearGradient") {
|
||||
lgPicker.show();
|
||||
colPicker.hide();
|
||||
$(idref + ' .jGraduate_tab_color').removeClass('jGraduate_tab_current');
|
||||
$(idref + ' .jGraduate_tab_lingrad').addClass('jGraduate_tab_current');
|
||||
}
|
||||
else {
|
||||
colPicker.show();
|
||||
lgPicker.hide();
|
||||
$(idref + ' .jGraduate_tab_color').addClass('jGraduate_tab_current');
|
||||
$(idref + ' .jGraduate_tab_lingrad').removeClass('jGraduate_tab_current');
|
||||
}
|
||||
|
||||
$this.show();
|
||||
});
|
||||
};
|
||||