Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the transparency tool to work on a range #311

Closed
sashadev-sky opened this issue Jun 25, 2019 · 2 comments · Fixed by #1260 · May be fixed by #667
Closed

Get the transparency tool to work on a range #311

sashadev-sky opened this issue Jun 25, 2019 · 2 comments · Fixed by #1260 · May be fixed by #667

Comments

@sashadev-sky
Copy link
Member

Currently we just have two levels - opaque (opacity level at 1) and transparent (opacity level at 0.7)
transparency

Relevant lines of code are:

  1. an opacity option for the 0.7 value

    L.DistortableImage.Edit = L.Handler.extend({
    options: {
    opacity: 0.7,
    outline: "1px solid red",
    keymap: {
    'Backspace': '_removeOverlay', // backspace windows / delete mac
    'CapsLock': '_toggleRotate',
    'Escape': '_deselect',
    'd': '_toggleRotateScale',
    'r': '_toggleRotateScale',
    'j': '_toggleOrder',
    'k': '_toggleOrder',
    'l': '_toggleLock',
    'o': '_toggleOutline',
    's': '_toggleScale',
    't': '_toggleTransparency',
    }
    },

  2. The _toggleTransparency action:

    _toggleTransparency: function() {
    var image = this._overlay._image,
    opacity;
    this._transparent = !this._transparent;
    opacity = this._transparent ? this.options.opacity : 1;
    L.DomUtil.setOpacity(image, opacity);
    image.setAttribute("opacity", opacity);
    },

  3. The corresponding toolbar icon code:

    ToggleTransparency = EditOverlayAction.extend({
    options: {
    toolbarIcon: {
    html: '<i class="material-icons md-18">opacity</i>',
    tooltip: 'Toggle Transparency'
    }
    },
    addHooks: function() {
    var editing = this._overlay.editing;
    editing._toggleTransparency();
    this.disable();
    }
    }),

It would be great to get the transparency tool to work on a range – going from opaque to increasingly more transparent.

@carlo-ev
Copy link
Contributor

carlo-ev commented Jun 7, 2020

Hello
Can I give this issue a go? I would love to contribute to the project once more.
Just to clarify the transparency should be toggled still just by clicks that instead of two values go through a range of values sequentially?

@themacboy
Copy link
Contributor

#1231

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants