RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-272346

GOGANOID _'s questions

Martin Hope
GOGANOID _
Asked: 2020-08-17 21:30:10 +0000 UTC

康瓦斯。如何在点击时获取对象?

  • -1

我和 konva 一起工作,我有一系列这种类型的正方形

let square= new Konva.Rect({
              x:cur_x,
              y:cur_y,
              width:seg_size,
              height:seg_size,
              stroke:"black",
              fill:"green",
              name:"rect"
          });

我得到它们都是这样的:var s=stage.find(".rect"); 现在,当我点击其中一个方块时,我需要得到它的位置。我这样做

s.on("click",()=>{
   console.log(this.getClientRect().x)
});

但是我得到TypeError: this.getClientRect is not a function. 了如何获取位于数组(组)中的元素?

javascript
  • 1 个回答
  • 10 Views
Martin Hope
GOGANOID _
Asked: 2020-05-20 22:52:51 +0000 UTC

如何在编辑表单上方添加面板?

  • 0

我想将降价添加到管理面板。在所有降价中,tinymce 有效,但它缺乏添加代码的能力。结果,形成了两个问题: 1.我可以将自己的按钮添加到tinymce吗?如何?2.我找到了admin表单模板,但是这个表单在for中循环。原来符号栏会出现在好几个地方。唯一想到的是通过js添加html和css。

{% extends "admin/base_site.html" %}
{% load i18n admin_urls static admin_modify %}

{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="{% url 'admin:jsi18n' %}"></script>
{{ media }}
{% endblock %}

{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% static "admin/css/forms.css" %}" />{% endblock %}

{% block coltype %}colM{% endblock %}

{% block bodyclass %}{{ block.super }} app-{{ opts.app_label }} model-{{ opts.model_name }} change-form{% endblock %}

{% if not is_popup %}
{% block breadcrumbs %}
<div class="breadcrumbs">
<a href="{% url 'admin:index' %}">{% trans 'Home' %}</a>
&rsaquo; <a href="{% url 'admin:app_list' app_label=opts.app_label %}">{{ opts.app_config.verbose_name }}</a>
&rsaquo; {% if has_change_permission %}<a href="{% url opts|admin_urlname:'changelist' %}">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %}
&rsaquo; {% if add %}{% blocktrans with name=opts.verbose_name %}Add {{ name }}{% endblocktrans %}{% else %}{{ original|truncatewords:"18" }}{% endif %}
</div>
{% endblock %}
{% endif %}

{% block content %}<div id="content-main">
{% block object-tools %}
{% if change %}{% if not is_popup %}
  <ul class="object-tools">
    {% block object-tools-items %}
    <li>
        {% url opts|admin_urlname:'history' original.pk|admin_urlquote as history_url %}
        <a href="{% add_preserved_filters history_url %}" class="historylink">{% trans "History" %}</a>
    </li>
    {% if has_absolute_url %}<li><a href="{{ absolute_url }}" class="viewsitelink">{% trans "View on site" %}</a></li>{% endif %}
    {% endblock %}
  </ul>
{% endif %}{% endif %}
{% endblock %}
<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.model_name }}_form" novalidate>{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="{{ is_popup_var }}" value="1" />{% endif %}
{% if to_field %}<input type="hidden" name="{{ to_field_var }}" value="{{ to_field }}" />{% endif %}
{% if save_on_top %}{% block submit_buttons_top %}{% submit_row %}{% endblock %}{% endif %}
{% if errors %}
    <p class="errornote">
    {% if errors|length == 1 %}{% trans "Please correct the error below." %}{% else %}{% trans "Please correct the errors below." %}{% endif %}
    </p>
    {{ adminform.form.non_field_errors }}
{% endif %}

{% block field_sets %}

{% for fieldset in adminform %}

  {% include "admin/includes/fieldset.html" %}

{% endfor %}
{% endblock %}

{% block after_field_sets %}{% endblock %}

{% block inline_field_sets %}
{% for inline_admin_formset in inline_admin_formsets %}
    {% include inline_admin_formset.opts.template %}
{% endfor %}
{% endblock %}

{% block after_related_objects %}{% endblock %}

{% block submit_buttons_bottom %}{% submit_row %}{% endblock %}

{% block admin_change_form_document_ready %}
    <script type="text/javascript"
            id="django-admin-form-add-constants"
            src="{% static 'admin/js/change_form.js' %}"
            {% if adminform and add %}
                data-model-name="{{ opts.model_name }}"
            {% endif %}>
    </script>
{% endblock %}

{# JavaScript for prepopulated fields #}
{% prepopulated_fields_js %}

</div>
</form></div>
{% endblock %}
python
  • 1 个回答
  • 10 Views
Martin Hope
GOGANOID _
Asked: 2020-05-04 01:35:27 +0000 UTC

图像爬出块?

  • 0

如何确保图像不会超出 about 块并占用整个宽度而没有文本?

链接到代码

#about_text{
    width: 45vw;
     text-decoration: none;
    font-family: "Robo Thin",arial;
margin-left: 5vw;
    margin-top: 2vh;
    font-size: 3.3vmin;
}
#myface{
    float: right;
    height: inherit;
}
#about img{
width:50%;
    height: 100%;
}
 <div id="about">
    <img src="https://static.turbosquid.com/Preview/2014/05/20__03_25_27/002.jpg270ff933-f7cc-4047-9239-b2f122590032Original.jpg" alt="" id="myface">
<div id="about_text">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam ligula augue, tempus rutrum rhoncus in, mattis vel metus. Aliquam at neque neque. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque dapibus ipsum quis massa vestibulum, non malesuada leo tempor. Sed ac venenatis mauris. Maecenas ultrices est purus, faucibus faucibus ipsum interdum vel. Phasellus sapien urna, venenatis eget lacus a, vestibulum ultrices massa. Duis tristique feugiat leo, at aliquam erat.

Aenean tincidunt dapibus est, sed aliquam nibh fringilla id. Duis neque mi, dignissim sed lacinia vel, laoreet eu nisl. Vivamus iaculis rutrum rutrum. Donec at nibh quis ex pharetra varius sed et arcu. Donec laoreet dignissim leo. Donec pulvinar metus elit, quis molestie nulla luctus et. Aliquam erat est, suscipit nec laoreet maximus, ornare at justo. Pellentesque nec auctor lectus. Ut finibus porttitor nulla. Maecenas id quam eu tellus aliquet vestibulum. Donec ac porta metus.
     </div>        
   
    </div>

html
  • 1 个回答
  • 10 Views
Martin Hope
GOGANOID _
Asked: 2020-10-30 20:26:12 +0000 UTC

如何在不使用画布的情况下获取像素的颜色?

  • 11

有这样的代码。

#photo{
    position: absolute;
    width: 100px;
    height: 100px;
}
#wrapper{
    position: relative;
    overflow: hidden;
    width: 1px;
    height: 1px;
}

<div id=wrapper>
    <img src="image.jpg" alt="" id="photo">
</div>

如何找出可见像素的颜色?

php
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5